fix segfault by "bt" command with offline cpus
This commit is contained in:
parent
20acea475c
commit
d30bfa99c6
@ -0,0 +1,62 @@
|
||||
From 1a1fd21c625cb2ca335e626eb50426f13c4160f7 Mon Sep 17 00:00:00 2001
|
||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Date: Wed, 26 Jan 2022 06:07:00 +0000
|
||||
Subject: [PATCH] arm64: Fix segfault by "bt" command with offline cpus
|
||||
|
||||
Currently on arm64, NT_PRSTATUS notes in dumpfile are not mapped to
|
||||
online cpus and machine_specific->panic_task_regs correctly. As a
|
||||
result, the "bt" command can cause a segmentation fault.
|
||||
|
||||
crash> bt -c 0
|
||||
PID: 0 TASK: ffff8000117fa240 CPU: 0 COMMAND: "swapper/0"
|
||||
Segmentation fault (core dumped)
|
||||
|
||||
To fix this,
|
||||
1) make map_cpus_to_prstatus_kdump_cmprs() map the notes to
|
||||
dd->nt_prstatus_percpu also on arm64, and
|
||||
2) move arm64_get_crash_notes() to machdep_init(POST_INIT) in order
|
||||
to apply the mapping to machine_specific->panic_task_regs.
|
||||
|
||||
Resolves: https://github.com/crash-utility/crash/issues/105
|
||||
Reported-by: xuchunmei000 <xuchunmei@linux.alibaba.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
Tested-by: David Wysochanski <dwysocha@redhat.com>
|
||||
|
||||
Conflict:adapt context.
|
||||
Reference:https://github.com/crash-utility/crash/commit/1a1fd21c625cb2ca335e626eb50426f13c4160f7
|
||||
|
||||
---
|
||||
arm64.c | 2 +-
|
||||
diskdump.c | 3 +--
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arm64.c b/arm64.c
|
||||
index 23c3d75..4f2c2b5 100644
|
||||
--- a/arm64.c
|
||||
+++ b/arm64.c
|
||||
@@ -472,7 +472,7 @@ arm64_init(int when)
|
||||
arm64_sdei_stack_init();
|
||||
break;
|
||||
|
||||
- case POST_VM:
|
||||
+ case POST_INIT:
|
||||
/*
|
||||
* crash_notes contains machine specific information about the
|
||||
* crash. In particular, it contains CPU registers at the time
|
||||
diff --git a/diskdump.c b/diskdump.c
|
||||
index 112f769..690b424 100644
|
||||
--- a/diskdump.c
|
||||
+++ b/diskdump.c
|
||||
@@ -111,8 +111,7 @@ map_cpus_to_prstatus_kdump_cmprs(void)
|
||||
if (pc->flags2 & QEMU_MEM_DUMP_COMPRESSED) /* notes exist for all cpus */
|
||||
goto resize_note_pointers;
|
||||
|
||||
- if (!(online = get_cpus_online()) || (online == kt->cpus) ||
|
||||
- machine_type("ARM64"))
|
||||
+ if (!(online = get_cpus_online()) || (online == kt->cpus))
|
||||
goto resize_note_pointers;
|
||||
|
||||
if (CRASHDEBUG(1))
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: crash
|
||||
Version: 7.3.0
|
||||
Release: 11
|
||||
Release: 12
|
||||
Summary: Linux kernel crash utility.
|
||||
License: GPLv3
|
||||
URL: https://crash-utility.github.io
|
||||
@ -21,6 +21,7 @@ Patch9: 0008-arm64-fix-backtraces-of-KASAN-kernel-dumpfile-truncated.patch
|
||||
Patch10: 0009-Add-lowercase-tcr_el1_t1sz.patch
|
||||
Patch11: 0010-Fix-kmem-option-on-Linux-5.7-and-later.patch
|
||||
Patch12: 0011-Fix-macro-TIF_SIGPENDING-values.patch
|
||||
Patch13: 0001-arm64-Fix-segfault-by-bt-command-with-offline-cpus.patch
|
||||
|
||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel
|
||||
BuildRequires: gcc gcc-c++ bison m4
|
||||
@ -86,6 +87,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
|
||||
%{_mandir}/man8/crash.8*
|
||||
|
||||
%changelog
|
||||
* Wed Jan 4 2023 lijianglin<lijianglin2@huawei.com> - 7.3.0-12
|
||||
- fix segfault by "bt" command with offline cpus
|
||||
|
||||
* Thu Dec 29 2022 huskartang <tanly6@chinatelecom.cn> - 7.3.0-11
|
||||
- Fix the value of TIF_SIGPENDING macro
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user