• Y
    x86/KASLR: Allow randomization below the load address · e066cc47
    Yinghai Lu 提交于
    Currently the kernel image physical address randomization's lower
    boundary is the original kernel load address.
    
    For bootloaders that load kernels into very high memory (e.g. kexec),
    this means randomization takes place in a very small window at the
    top of memory, ignoring the large region of physical memory below
    the load address.
    
    Since mem_avoid[] is already correctly tracking the regions that must be
    avoided, this patch changes the minimum address to whatever is less:
    512M (to conservatively avoid unknown things in lower memory) or the
    load address. Now, for example, if the kernel is loaded at 8G, [512M,
    8G) will be added to the list of possible physical memory positions.
    Signed-off-by: NYinghai Lu <yinghai@kernel.org>
    [ Rewrote the changelog, refactored the code to use min(). ]
    Signed-off-by: NKees Cook <keescook@chromium.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: H.J. Lu <hjl.tools@gmail.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1464216334-17200-6-git-send-email-keescook@chromium.org
    [ Edited the changelog some more, plus the code comment as well. ]
    Signed-off-by: NIngo Molnar <mingo@kernel.org>
    e066cc47
kaslr.c 15.5 KB