x86/KASLR: Handle the memory limit specified by the 'memmap=' and 'mem=' boot options
authorBaoquan He <bhe@redhat.com>
Sat, 13 May 2017 05:46:29 +0000 (13:46 +0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 24 May 2017 07:50:27 +0000 (09:50 +0200)
commit4cdba14f84c9102c4434384731cd61018b970d59
tree4fb08d80e24df7dcc71a669622d6cbdf9c19f1b9
parentd52e7d5a952c5e35783f96e8c5b7fcffbb0d7c60
x86/KASLR: Handle the memory limit specified by the 'memmap=' and 'mem=' boot options

The 'mem=' boot option limits the max address a system can use - any memory
region above the limit will be removed.

Furthermore, the 'memmap=nn[KMG]' variant (with no offset specified) has the same
behaviour as 'mem='.

KASLR needs to consider this when choosing the random position for
decompressing the kernel. Do it.

Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dan.j.williams@intel.com
Cc: douly.fnst@cn.fujitsu.com
Cc: dyoung@redhat.com
Link: http://lkml.kernel.org/r/1494654390-23861-3-git-send-email-bhe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/boot/compressed/kaslr.c