Blame SOURCES/0010-arm64-Fix-segfault-by-bt-command-with-offline-cpus.patch

604236
From 1a1fd21c625cb2ca335e626eb50426f13c4160f7 Mon Sep 17 00:00:00 2001
604236
From: Kazuhito Hagio <k-hagio-ab@nec.com>
604236
Date: Wed, 26 Jan 2022 06:07:00 +0000
604236
Subject: [PATCH 10/11] arm64: Fix segfault by "bt" command with offline cpus
604236
604236
Currently on arm64, NT_PRSTATUS notes in dumpfile are not mapped to
604236
online cpus and machine_specific->panic_task_regs correctly.  As a
604236
result, the "bt" command can cause a segmentation fault.
604236
604236
  crash> bt -c 0
604236
  PID: 0      TASK: ffff8000117fa240  CPU: 0   COMMAND: "swapper/0"
604236
  Segmentation fault (core dumped)
604236
604236
To fix this,
604236
1) make map_cpus_to_prstatus_kdump_cmprs() map the notes to
604236
   dd->nt_prstatus_percpu also on arm64, and
604236
2) move arm64_get_crash_notes() to machdep_init(POST_INIT) in order
604236
   to apply the mapping to machine_specific->panic_task_regs.
604236
604236
Resolves: https://github.com/crash-utility/crash/issues/105
604236
Reported-by: xuchunmei000 <xuchunmei@linux.alibaba.com>
604236
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
604236
Tested-by: David Wysochanski <dwysocha@redhat.com>
604236
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
604236
---
604236
 arm64.c    | 2 +-
604236
 diskdump.c | 3 +--
604236
 2 files changed, 2 insertions(+), 3 deletions(-)
604236
604236
diff --git a/arm64.c b/arm64.c
604236
index 23c3d75d85aa..4f2c2b5104a1 100644
604236
--- a/arm64.c
604236
+++ b/arm64.c
604236
@@ -472,7 +472,7 @@ arm64_init(int when)
604236
 		arm64_stackframe_init();
604236
 		break;
604236
 
604236
-	case POST_VM:
604236
+	case POST_INIT:
604236
 		/*
604236
 		 * crash_notes contains machine specific information about the
604236
 		 * crash. In particular, it contains CPU registers at the time
604236
diff --git a/diskdump.c b/diskdump.c
604236
index 112f769f8949..690b42443ed2 100644
604236
--- a/diskdump.c
604236
+++ b/diskdump.c
604236
@@ -111,8 +111,7 @@ map_cpus_to_prstatus_kdump_cmprs(void)
604236
 	if (pc->flags2 & QEMU_MEM_DUMP_COMPRESSED)  /* notes exist for all cpus */
604236
 		goto resize_note_pointers;
604236
 
604236
-	if (!(online = get_cpus_online()) || (online == kt->cpus) || 
604236
-	    machine_type("ARM64"))
604236
+	if (!(online = get_cpus_online()) || (online == kt->cpus))
604236
 		goto resize_note_pointers;
604236
 
604236
 	if (CRASHDEBUG(1))
604236
-- 
604236
2.20.1
604236