• Baoquan He's avatar
    x86/mm/KASLR: Exclude EFI region from KASLR VA space randomization · 4ea2e307
    Baoquan He authored
    commit a46f60d7 upstream.
    
    Currently KASLR is enabled on three regions: the direct mapping of physical
    memory, vamlloc and vmemmap. However the EFI region is also mistakenly
    included for VA space randomization because of misusing EFI_VA_START macro
    and assuming EFI_VA_START < EFI_VA_END.
    
    (This breaks kexec and possibly other things that rely on stable addresses.)
    
    The EFI region is reserved for EFI runtime services virtual mapping which
    should not be included in KASLR ranges. In Documentation/x86/x86_64/mm.txt,
    we can see:
    
      ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space
    
    EFI uses the space from -4G to -64G thus EFI_VA_START > EFI_VA_END,
    Here EFI_VA_START = -4G, and EFI_VA_END = -64G.
    
    Changing EFI_VA_START to EFI_VA_END in mm/kaslr.c fixes this problem.
    Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
    Reviewed-by: default avatarBhupesh Sharma <bhsharma@redhat.com>
    Acked-by: default avatarDave Young <dyoung@redhat.com>
    Acked-by: default avatarThomas Garnier <thgarnie@google.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/1490331592-31860-1-git-send-email-bhe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4ea2e307
kaslr.c 6.12 KB