Skip to content

Commit ae8d1d0

Browse files
tlendackyKAGA-KOKO
authored andcommitted
x86/mm/sme: Disable stack protection for mem_encrypt_identity.c
Stack protection is not compatible with early boot code. All of the early SME boot code is now isolated in a separate file, mem_encrypt_identity.c, so arch/x86/mm/Makefile can be updated to turn off stack protection for the entire file. This eliminates the need to worry about other functions within the file being instrumented with stack protection (as was seen when a newer version of GCC instrumented sme_encrypt_kernel() where an older version hadn't). It also allows removal of the __nostackprotector attribute from individual functions. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Link: https://lkml.kernel.org/r/20180226232554.14108.16881.stgit@tlendack-t1.amdoffice.net
1 parent 1ea4fe8 commit ae8d1d0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/x86/mm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
1919
nostackp := $(call cc-option, -fno-stack-protector)
2020
CFLAGS_physaddr.o := $(nostackp)
2121
CFLAGS_setup_nx.o := $(nostackp)
22+
CFLAGS_mem_encrypt_identity.o := $(nostackp)
2223

2324
CFLAGS_fault.o := -I$(src)/../include/asm/trace
2425

arch/x86/mm/mem_encrypt_identity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static unsigned long __init sme_pgtable_calc(unsigned long len)
266266
return entries + tables;
267267
}
268268

269-
void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp)
269+
void __init sme_encrypt_kernel(struct boot_params *bp)
270270
{
271271
unsigned long workarea_start, workarea_end, workarea_len;
272272
unsigned long execute_start, execute_end, execute_len;
@@ -468,7 +468,7 @@ void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp)
468468
native_write_cr3(__native_read_cr3());
469469
}
470470

471-
void __init __nostackprotector sme_enable(struct boot_params *bp)
471+
void __init sme_enable(struct boot_params *bp)
472472
{
473473
const char *cmdline_ptr, *cmdline_arg, *cmdline_on, *cmdline_off;
474474
unsigned int eax, ebx, ecx, edx;

0 commit comments

Comments
 (0)