linux/arch/x86
Hector Marco-Gisbert 89df0e7a8a x86/mm/32: Enable full randomization on i386 and X86_32
commit 8b8addf891 upstream.

Currently on i386 and on X86_64 when emulating X86_32 in legacy mode, only
the stack and the executable are randomized but not other mmapped files
(libraries, vDSO, etc.). This patch enables randomization for the
libraries, vDSO and mmap requests on i386 and in X86_32 in legacy mode.

By default on i386 there are 8 bits for the randomization of the libraries,
vDSO and mmaps which only uses 1MB of VA.

This patch preserves the original randomness, using 1MB of VA out of 3GB or
4GB. We think that 1MB out of 3GB is not a big cost for having the ASLR.

The first obvious security benefit is that all objects are randomized (not
only the stack and the executable) in legacy mode which highly increases
the ASLR effectiveness, otherwise the attackers may use these
non-randomized areas. But also sensitive setuid/setgid applications are
more secure because currently, attackers can disable the randomization of
these applications by setting the ulimit stack to "unlimited". This is a
very old and widely known trick to disable the ASLR in i386 which has been
allowed for too long.

Another trick used to disable the ASLR was to set the ADDR_NO_RANDOMIZE
personality flag, but fortunately this doesn't work on setuid/setgid
applications because there is security checks which clear Security-relevant
flags.

This patch always randomizes the mmap_legacy_base address, removing the
possibility to disable the ASLR by setting the stack to "unlimited".

Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Acked-by: Ismael Ripoll Ripoll <iripoll@upv.es>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akpm@linux-foundation.org
Cc: kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/1457639460-5242-1-git-send-email-hecmargi@upv.es
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2016-05-01 00:06:10 +02:00
..
boot x86/efi: Fix multiple GOP device support 2015-11-16 11:27:00 +00:00
configs USB: remove CONFIG_USB_DEBUG from defconfig files 2014-05-28 09:40:45 -07:00
crypto crypto: ghash-clmulni: specify context size for ghash async algorithm 2015-09-29 16:44:46 +01:00
ia32 x86/entry/compat: Add missing CLAC to entry_INT80_32 2016-03-08 12:15:09 +00:00
include x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() 2016-05-01 00:06:01 +02:00
kernel x86/iopl: Fix iopl capability check on Xen PV 2016-05-01 00:06:01 +02:00
kvm KVM: x86: Inject pending interrupt even if pending nmi exist 2016-05-01 00:06:08 +02:00
lguest asmlinkage, x86: Add explicit __visible to arch/x86/* 2014-05-05 16:07:44 -07:00
lib perf/x86: Fix copy_from_user_nmi() return if range is not ok 2015-09-30 13:20:53 +01:00
math-emu x86/ldt: Further fix FPU emulation 2015-09-03 13:29:55 +01:00
mm x86/mm/32: Enable full randomization on i386 and X86_32 2016-05-01 00:06:10 +02:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-06-03 14:30:07 +01:00
oprofile x86, oprofile, nmi: Fix CPU hotplug callback registration 2014-03-20 13:43:43 +01:00
pci x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs 2016-05-01 00:05:56 +02:00
platform efi: Disable interrupts around EFI calls, not in the epilog/prolog calls 2016-01-25 10:43:30 +00:00
power x86/ldt: Make modify_ldt synchronous 2015-08-31 14:14:09 +01:00
realmode x86/build: Supress realmode.bin is up to date message 2014-04-16 15:17:24 +02:00
syscalls x86, x32: Use compat shims for io_{setup,submit} 2014-05-04 17:49:22 -07:00
tools x86, build: replace Perl script with Shell script 2015-02-04 10:58:18 +00:00
um um: Fix build error and kconfig for i386 2016-02-02 19:50:28 +00:00
vdso x86/vdso: Fix 'make bzImage' on older distros 2015-05-28 10:00:02 +01:00
video x86: Use vga_default_device() when determining whether an fb is primary 2012-04-24 09:50:17 +01:00
xen x86/iopl/64: Properly context-switch IOPL on Xen PV 2016-04-11 09:54:23 +01:00
.gitignore x86/kprobes: Add arch/x86/tools/insn_sanity to .gitignore 2012-01-16 08:21:59 +01:00
Kbuild x86, realmode: realmode.bin infrastructure 2012-05-08 11:41:48 -07:00
Kconfig x86/iosf: Add Kconfig prompt for IOSF_MBI selection 2015-07-15 10:01:31 +01:00
Kconfig.cpu Merge branch 'x86-nuke-platforms-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-04-02 13:15:58 -07:00
Kconfig.debug x86/efi: Dump the EFI page table 2014-03-04 16:17:17 +00:00
Makefile x86-64, build: Fix stack protector Makefile breakage with 32-bit userland 2014-05-07 14:14:44 -07:00
Makefile.um um: fix linker script generation 2012-04-09 13:59:00 -04:00
Makefile_32.cpu x86, 386 removal: Remove CONFIG_M386 from Kconfig 2012-11-29 13:23:01 -08:00