linux/arch/x86
Jiri Kosina f47233c2d3 x86/mm/ASLR: Propagate base load address calculation
Commit:

  e2b32e6785 ("x86, kaslr: randomize module base load address")

makes the base address for module to be unconditionally randomized in
case when CONFIG_RANDOMIZE_BASE is defined and "nokaslr" option isn't
present on the commandline.

This is not consistent with how choose_kernel_location() decides whether
it will randomize kernel load base.

Namely, CONFIG_HIBERNATION disables kASLR (unless "kaslr" option is
explicitly specified on kernel commandline), which makes the state space
larger than what module loader is looking at. IOW CONFIG_HIBERNATION &&
CONFIG_RANDOMIZE_BASE is a valid config option, kASLR wouldn't be applied
by default in that case, but module loader is not aware of that.

Instead of fixing the logic in module.c, this patch takes more generic
aproach. It introduces a new bootparam setup data_type SETUP_KASLR and
uses that to pass the information whether kaslr has been applied during
kernel decompression, and sets a global 'kaslr_enabled' variable
accordingly, so that any kernel code (module loading, livepatching, ...)
can make decisions based on its value.

x86 module loader is converted to make use of this flag.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>
Link: https://lkml.kernel.org/r/alpine.LNX.2.00.1502101411280.10719@pobox.suse.cz
[ Always dump correct kaslr status when panicking ]
Signed-off-by: Borislav Petkov <bp@suse.de>
2015-02-19 11:38:54 +01:00
..
boot x86/mm/ASLR: Propagate base load address calculation 2015-02-19 11:38:54 +01:00
configs x86/kconfig/defconfig: Enable CONFIG_FHANDLE=y 2014-12-08 12:04:17 +01:00
crypto crypto: add missing crypto module aliases 2015-01-13 22:29:11 +11:00
ia32 x86: hook up execveat system call 2014-12-13 12:42:51 -08:00
include x86/mm/ASLR: Propagate base load address calculation 2015-02-19 11:38:54 +01:00
kernel x86/mm/ASLR: Propagate base load address calculation 2015-02-19 11:38:54 +01:00
kvm KVM: x86: check LAPIC presence when building apic_map 2015-01-30 12:28:31 +01:00
lguest x86: Avoid building unused IRQ entry stubs 2014-12-16 14:08:14 +01:00
lib x86: Fix off-by-one in instruction decoder 2015-01-09 11:12:26 +01:00
math-emu
mm vm: add VM_FAULT_SIGSEGV handling support 2015-01-29 10:51:32 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-12-10 15:48:20 -05:00
oprofile percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t 2014-08-28 08:58:57 -04:00
pci PCI updates for v3.19: 2015-02-05 10:23:12 -08:00
platform Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-19 14:02:02 -08:00
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2014-10-09 22:26:04 -04:00
purgatory Merge branches 'x86-build-for-linus', 'x86-cleanups-for-linus' and 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 12:35:46 -08:00
realmode
syscalls x86: hook up execveat system call 2014-12-13 12:42:51 -08:00
tools x86, build: replace Perl script with Shell script 2015-01-26 13:37:18 -08:00
um x86, um: actually mark system call tables readonly 2015-01-04 14:21:25 +01:00
vdso x86_64, vdso: Fix the vdso address randomization algorithm 2014-12-20 16:56:57 -08:00
video
xen xen: bug fixes for 3.19-rc4 2015-01-14 08:07:42 +13:00
.gitignore x86/build: Add arch/x86/purgatory/ make generated files to gitignore 2014-10-09 09:29:46 +02:00
Kbuild kexec: create a new config option CONFIG_KEXEC_FILE for new syscall 2014-08-29 16:28:16 -07:00
Kconfig x86/apic: Re-enable PCI_MSI support for non-SMP X86_32 2015-01-23 10:20:30 +01:00
Kconfig.cpu
Kconfig.debug
Makefile Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 18:17:33 +02:00
Makefile_32.cpu
Makefile.um