• Ashish Kalra's avatar
    x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup · 85763352
    Ashish Kalra authored
    commit d594aa02 upstream.
    
    The minimum size for a new stack (512 bytes) setup for arch/x86/boot components
    when the bootloader does not setup/provide a stack for the early boot components
    is not "enough".
    
    The setup code executing as part of early kernel startup code, uses the stack
    beyond 512 bytes and accidentally overwrites and corrupts part of the BSS
    section. This is exposed mostly in the early video setup code, where
    it was corrupting BSS variables like force_x, force_y, which in-turn affected
    kernel parameters such as screen_info (screen_info.orig_video_cols) and
    later caused an exception/panic in console_init().
    
    Most recent boot loaders setup the stack for early boot components, so this
    stack overwriting into BSS section issue has not been exposed.
    Signed-off-by: default avatarAshish Kalra <ashish@bluestacks.com>
    Cc: Andy Lutomirski <luto@kernel.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: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/20170419152015.10011-1-ashishkalra@Ashishs-MacBook-Pro.localSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    85763352
boot.h 8.07 KB