android_kernel_samsung_msm8976/arch/x86
Hector Marco-Gisbert 676f73cc6e UPSTREAM: x86/mm/32: Enable full randomization on i386 and X86_32
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 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>

Bug: 28763575
Change-Id: Icd128489c3c196ade64f79d4ea898d29f8471baf
(cherry picked from commit 8b8addf891de8a00e4d39fc32f93f7c5eb8feceb)
2017-10-19 01:00:49 +02:00
..
boot Merge remote-tracking branch 'f2fs/linux-3.10.y' into HEAD 2017-04-18 17:02:28 +02:00
configs bludgeon the flounder kernel until it builds on i386 for qemu testing 2015-09-16 18:20:19 +05:30
crypto crypto: ghash-clmulni: specify context size for ghash async algorithm 2015-09-21 10:00:08 -07:00
ia32 This is the 3.10.100 stable release 2017-04-18 17:17:52 +02:00
include This is the 3.10.102 stable release 2017-04-18 17:22:08 +02:00
kernel mm: larger stack guard gap, between vmas 2017-07-11 00:00:39 +00:00
kvm x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE 2016-06-07 10:42:44 +02:00
lguest
lib
math-emu
mm UPSTREAM: x86/mm/32: Enable full randomization on i386 and X86_32 2017-10-19 01:00:49 +02:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-10-01 12:07:34 +02:00
oprofile
pci x86/PCI: Use host bridge _CRS info on Foxconn K8M890-8237A 2015-07-10 10:40:22 -07:00
platform This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
realmode
syscalls BACKPORT: random: introduce getrandom(2) system call 2017-09-08 18:50:11 +00:00
tools
um um: remove dead code 2015-09-16 18:20:08 +05:30
vdso
video
xen x86/iopl/64: Properly context-switch IOPL on Xen PV 2016-06-07 10:42:43 +02:00
.gitignore
Kbuild
Kconfig Import latest Samsung release 2017-04-18 03:43:52 +02:00
Kconfig.cpu x86, 386 removal: Document Nx586 as a 386 and thus unsupported 2012-11-29 13:28:39 -08:00
Kconfig.debug
Makefile
Makefile.um
Makefile_32.cpu