• Josh Poimboeuf's avatar
    x86/asm: Don't use RBP as a temporary register in csum_partial_copy_generic() · 42fc6c6c
    Josh Poimboeuf authored
    Andrey Konovalov reported the following warning while fuzzing the kernel
    with syzkaller:
    
      WARNING: kernel stack regs at ffff8800686869f8 in a.out:4933 has bad 'bp' value c3fc855a10167ec0
    
    The unwinder dump revealed that RBP had a bad value when an interrupt
    occurred in csum_partial_copy_generic().
    
    That function saves RBP on the stack and then overwrites it, using it as
    a scratch register.  That's problematic because it breaks stack traces
    if an interrupt occurs in the middle of the function.
    
    Replace the usage of RBP with another callee-saved register (R15) so
    stack traces are no longer affected.
    Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
    Tested-by: default avatarAndrey Konovalov <andreyknvl@google.com>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Cc: Cong Wang <xiyou.wangcong@gmail.com>
    Cc: David S . Miller <davem@davemloft.net>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Kostya Serebryany <kcc@google.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Cc: Neil Horman <nhorman@tuxdriver.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vlad Yasevich <vyasevich@gmail.com>
    Cc: linux-sctp@vger.kernel.org
    Cc: netdev <netdev@vger.kernel.org>
    Cc: syzkaller <syzkaller@googlegroups.com>
    Link: http://lkml.kernel.org/r/4b03a961efda5ec9bfe46b7b9c9ad72d1efad343.1493909486.git.jpoimboe@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    42fc6c6c
csum-copy_64.S 3.66 KB