x86/mm/64: Improve stack overflow warnings
authorPeter Zijlstra <peterz@infradead.org>
Wed, 15 Sep 2021 15:12:59 +0000 (17:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:10 +0000 (19:16 +0100)
commita5a43cde6601871fdf607486882902a886624d18
tree2283fc13295b59fbd82ebf2fcf5299314d0e28f2
parent347f35130e4ee53123d2542b940ae1c857524cb1
x86/mm/64: Improve stack overflow warnings

[ Upstream commit 44b979fa302cab91bdd2cc982823e5c13202cd4e ]

Current code has an explicit check for hitting the task stack guard;
but overflowing any of the other stacks will get you a non-descript
general #DF warning.

Improve matters by using get_stack_info_noinstr() to detetrmine if and
which stack guard page got hit, enabling a better stack warning.

In specific, Michael Wang reported what turned out to be an NMI
exception stack overflow, which is now clearly reported as such:

  [] BUG: NMI stack guard page was hit at 0000000085fd977b (stack is 000000003a55b09e..00000000d8cce1a5)

Reported-by: Michael Wang <yun.wang@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Wang <yun.wang@linux.alibaba.com>
Link: https://lkml.kernel.org/r/YUTE/NuqnaWbST8n@hirez.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/include/asm/irq_stack.h
arch/x86/include/asm/stacktrace.h
arch/x86/include/asm/traps.h
arch/x86/kernel/dumpstack_64.c
arch/x86/kernel/traps.c
arch/x86/mm/fault.c