• A
    x86/unwinder/orc: Dont bail on stack overflow · d3a09104
    Andy Lutomirski 提交于
    If the stack overflows into a guard page and the ORC unwinder should work
    well: by construction, there can't be any meaningful data in the guard page
    because no writes to the guard page will have succeeded.
    
    But there is a bug that prevents unwinding from working correctly: if the
    starting register state has RSP pointing into a stack guard page, the ORC
    unwinder bails out immediately.
    
    Instead of bailing out immediately check whether the next page up is a
    valid check page and if so analyze that. As a result the ORC unwinder will
    start the unwind.
    
    Tested by intentionally overflowing the task stack.  The result is an
    accurate call trace instead of a trace consisting purely of '?' entries.
    
    There are a few other bugs that are triggered if the unwinder encounters a
    stack overflow after the first step, but they are outside the scope of this
    fix.
    Signed-off-by: NAndy Lutomirski <luto@kernel.org>
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Borislav Petkov <bpetkov@suse.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: David Laight <David.Laight@aculab.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Eduardo Valentin <eduval@amazon.com>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: aliguori@amazon.com
    Cc: daniel.gruss@iaik.tugraz.at
    Cc: hughd@google.com
    Cc: keescook@google.com
    Link: https://lkml.kernel.org/r/20171204150604.991389777@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
    d3a09104
unwind_orc.c 14.9 KB