diff options
author | Borislav Petkov <bp@suse.de> | 2015-04-01 12:49:52 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-03 15:26:15 +0200 |
commit | 78cac48c0434c82e860fade3cd0420a7a4adbb08 (patch) | |
tree | 76e1afefb1a0f9baad05487738de9f1b4a126aa7 /arch/x86/boot/compressed/aslr.c | |
parent | x86/asm/entry: Drop now unused ENABLE_INTERRUPTS_SYSEXIT32 (diff) | |
download | linux-78cac48c0434c82e860fade3cd0420a7a4adbb08.tar.xz linux-78cac48c0434c82e860fade3cd0420a7a4adbb08.zip |
x86/mm/KASLR: Propagate KASLR status to kernel proper
Commit:
e2b32e678513 ("x86, kaslr: randomize module base load address")
made module base address randomization unconditional and didn't regard
disabled KKASLR due to CONFIG_HIBERNATION and command line option
"nokaslr". For more info see (now reverted) commit:
f47233c2d34f ("x86/mm/ASLR: Propagate base load address calculation")
In order to propagate KASLR status to kernel proper, we need a single bit
in boot_params.hdr.loadflags and we've chosen bit 1 thus leaving the
top-down allocated bits for bits supposed to be used by the bootloader.
Originally-From: Jiri Kosina <jkosina@suse.cz>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/boot/compressed/aslr.c')
-rw-r--r-- | arch/x86/boot/compressed/aslr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index bb1376381985..d7b1f655b3ef 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c @@ -295,7 +295,8 @@ static unsigned long find_random_addr(unsigned long minimum, return slots_fetch_random(); } -unsigned char *choose_kernel_location(unsigned char *input, +unsigned char *choose_kernel_location(struct boot_params *boot_params, + unsigned char *input, unsigned long input_size, unsigned char *output, unsigned long output_size) @@ -315,6 +316,8 @@ unsigned char *choose_kernel_location(unsigned char *input, } #endif + boot_params->hdr.loadflags |= KASLR_FLAG; + /* Record the various known unsafe memory ranges. */ mem_avoid_init((unsigned long)input, input_size, (unsigned long)output, output_size); |