|
|
275d90 |
From 92de7c34b1f910abff4d77522f74454ea0263a90 Mon Sep 17 00:00:00 2001
|
|
|
275d90 |
From: Lianbo Jiang <lijiang@redhat.com>
|
|
|
275d90 |
Date: Mon, 13 Feb 2023 11:12:12 +0800
|
|
|
275d90 |
Subject: [PATCH] Fix for "bt" command printing "bogus exception frame" warning
|
|
|
275d90 |
|
|
|
275d90 |
Currently, the "bt" command may print a bogus exception frame
|
|
|
275d90 |
and the remaining frame will be truncated on x86_64 when using the
|
|
|
275d90 |
"virsh send-key <kvm guest> KEY_LEFTALT KEY_SYSRQ KEY_C" command
|
|
|
275d90 |
to trigger a panic from the KVM host. For example:
|
|
|
275d90 |
|
|
|
275d90 |
crash> bt
|
|
|
275d90 |
PID: 0 TASK: ffff9e7a47e32f00 CPU: 3 COMMAND: "swapper/3"
|
|
|
275d90 |
#0 [ffffba7900118bb8] machine_kexec at ffffffff87e5c2c7
|
|
|
275d90 |
#1 [ffffba7900118c08] __crash_kexec at ffffffff87f9500d
|
|
|
275d90 |
#2 [ffffba7900118cd0] panic at ffffffff87edfff9
|
|
|
275d90 |
#3 [ffffba7900118d50] sysrq_handle_crash at ffffffff883ce2c1
|
|
|
275d90 |
...
|
|
|
275d90 |
#16 [ffffba7900118fd8] handle_edge_irq at ffffffff87f559f2
|
|
|
275d90 |
#17 [ffffba7900118ff0] asm_call_on_stack at ffffffff88800fa2
|
|
|
275d90 |
--- <IRQ stack> ---
|
|
|
275d90 |
#18 [ffffba790008bda0] asm_call_on_stack at ffffffff88800fa2
|
|
|
275d90 |
RIP: ffffffffffffffff RSP: 0000000000000124 RFLAGS: 00000003
|
|
|
275d90 |
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
|
|
|
275d90 |
RDX: ffffffff88800c1e RSI: 0000000000000000 RDI: 0000000000000000
|
|
|
275d90 |
RBP: 0000000000000001 R8: 0000000000000000 R9: 0000000000000000
|
|
|
275d90 |
R10: 0000000000000000 R11: ffffffff88760555 R12: ffffba790008be08
|
|
|
275d90 |
R13: ffffffff87f18002 R14: ffff9e7a47e32f00 R15: ffff9e7bb6198e00
|
|
|
275d90 |
ORIG_RAX: 0000000000000000 CS: 0003 SS: 0000
|
|
|
275d90 |
bt: WARNING: possibly bogus exception frame
|
|
|
275d90 |
crash>
|
|
|
275d90 |
|
|
|
275d90 |
The following related kernel commits cause the current issue, crash
|
|
|
275d90 |
needs to adjust the value of irq_eframe_link.
|
|
|
275d90 |
|
|
|
275d90 |
Related kernel commits:
|
|
|
275d90 |
[1] v5.8: 931b94145981 ("x86/entry: Provide helpers for executing on the irqstack")
|
|
|
275d90 |
[2] v5.8: fa5e5c409213 ("x86/entry: Use idtentry for interrupts")
|
|
|
275d90 |
[3] v5.12: 52d743f3b712 ("x86/softirq: Remove indirection in do_softirq_own_stack()")
|
|
|
275d90 |
|
|
|
275d90 |
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
|
|
275d90 |
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
275d90 |
---
|
|
|
275d90 |
x86_64.c | 13 +++++++++++++
|
|
|
275d90 |
1 file changed, 13 insertions(+)
|
|
|
275d90 |
|
|
|
275d90 |
diff --git a/x86_64.c b/x86_64.c
|
|
|
275d90 |
index 7a5d6f050c89..5b671bd97775 100644
|
|
|
275d90 |
--- a/x86_64.c
|
|
|
275d90 |
+++ b/x86_64.c
|
|
|
275d90 |
@@ -3938,6 +3938,11 @@ in_exception_stack:
|
|
|
275d90 |
if (irq_eframe) {
|
|
|
275d90 |
bt->flags |= BT_EXCEPTION_FRAME;
|
|
|
275d90 |
i = (irq_eframe - bt->stackbase)/sizeof(ulong);
|
|
|
275d90 |
+ if (symbol_exists("asm_common_interrupt")) {
|
|
|
275d90 |
+ i -= 1;
|
|
|
275d90 |
+ up = (ulong *)(&bt->stackbuf[i*sizeof(ulong)]);
|
|
|
275d90 |
+ bt->instptr = *up;
|
|
|
275d90 |
+ }
|
|
|
275d90 |
x86_64_print_stack_entry(bt, ofp, level, i, bt->instptr);
|
|
|
275d90 |
bt->flags &= ~(ulonglong)BT_EXCEPTION_FRAME;
|
|
|
275d90 |
cs = x86_64_exception_frame(EFRAME_PRINT|EFRAME_CS, 0,
|
|
|
275d90 |
@@ -6521,6 +6526,14 @@ x86_64_irq_eframe_link_init(void)
|
|
|
275d90 |
else
|
|
|
275d90 |
return;
|
|
|
275d90 |
|
|
|
275d90 |
+ if (symbol_exists("asm_common_interrupt")) {
|
|
|
275d90 |
+ if (symbol_exists("asm_call_on_stack"))
|
|
|
275d90 |
+ machdep->machspec->irq_eframe_link = -64;
|
|
|
275d90 |
+ else
|
|
|
275d90 |
+ machdep->machspec->irq_eframe_link = -32;
|
|
|
275d90 |
+ return;
|
|
|
275d90 |
+ }
|
|
|
275d90 |
+
|
|
|
275d90 |
if (THIS_KERNEL_VERSION < LINUX(2,6,9))
|
|
|
275d90 |
return;
|
|
|
275d90 |
|
|
|
275d90 |
--
|
|
|
275d90 |
2.37.1
|
|
|
275d90 |
|