x86/unwind: Silence more entry-code related warnings
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 26 Apr 2017 01:48:51 +0000 (20:48 -0500)
committerIngo Molnar <mingo@kernel.org>
Wed, 26 Apr 2017 06:19:05 +0000 (08:19 +0200)
commitb0d50c7b5d807ce6f7ba58e42b260e92bd7d88fb
treee560f9f4127d128d867363a9c3172d27b2694261
parentdc912c303517b01960dcee6875a78b2999f7c098
x86/unwind: Silence more entry-code related warnings

Borislav Petkov reported the following unwinder warning:

  WARNING: kernel stack regs at ffffc9000024fea8 in udevadm:92 has bad 'bp' value 00007fffc4614d30
  unwind stack type:0 next_sp:          (null) mask:0x6 graph_idx:0
  ffffc9000024fea8000055a6100e9b38 (0x55a6100e9b38)
  ffffc9000024feb0000055a6100e9b35 (0x55a6100e9b35)
  ffffc9000024feb8000055a6100e9f68 (0x55a6100e9f68)
  ffffc9000024fec0000055a6100e9f50 (0x55a6100e9f50)
  ffffc9000024fec800007fffc4614d30 (0x7fffc4614d30)
  ffffc9000024fed0000055a6100eaf50 (0x55a6100eaf50)
  ffffc9000024fed80000000000000000 ...
  ffffc9000024fee00000000000000100 (0x100)
  ffffc9000024fee8ffff8801187df488 (0xffff8801187df488)
  ffffc9000024fef000007ffffffff000 (0x7ffffffff000)
  ffffc9000024fef80000000000000000 ...
  ffffc9000024ff10ffffc9000024fe98 (0xffffc9000024fe98)
  ffffc9000024ff1800007fffc4614d00 (0x7fffc4614d00)
  ffffc9000024ff20ffffffffffffff10 (0xffffffffffffff10)
  ffffc9000024ff28ffffffff811c6c1f (SyS_newlstat+0xf/0x10)
  ffffc9000024ff300000000000000010 (0x10)
  ffffc9000024ff380000000000000296 (0x296)
  ffffc9000024ff40ffffc9000024ff50 (0xffffc9000024ff50)
  ffffc9000024ff480000000000000018 (0x18)
  ffffc9000024ff50ffffffff816b2e6a (entry_SYSCALL_64_fastpath+0x18/0xa8)
  ...

It unwinded from an interrupt which came in right after entry code
called into a C syscall handler, before it had a chance to set up the
frame pointer, so regs->bp still had its user space value.

Add a check to silence warnings in such a case, where an interrupt
has occurred and regs->sp is almost at the end of the stack.

Reported-by: Borislav Petkov <bp@suse.de>
Tested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.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: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: c32c47c68a0a ("x86/unwind: Warn on bad frame pointer")
Link: http://lkml.kernel.org/r/c695f0d0d4c2cfe6542b90e2d0520e11eb901eb5.1493171120.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/unwind_frame.c