Compare commits
	
		
			No commits in common. "c8" and "a9-beta" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										2
									
								
								.crash.metadata
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.crash.metadata
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
65b1f9838546db98aabf106ba895b25f243d17b3 SOURCES/crash-9.0.0.tar.gz
 | 
			
		||||
9fd025eefefc88392ad620b4dcb063bcde157bd2 SOURCES/gdb-16.2.tar.gz
 | 
			
		||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,2 @@
 | 
			
		||||
SOURCES/crash-8.0.4.tar.gz
 | 
			
		||||
SOURCES/gdb-10.2.tar.gz
 | 
			
		||||
SOURCES/crash-9.0.0.tar.gz
 | 
			
		||||
SOURCES/gdb-16.2.tar.gz
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										219
									
								
								SOURCES/0001-Add-blk_mq-shared-tags-support-for-dev-d-D.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								SOURCES/0001-Add-blk_mq-shared-tags-support-for-dev-d-D.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,219 @@
 | 
			
		||||
From 62486400d35b258e4e3c40c4bf0daedc231f835a Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Fri, 27 Jun 2025 23:30:59 +1200
 | 
			
		||||
Subject: [PATCH] Add blk_mq shared tags support for dev -d/-D
 | 
			
		||||
 | 
			
		||||
When blk_mq shared tags enabled for devices like scsi, the IO status is
 | 
			
		||||
incorrect, e.g:
 | 
			
		||||
 | 
			
		||||
    crash> dev -d
 | 
			
		||||
    MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC
 | 
			
		||||
        8 ffff90528df86000   sda        ffff9052a3d61800     144   144     0
 | 
			
		||||
        8 ffff905280718c00   sdb        ffff9052a3d63c00      48    48     0
 | 
			
		||||
 | 
			
		||||
    crash> epython rqlist
 | 
			
		||||
    ffff90528e94a5c0 sda      is unknown, deadline:  89.992 (90)  rq_alloc:   0.196
 | 
			
		||||
    ffff90528e92f700 sda      is unknown, deadline:  89.998 (90)  rq_alloc:   0.202
 | 
			
		||||
    ffff90528e95ccc0 sda      is unknown, deadline:  89.999 (90)  rq_alloc:   0.203
 | 
			
		||||
    ffff90528e968bc0 sdb      is unknown, deadline:  89.997 (90)  rq_alloc:   0.201
 | 
			
		||||
 | 
			
		||||
The root cause is: for shared tags case, only the shared tags are put
 | 
			
		||||
into count. Without this patch, tags of all the hw_ctx are counted,
 | 
			
		||||
which is incorrect.
 | 
			
		||||
 | 
			
		||||
After apply the patch:
 | 
			
		||||
 | 
			
		||||
    crash> dev -d
 | 
			
		||||
    MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL  READ WRITE
 | 
			
		||||
        8 ffff90528df86000   sda        ffff9052a3d61800       3     3     0
 | 
			
		||||
        8 ffff905280718c00   sdb        ffff9052a3d63c00       1     1     0
 | 
			
		||||
 | 
			
		||||
This patch makes the following modification:
 | 
			
		||||
1) blk_mq shared tag support.
 | 
			
		||||
2) Function renaming: queue_for_each_hw_ctx -> blk_mq_queue_tag_busy_iter,
 | 
			
		||||
   because the latter is more close to the corresponding kernel function.
 | 
			
		||||
3) Extract a new queue_for_each_hw_ctx() function to be called for both
 | 
			
		||||
   shared-tags case and the hw_ctx case.
 | 
			
		||||
 | 
			
		||||
Note:
 | 
			
		||||
The patch is safe for earlier kernels which have no blk_mq shared tags
 | 
			
		||||
implemented, because the blk_mq_is_shared_tags() check will exit safely.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 defs.h    |  3 ++
 | 
			
		||||
 dev.c     | 96 ++++++++++++++++++++++++++++++++++++++-----------------
 | 
			
		||||
 symbols.c |  6 ++++
 | 
			
		||||
 3 files changed, 76 insertions(+), 29 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index bbd6d4b..4fecb83 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -2271,6 +2271,9 @@ struct offset_table {                    /* stash of commonly-used offsets */
 | 
			
		||||
 	long task_struct_thread_context_x28;
 | 
			
		||||
 	long neigh_table_hash_heads;
 | 
			
		||||
 	long neighbour_hash;
 | 
			
		||||
+	long request_queue_tag_set;
 | 
			
		||||
+	long blk_mq_tag_set_flags;
 | 
			
		||||
+	long blk_mq_tag_set_shared_tags;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 struct size_table {         /* stash of commonly-used sizes */
 | 
			
		||||
diff --git a/dev.c b/dev.c
 | 
			
		||||
index 9d38aef..8391d71 100644
 | 
			
		||||
--- a/dev.c
 | 
			
		||||
+++ b/dev.c
 | 
			
		||||
@@ -4326,6 +4326,12 @@ struct bt_iter_data {
 | 
			
		||||
 #define MQ_RQ_IN_FLIGHT 1
 | 
			
		||||
 #define REQ_OP_BITS     8
 | 
			
		||||
 #define REQ_OP_MASK     ((1 << REQ_OP_BITS) - 1)
 | 
			
		||||
+#define BLK_MQ_F_TAG_HCTX_SHARED (1 << 3)
 | 
			
		||||
+
 | 
			
		||||
+static bool blk_mq_is_shared_tags(unsigned int flags)
 | 
			
		||||
+{
 | 
			
		||||
+	return flags & BLK_MQ_F_TAG_HCTX_SHARED;
 | 
			
		||||
+}
 | 
			
		||||
 
 | 
			
		||||
 static uint op_is_write(uint op)
 | 
			
		||||
 {
 | 
			
		||||
@@ -4403,43 +4409,72 @@ static void bt_for_each(ulong q, ulong tags, ulong sbq, uint reserved, uint nr_r
 | 
			
		||||
 	sbitmap_for_each_set(&sc, bt_iter, &iter_data);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-static void queue_for_each_hw_ctx(ulong q, ulong *hctx, uint cnt, struct diskio *dio)
 | 
			
		||||
+static bool queue_for_each_hw_ctx(ulong q, ulong blk_mq_tags_ptr,
 | 
			
		||||
+				bool bitmap_tags_is_ptr, struct diskio *dio)
 | 
			
		||||
 {
 | 
			
		||||
-	uint i;
 | 
			
		||||
+	uint nr_reserved_tags = 0;
 | 
			
		||||
+	ulong tags = 0, addr = 0;
 | 
			
		||||
+	bool ret = FALSE;
 | 
			
		||||
+
 | 
			
		||||
+	if (!readmem(blk_mq_tags_ptr, KVADDR, &tags, sizeof(ulong),
 | 
			
		||||
+			"blk_mq_hw_ctx.tags", RETURN_ON_ERROR))
 | 
			
		||||
+		goto out;
 | 
			
		||||
+
 | 
			
		||||
+	addr = tags + OFFSET(blk_mq_tags_nr_reserved_tags);
 | 
			
		||||
+	if (!readmem(addr, KVADDR, &nr_reserved_tags, sizeof(uint),
 | 
			
		||||
+			"blk_mq_tags_nr_reserved_tags", RETURN_ON_ERROR))
 | 
			
		||||
+		goto out;
 | 
			
		||||
+
 | 
			
		||||
+	if (nr_reserved_tags) {
 | 
			
		||||
+		addr = tags + OFFSET(blk_mq_tags_breserved_tags);
 | 
			
		||||
+		if (bitmap_tags_is_ptr &&
 | 
			
		||||
+			!readmem(addr, KVADDR, &addr, sizeof(ulong),
 | 
			
		||||
+				"blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
 | 
			
		||||
+			goto out;
 | 
			
		||||
+		bt_for_each(q, tags, addr, 1, nr_reserved_tags, dio);
 | 
			
		||||
+	}
 | 
			
		||||
+	addr = tags + OFFSET(blk_mq_tags_bitmap_tags);
 | 
			
		||||
+	if (bitmap_tags_is_ptr &&
 | 
			
		||||
+		!readmem(addr, KVADDR, &addr, sizeof(ulong),
 | 
			
		||||
+			"blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
 | 
			
		||||
+		goto out;
 | 
			
		||||
+	bt_for_each(q, tags, addr, 0, nr_reserved_tags, dio);
 | 
			
		||||
+
 | 
			
		||||
+	ret = TRUE;
 | 
			
		||||
+out:
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+/*
 | 
			
		||||
+ * Replica of kernel block/blk-mq-tag.c:blk_mq_queue_tag_busy_iter()
 | 
			
		||||
+*/
 | 
			
		||||
+static void blk_mq_queue_tag_busy_iter(ulong q, ulong *hctx, uint cnt,
 | 
			
		||||
+					struct diskio *dio)
 | 
			
		||||
+{
 | 
			
		||||
+	uint i, flags;
 | 
			
		||||
 	int bitmap_tags_is_ptr = 0;
 | 
			
		||||
+	ulong addr = 0;
 | 
			
		||||
 
 | 
			
		||||
 	if (MEMBER_TYPE("blk_mq_tags", "bitmap_tags") == TYPE_CODE_PTR)
 | 
			
		||||
 		bitmap_tags_is_ptr = 1;
 | 
			
		||||
 
 | 
			
		||||
-	for (i = 0; i < cnt; i++) {
 | 
			
		||||
-		ulong addr = 0, tags = 0;
 | 
			
		||||
-		uint nr_reserved_tags = 0;
 | 
			
		||||
+	readmem(q + OFFSET(request_queue_tag_set), KVADDR, &addr,
 | 
			
		||||
+		sizeof(ulong), "request_queue.tag_set", RETURN_ON_ERROR);
 | 
			
		||||
 
 | 
			
		||||
-		/* Tags owned by the block driver */
 | 
			
		||||
-		addr = hctx[i] + OFFSET(blk_mq_hw_ctx_tags);
 | 
			
		||||
-		if (!readmem(addr, KVADDR, &tags, sizeof(ulong),
 | 
			
		||||
-				"blk_mq_hw_ctx.tags", RETURN_ON_ERROR))
 | 
			
		||||
-			break;
 | 
			
		||||
+	readmem(addr + OFFSET(blk_mq_tag_set_flags), KVADDR,
 | 
			
		||||
+		&flags, sizeof(uint), "blk_mq_tag_set.flags", RETURN_ON_ERROR);
 | 
			
		||||
 
 | 
			
		||||
-		addr = tags + OFFSET(blk_mq_tags_nr_reserved_tags);
 | 
			
		||||
-		if (!readmem(addr, KVADDR, &nr_reserved_tags, sizeof(uint),
 | 
			
		||||
-				"blk_mq_tags_nr_reserved_tags", RETURN_ON_ERROR))
 | 
			
		||||
-			break;
 | 
			
		||||
+	if (blk_mq_is_shared_tags(flags)) {
 | 
			
		||||
+		addr = addr + OFFSET(blk_mq_tag_set_shared_tags);
 | 
			
		||||
+		queue_for_each_hw_ctx(q, addr, bitmap_tags_is_ptr, dio);
 | 
			
		||||
+		return;
 | 
			
		||||
+	}
 | 
			
		||||
 
 | 
			
		||||
-		if (nr_reserved_tags) {
 | 
			
		||||
-			addr = tags + OFFSET(blk_mq_tags_breserved_tags);
 | 
			
		||||
-			if (bitmap_tags_is_ptr &&
 | 
			
		||||
-			    !readmem(addr, KVADDR, &addr, sizeof(ulong),
 | 
			
		||||
-					"blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
 | 
			
		||||
-				break;
 | 
			
		||||
-			bt_for_each(q, tags, addr, 1, nr_reserved_tags, dio);
 | 
			
		||||
-		}
 | 
			
		||||
-		addr = tags + OFFSET(blk_mq_tags_bitmap_tags);
 | 
			
		||||
-		if (bitmap_tags_is_ptr &&
 | 
			
		||||
-		    !readmem(addr, KVADDR, &addr, sizeof(ulong),
 | 
			
		||||
-				"blk_mq_tags.bitmap_tags", RETURN_ON_ERROR))
 | 
			
		||||
-			break;
 | 
			
		||||
-		bt_for_each(q, tags, addr, 0, nr_reserved_tags, dio);
 | 
			
		||||
+	for (i = 0; i < cnt; i++) {
 | 
			
		||||
+		/* Tags owned by the block driver */
 | 
			
		||||
+		addr = hctx[i] + OFFSET(blk_mq_hw_ctx_tags);
 | 
			
		||||
+		if (queue_for_each_hw_ctx(q, addr, bitmap_tags_is_ptr, dio) == FALSE)
 | 
			
		||||
+			return;
 | 
			
		||||
 	}
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
@@ -4489,7 +4524,7 @@ static void get_mq_diskio_from_hw_queues(ulong q, struct diskio *dio)
 | 
			
		||||
 		return;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	queue_for_each_hw_ctx(q, hctx_array, cnt, dio);
 | 
			
		||||
+	blk_mq_queue_tag_busy_iter(q, hctx_array, cnt, dio);
 | 
			
		||||
 
 | 
			
		||||
 	FREEBUF(hctx_array);
 | 
			
		||||
 }
 | 
			
		||||
@@ -4914,6 +4949,9 @@ void diskio_init(void)
 | 
			
		||||
 	MEMBER_SIZE_INIT(class_private_devices, "class_private",
 | 
			
		||||
 		"class_devices");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(disk_stats_in_flight, "disk_stats", "in_flight");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(request_queue_tag_set, "request_queue", "tag_set");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(blk_mq_tag_set_flags, "blk_mq_tag_set", "flags");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(blk_mq_tag_set_shared_tags, "blk_mq_tag_set", "shared_tags");
 | 
			
		||||
 
 | 
			
		||||
 	dt->flags |= DISKIO_INIT;
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/symbols.c b/symbols.c
 | 
			
		||||
index e30fafe..794519a 100644
 | 
			
		||||
--- a/symbols.c
 | 
			
		||||
+++ b/symbols.c
 | 
			
		||||
@@ -11487,6 +11487,12 @@ dump_offset_table(char *spec, ulong makestruct)
 | 
			
		||||
 		OFFSET(blk_mq_tags_nr_reserved_tags));
 | 
			
		||||
 	fprintf(fp, "               blk_mq_tags_rqs: %ld\n",
 | 
			
		||||
 		OFFSET(blk_mq_tags_rqs));
 | 
			
		||||
+	fprintf(fp, "         request_queue_tag_set: %ld\n",
 | 
			
		||||
+		OFFSET(request_queue_tag_set));
 | 
			
		||||
+	fprintf(fp, "          blk_mq_tag_set_flags: %ld\n",
 | 
			
		||||
+		OFFSET(blk_mq_tag_set_flags));
 | 
			
		||||
+	fprintf(fp, "    blk_mq_tag_set_shared_tags: %ld\n",
 | 
			
		||||
+		OFFSET(blk_mq_tag_set_shared_tags));
 | 
			
		||||
 
 | 
			
		||||
 	fprintf(fp, "         subsys_private_subsys: %ld\n", OFFSET(subsys_private_subsys));
 | 
			
		||||
 	fprintf(fp, "  subsys_private_klist_devices: %ld\n",
 | 
			
		||||
-- 
 | 
			
		||||
2.47.0
 | 
			
		||||
 | 
			
		||||
@ -1,142 +0,0 @@
 | 
			
		||||
From 38acd02c7fc09843ffb10fc2d695cccdd10cc7f6 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Chengen Du <chengen.du@canonical.com>
 | 
			
		||||
Date: Fri, 17 Nov 2023 11:45:33 +0800
 | 
			
		||||
Subject: [PATCH 01/14] Fix "rd" command for zram data display in Linux 6.2 and
 | 
			
		||||
 later
 | 
			
		||||
 | 
			
		||||
Kernel commit 7ac07a26dea7 ("zram: preparation for multi-zcomp support")
 | 
			
		||||
replaced "compressor" member with "comp_algs" in the zram struct.
 | 
			
		||||
Without the patch, the "rd" command can triggers the following error:
 | 
			
		||||
 | 
			
		||||
  rd: WARNING: Some pages are swapped out to zram. Please run mod -s zram.
 | 
			
		||||
  rd: invalid user virtual address: ffff7d23f010  type: "64-bit UVADDR"
 | 
			
		||||
 | 
			
		||||
Related kernel commit:
 | 
			
		||||
  84b33bf78889 ("zram: introduce recompress sysfs knob")
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Chengen Du <chengen.du@canonical.com>
 | 
			
		||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 defs.h     |  1 +
 | 
			
		||||
 diskdump.c | 47 ++++++++++++++++++++++++++++++-----------------
 | 
			
		||||
 2 files changed, 31 insertions(+), 17 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index 788f63ada739..2cae5b61e589 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -2227,6 +2227,7 @@ struct offset_table {                    /* stash of commonly-used offsets */
 | 
			
		||||
 	long module_memory_size;
 | 
			
		||||
 	long irq_data_irq;
 | 
			
		||||
 	long zspage_huge;
 | 
			
		||||
+	long zram_comp_algs;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 struct size_table {         /* stash of commonly-used sizes */
 | 
			
		||||
diff --git a/diskdump.c b/diskdump.c
 | 
			
		||||
index 0fe46f4644d0..25054d96313e 100644
 | 
			
		||||
--- a/diskdump.c
 | 
			
		||||
+++ b/diskdump.c
 | 
			
		||||
@@ -2757,6 +2757,8 @@ diskdump_device_dump_info(FILE *ofp)
 | 
			
		||||
 
 | 
			
		||||
 static ulong ZRAM_FLAG_SHIFT;
 | 
			
		||||
 static ulong ZRAM_FLAG_SAME_BIT;
 | 
			
		||||
+static ulong ZRAM_COMP_PRIORITY_BIT1;
 | 
			
		||||
+static ulong ZRAM_COMP_PRIORITY_MASK;
 | 
			
		||||
 
 | 
			
		||||
 static void
 | 
			
		||||
 zram_init(void)
 | 
			
		||||
@@ -2765,6 +2767,8 @@ zram_init(void)
 | 
			
		||||
 
 | 
			
		||||
 	MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
 | 
			
		||||
+	if (INVALID_MEMBER(zram_compressor))
 | 
			
		||||
+		MEMBER_OFFSET_INIT(zram_comp_algs, "zram", "comp_algs");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
 | 
			
		||||
 	if (INVALID_MEMBER(zram_table_flag))
 | 
			
		||||
 		MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "value");
 | 
			
		||||
@@ -2782,6 +2786,8 @@ zram_init(void)
 | 
			
		||||
 
 | 
			
		||||
 	ZRAM_FLAG_SHIFT = 1 << zram_flag_shift;
 | 
			
		||||
 	ZRAM_FLAG_SAME_BIT = 1 << (zram_flag_shift+1);
 | 
			
		||||
+	ZRAM_COMP_PRIORITY_BIT1 = ZRAM_FLAG_SHIFT + 7;
 | 
			
		||||
+	ZRAM_COMP_PRIORITY_MASK = 0x3;
 | 
			
		||||
 
 | 
			
		||||
 	if (CRASHDEBUG(1))
 | 
			
		||||
 		fprintf(fp, "zram_flag_shift: %ld\n", zram_flag_shift);
 | 
			
		||||
@@ -2981,9 +2987,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 	ulong zram, zram_table_entry, sector, index, entry, flags, size,
 | 
			
		||||
 		outsize, off;
 | 
			
		||||
 
 | 
			
		||||
-	if (INVALID_MEMBER(zram_compressor)) {
 | 
			
		||||
+	if (INVALID_MEMBER(zram_mempoll)) {
 | 
			
		||||
 		zram_init();
 | 
			
		||||
-		if (INVALID_MEMBER(zram_compressor)) {
 | 
			
		||||
+		if (INVALID_MEMBER(zram_mempoll)) {
 | 
			
		||||
 			error(WARNING,
 | 
			
		||||
 			      "Some pages are swapped out to zram. "
 | 
			
		||||
 			      "Please run mod -s zram.\n");
 | 
			
		||||
@@ -2997,8 +3003,28 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 	if (!get_disk_name_private_data(pte_val, vaddr, NULL, &zram))
 | 
			
		||||
 		return 0;
 | 
			
		||||
 
 | 
			
		||||
-	readmem(zram + OFFSET(zram_compressor), KVADDR, name,
 | 
			
		||||
-		sizeof(name), "zram compressor", FAULT_ON_ERROR);
 | 
			
		||||
+	if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0))
 | 
			
		||||
+		swp_offset = (ulonglong)__swp_offset(pte_val);
 | 
			
		||||
+	else
 | 
			
		||||
+		swp_offset = (ulonglong)SWP_OFFSET(pte_val);
 | 
			
		||||
+
 | 
			
		||||
+	sector = swp_offset << (PAGESHIFT() - 9);
 | 
			
		||||
+	index = sector >> SECTORS_PER_PAGE_SHIFT;
 | 
			
		||||
+	readmem(zram, KVADDR, &zram_table_entry,
 | 
			
		||||
+		sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
 | 
			
		||||
+	zram_table_entry += (index * SIZE(zram_table_entry));
 | 
			
		||||
+	readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
 | 
			
		||||
+		sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
 | 
			
		||||
+	if (VALID_MEMBER(zram_compressor))
 | 
			
		||||
+		readmem(zram + OFFSET(zram_compressor), KVADDR, name, sizeof(name),
 | 
			
		||||
+			"zram compressor", FAULT_ON_ERROR);
 | 
			
		||||
+	else {
 | 
			
		||||
+		ulong comp_alg_addr;
 | 
			
		||||
+		uint32_t prio = (flags >> ZRAM_COMP_PRIORITY_BIT1) & ZRAM_COMP_PRIORITY_MASK;
 | 
			
		||||
+		readmem(zram + OFFSET(zram_comp_algs) + sizeof(const char *) * prio, KVADDR,
 | 
			
		||||
+			&comp_alg_addr, sizeof(comp_alg_addr), "zram comp_algs", FAULT_ON_ERROR);
 | 
			
		||||
+		read_string(comp_alg_addr, name, sizeof(name));
 | 
			
		||||
+	}
 | 
			
		||||
 	if (STREQ(name, "lzo")) {
 | 
			
		||||
 #ifdef LZO
 | 
			
		||||
 		if (!(dd->flags & LZO_SUPPORTED)) {
 | 
			
		||||
@@ -3019,12 +3045,6 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 		return 0;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	if (THIS_KERNEL_VERSION >= LINUX(2, 6, 0)) {
 | 
			
		||||
-		swp_offset = (ulonglong)__swp_offset(pte_val);
 | 
			
		||||
-	} else {
 | 
			
		||||
-		swp_offset = (ulonglong)SWP_OFFSET(pte_val);
 | 
			
		||||
-	}
 | 
			
		||||
-
 | 
			
		||||
 	zram_buf = (unsigned char *)GETBUF(PAGESIZE());
 | 
			
		||||
 	/* lookup page from swap cache */
 | 
			
		||||
 	off = PAGEOFFSET(vaddr);
 | 
			
		||||
@@ -3034,15 +3054,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 		goto out;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	sector = swp_offset << (PAGESHIFT() - 9);
 | 
			
		||||
-	index = sector >> SECTORS_PER_PAGE_SHIFT;
 | 
			
		||||
-	readmem(zram, KVADDR, &zram_table_entry,
 | 
			
		||||
-		sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
 | 
			
		||||
-	zram_table_entry += (index * SIZE(zram_table_entry));
 | 
			
		||||
 	readmem(zram_table_entry, KVADDR, &entry,
 | 
			
		||||
 		sizeof(void *), "entry of table", FAULT_ON_ERROR);
 | 
			
		||||
-	readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
 | 
			
		||||
-		sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
 | 
			
		||||
 	if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
 | 
			
		||||
 		int count;
 | 
			
		||||
 		ulong *same_buf = (ulong *)GETBUF(PAGESIZE());
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										126
									
								
								SOURCES/0001-vmware_guestdump-Version-7-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								SOURCES/0001-vmware_guestdump-Version-7-support.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,126 @@
 | 
			
		||||
From a18b8a7fb83ae79f5c0698063f26ec8a289cf90b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Date: Wed, 30 Apr 2025 21:54:27 +0000
 | 
			
		||||
Subject: [PATCH 1/9] vmware_guestdump: Version 7 support
 | 
			
		||||
 | 
			
		||||
ESXi 9.0 updated debug.guest format. CPU architecture type was
 | 
			
		||||
introduced and several fields of the header not used by the crash
 | 
			
		||||
were moved around. It is version 7 now.
 | 
			
		||||
 | 
			
		||||
Make corresponding changes in debug.guest parser and keep it
 | 
			
		||||
backward compatible with older versions.
 | 
			
		||||
 | 
			
		||||
Fix comment and log messages typos as well.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 vmware_guestdump.c | 48 ++++++++++++++++++++++++++++++++++++++++++----
 | 
			
		||||
 1 file changed, 44 insertions(+), 4 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/vmware_guestdump.c b/vmware_guestdump.c
 | 
			
		||||
index 78f37fbf3553..1a6ef9bd070c 100644
 | 
			
		||||
--- a/vmware_guestdump.c
 | 
			
		||||
+++ b/vmware_guestdump.c
 | 
			
		||||
@@ -30,6 +30,7 @@
 | 
			
		||||
  *             2. Number of Virtual CPUs (4 bytes) } - struct guestdumpheader
 | 
			
		||||
  *             3. Reserved gap
 | 
			
		||||
  *             4. Main Memory information - struct mainmeminfo{,_old}
 | 
			
		||||
+ *             5. Reserved gap #2. Only in v7+
 | 
			
		||||
  *    (use get_vcpus_offset() to get total size of guestdumpheader)
 | 
			
		||||
  * vcpus_offset:               ---------\
 | 
			
		||||
  *             1. struct vcpu_state1     \
 | 
			
		||||
@@ -111,6 +112,22 @@ struct vcpu_state2 {
 | 
			
		||||
 	uint8_t reserved3[65];
 | 
			
		||||
 } __attribute__((packed));
 | 
			
		||||
 
 | 
			
		||||
+typedef enum {
 | 
			
		||||
+	CPU_ARCH_AARCH64,
 | 
			
		||||
+	CPU_ARCH_X86,
 | 
			
		||||
+} cpu_arch;
 | 
			
		||||
+
 | 
			
		||||
+/*
 | 
			
		||||
+ * Returns the size of reserved gap #2 in the header right after the Main Mem.
 | 
			
		||||
+ */
 | 
			
		||||
+static inline long
 | 
			
		||||
+get_gap2_size(uint32_t version)
 | 
			
		||||
+{
 | 
			
		||||
+	if (version == 7)
 | 
			
		||||
+		return 11;
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Returns the size of the guest dump header.
 | 
			
		||||
  */
 | 
			
		||||
@@ -128,6 +145,9 @@ get_vcpus_offset(uint32_t version, int mem_holes)
 | 
			
		||||
 			return sizeof(struct guestdumpheader) + 14 + sizeof(struct mainmeminfo);
 | 
			
		||||
 		case 6: /* ESXi 8.0u2 */
 | 
			
		||||
 			return sizeof(struct guestdumpheader) + 15 + sizeof(struct mainmeminfo);
 | 
			
		||||
+		case 7: /* ESXi 9.0 */
 | 
			
		||||
+			return sizeof(struct guestdumpheader) + 8 + sizeof(struct mainmeminfo) +
 | 
			
		||||
+				get_gap2_size(version);
 | 
			
		||||
 
 | 
			
		||||
 	}
 | 
			
		||||
 	return 0;
 | 
			
		||||
@@ -155,10 +175,10 @@ get_vcpu_gapsize(uint32_t version)
 | 
			
		||||
  *
 | 
			
		||||
  * guestdump (debug.guest) is a simplified version of the *.vmss which does
 | 
			
		||||
  * not contain a full VM state, but minimal guest state, such as a memory
 | 
			
		||||
- * layout and CPUs state, needed for debugger. is_vmware_guestdump()
 | 
			
		||||
+ * layout and CPUs state, needed for the debugger. is_vmware_guestdump()
 | 
			
		||||
  * and vmware_guestdump_init() functions parse guestdump header and
 | 
			
		||||
  * populate vmss data structure (from vmware_vmss.c). In result, all
 | 
			
		||||
- * handlers (except mempry_dump) from vmware_vmss.c can be reused.
 | 
			
		||||
+ * handlers (except memory_dump) from vmware_vmss.c can be reused.
 | 
			
		||||
  *
 | 
			
		||||
  * debug.guest does not have a dedicated header magic or file format signature
 | 
			
		||||
  * To probe debug.guest we need to perform series of validations. In addition,
 | 
			
		||||
@@ -225,7 +245,8 @@ is_vmware_guestdump(char *filename)
 | 
			
		||||
 		/* vcpu_offset adjustment for mem_holes is required only for version 1. */
 | 
			
		||||
 		vcpus_offset = get_vcpus_offset(hdr.version, mmi.mem_holes);
 | 
			
		||||
 	} else {
 | 
			
		||||
-		if (fseek(fp, vcpus_offset - sizeof(struct mainmeminfo), SEEK_SET) == -1) {
 | 
			
		||||
+		if (fseek(fp, vcpus_offset - sizeof(struct mainmeminfo) - get_gap2_size(hdr.version),
 | 
			
		||||
+				SEEK_SET) == -1) {
 | 
			
		||||
 			if (CRASHDEBUG(1))
 | 
			
		||||
 				error(INFO, LOGPRX"Failed to fseek '%s': [Error %d] %s\n",
 | 
			
		||||
 						filename, errno, strerror(errno));
 | 
			
		||||
@@ -240,6 +261,25 @@ is_vmware_guestdump(char *filename)
 | 
			
		||||
 			fclose(fp);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
+
 | 
			
		||||
+		/* Check CPU architecture field. Next 4 bytes after the Main Mem */
 | 
			
		||||
+		if (hdr.version >= 7) {
 | 
			
		||||
+			cpu_arch arch;
 | 
			
		||||
+			if (fread(&arch, sizeof(cpu_arch), 1, fp) != 1) {
 | 
			
		||||
+				if (CRASHDEBUG(1))
 | 
			
		||||
+					error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
 | 
			
		||||
+							"CPU arch", filename, errno, strerror(errno));
 | 
			
		||||
+				fclose(fp);
 | 
			
		||||
+				return FALSE;
 | 
			
		||||
+			}
 | 
			
		||||
+			if (arch != CPU_ARCH_X86) {
 | 
			
		||||
+				if (CRASHDEBUG(1))
 | 
			
		||||
+					error(INFO,
 | 
			
		||||
+						LOGPRX"Invalid or unsupported CPU architecture: %d\n", arch);
 | 
			
		||||
+				fclose(fp);
 | 
			
		||||
+				return FALSE;
 | 
			
		||||
+			}
 | 
			
		||||
+		}
 | 
			
		||||
 	}
 | 
			
		||||
 	if (fseek(fp, 0L, SEEK_END) == -1) {
 | 
			
		||||
 		if (CRASHDEBUG(1))
 | 
			
		||||
@@ -300,7 +340,7 @@ vmware_guestdump_init(char *filename, FILE *ofp)
 | 
			
		||||
 
 | 
			
		||||
 	if (!machine_type("X86") && !machine_type("X86_64")) {
 | 
			
		||||
 		error(INFO,
 | 
			
		||||
-		      LOGPRX"Invalid or unsupported host architecture for .vmss file: %s\n",
 | 
			
		||||
+		      LOGPRX"Invalid or unsupported host architecture for .guest file: %s\n",
 | 
			
		||||
 		      MACHINE_TYPE);
 | 
			
		||||
 		result = FALSE;
 | 
			
		||||
 		goto exit;
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,53 @@
 | 
			
		||||
From 145cc6a75f24dfce2e644b620b3afb6de04cadfd Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 9 Jul 2025 17:41:12 +1200
 | 
			
		||||
Subject: [PATCH 1/5] x86_64: filter unwanted warning message for "bt -T" cmd
 | 
			
		||||
 | 
			
		||||
After patch "x86_64: Add gdb multi-stack unwind support" applied, a
 | 
			
		||||
warning message is observed for "bt -T" cmd:
 | 
			
		||||
 | 
			
		||||
    crash> bt -T
 | 
			
		||||
    bt: seek error: kernel virtual address: fffffffffffffffb  type: "gdb_readmem_callback"
 | 
			
		||||
    [ffffbaebc60d6fa8] srso_return_thunk at ffffffff82246fa5
 | 
			
		||||
    ...
 | 
			
		||||
 | 
			
		||||
The root cause is, "bt -T" will set BT_TEXT_SYMBOLS_ALL for bt->flags,
 | 
			
		||||
and eip is set to be 0 in kernel.c:back_trace(). Later in
 | 
			
		||||
x86_64_low_budget_back_trace_cmd(), eip - 5, or 0xfffffffffffffffb is
 | 
			
		||||
used for address disassembly by gdb "x/1i 0x%lx". This address is invalid so
 | 
			
		||||
the warning message is output.
 | 
			
		||||
 | 
			
		||||
In fact, multi-stack unwind isn't designed for "bt -T" and eip = 0 case.
 | 
			
		||||
To avoid the warning message, let's simply bypass the "bt -T" case for
 | 
			
		||||
x86_64. Other archs(arm64/ppc64) aren't affected by the issue because
 | 
			
		||||
the gdb "x/1i 0x%lx" are not applied on those archs.
 | 
			
		||||
 | 
			
		||||
After apply the patch:
 | 
			
		||||
 | 
			
		||||
    crash> bt -T
 | 
			
		||||
    [ffffbaebc60d6fa8] srso_return_thunk at ffffffff82246fa5
 | 
			
		||||
    ...
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 x86_64.c | 3 ++-
 | 
			
		||||
 1 file changed, 2 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/x86_64.c b/x86_64.c
 | 
			
		||||
index cfefe3f80c4f..d7da536d20d8 100644
 | 
			
		||||
--- a/x86_64.c
 | 
			
		||||
+++ b/x86_64.c
 | 
			
		||||
@@ -3636,7 +3636,8 @@ x86_64_low_budget_back_trace_cmd(struct bt_info *bt_in)
 | 
			
		||||
 		level++;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	if (is_task_active(bt->task) && bt->flags & BT_DUMPFILE_SEARCH) {
 | 
			
		||||
+	if (is_task_active(bt->task) && bt->flags & BT_DUMPFILE_SEARCH &&
 | 
			
		||||
+	    !(bt->flags & BT_TEXT_SYMBOLS_ALL)) {
 | 
			
		||||
 		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
 			extra_stacks_regs[extra_stacks_idx] =
 | 
			
		||||
 				(struct user_regs_bitmap_struct *)
 | 
			
		||||
-- 
 | 
			
		||||
2.50.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										84
									
								
								SOURCES/0002-Fix-incorrect-task-state-during-exit.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								SOURCES/0002-Fix-incorrect-task-state-during-exit.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,84 @@
 | 
			
		||||
From 6eb51d8284aaca9cc882ddb1b9e135c708abbaa4 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Stephen Brennan <stephen.s.brennan@oracle.com>
 | 
			
		||||
Date: Fri, 2 May 2025 13:18:17 -0700
 | 
			
		||||
Subject: [PATCH 2/9] Fix incorrect task state during exit
 | 
			
		||||
 | 
			
		||||
task_state() assumes that exit_state is a unsigned long, when in
 | 
			
		||||
reality, it has been declared as an int since 97dc32cdb1b53 ("reduce
 | 
			
		||||
size of task_struct on 64-bit machines"), in Linux 2.6.22. So on 64-bit
 | 
			
		||||
machines, task_state() reads 8 bytes rather than 4, and gets the wrong
 | 
			
		||||
exit_state value by including the next field.
 | 
			
		||||
 | 
			
		||||
This has gone unnoticed because directly after exit_state comes
 | 
			
		||||
exit_code, which is generally zero while the task is alive. When the
 | 
			
		||||
exit_code is set, exit_state is usually set not long after. Since
 | 
			
		||||
task_state_string() only checks whether exit_state bits are set, it
 | 
			
		||||
never notices the presence of the exit code inside of the state.
 | 
			
		||||
 | 
			
		||||
But this leaves open a window during the process exit, when the
 | 
			
		||||
exit_code has been set (in do_exit()), but the exit_state has not (in
 | 
			
		||||
exit_notify()). In this case, crash reports a state of "??", but in
 | 
			
		||||
reality, the task is still running -- it's just running the exit()
 | 
			
		||||
system call. This race window can be long enough to be observed in core
 | 
			
		||||
dumps, for example if the mmput() takes a long time.
 | 
			
		||||
 | 
			
		||||
This should be considered a bug. A task state of "??" or "(unknown)" is
 | 
			
		||||
frequently of concern when debugging, as it could indicate that the
 | 
			
		||||
state fields had some sort of corruption, and draw the attention of the
 | 
			
		||||
debugger. To handle it properly, record the size of exit_state, and read
 | 
			
		||||
it conditionally as a UINT or ULONG, just like the state. This ensures
 | 
			
		||||
we retain compatibility with kernel before v2.6.22. Whether that is
 | 
			
		||||
actually desirable is anybody's guess.
 | 
			
		||||
 | 
			
		||||
Reported-by: Jeffery Yoder <jeffery.yoder@oracle.com>
 | 
			
		||||
Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 defs.h |  1 +
 | 
			
		||||
 task.c | 11 +++++++++--
 | 
			
		||||
 2 files changed, 10 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index 4cf169c85144..2fdb4db56a05 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -2448,6 +2448,7 @@ struct size_table {         /* stash of commonly-used sizes */
 | 
			
		||||
 	long fred_frame;
 | 
			
		||||
 	long vmap_node;
 | 
			
		||||
 	long cpumask_t;
 | 
			
		||||
+	long task_struct_exit_state;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 struct array_table {
 | 
			
		||||
diff --git a/task.c b/task.c
 | 
			
		||||
index 3bafe796381f..e07b479a3bec 100644
 | 
			
		||||
--- a/task.c
 | 
			
		||||
+++ b/task.c
 | 
			
		||||
@@ -306,6 +306,7 @@ task_init(void)
 | 
			
		||||
 		MEMBER_SIZE_INIT(task_struct_state, "task_struct", "__state");
 | 
			
		||||
 	}
 | 
			
		||||
         MEMBER_OFFSET_INIT(task_struct_exit_state, "task_struct", "exit_state");
 | 
			
		||||
+        MEMBER_SIZE_INIT(task_struct_exit_state, "task_struct", "exit_state");
 | 
			
		||||
         MEMBER_OFFSET_INIT(task_struct_pid, "task_struct", "pid");
 | 
			
		||||
         MEMBER_OFFSET_INIT(task_struct_comm, "task_struct", "comm");
 | 
			
		||||
         MEMBER_OFFSET_INIT(task_struct_next_task, "task_struct", "next_task");
 | 
			
		||||
@@ -5965,8 +5966,14 @@ task_state(ulong task)
 | 
			
		||||
 		state = ULONG(tt->task_struct + OFFSET(task_struct_state));
 | 
			
		||||
 	else
 | 
			
		||||
 		state = UINT(tt->task_struct + OFFSET(task_struct_state));
 | 
			
		||||
-	exit_state = VALID_MEMBER(task_struct_exit_state) ?
 | 
			
		||||
-		ULONG(tt->task_struct + OFFSET(task_struct_exit_state)) : 0;
 | 
			
		||||
+
 | 
			
		||||
+	if (VALID_MEMBER(task_struct_exit_state)
 | 
			
		||||
+	    && SIZE(task_struct_exit_state) == sizeof(ulong))
 | 
			
		||||
+	    exit_state = ULONG(tt->task_struct + OFFSET(task_struct_exit_state));
 | 
			
		||||
+	else if (VALID_MEMBER(task_struct_exit_state))
 | 
			
		||||
+	    exit_state = UINT(tt->task_struct + OFFSET(task_struct_exit_state));
 | 
			
		||||
+	else
 | 
			
		||||
+	    exit_state = 0;
 | 
			
		||||
 
 | 
			
		||||
         return (state | exit_state);
 | 
			
		||||
 }
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -1,168 +0,0 @@
 | 
			
		||||
From d65e5d3eae0dd06a5308a5cb00c05fee60594093 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Date: Mon, 20 Nov 2023 13:22:56 +0900
 | 
			
		||||
Subject: [PATCH 02/14] Fix typos in offset_table and missing "help -o" items
 | 
			
		||||
 | 
			
		||||
A few of zram related members in the offset_table have typos and
 | 
			
		||||
irregular naming rule, also they are not present in the "help -o"
 | 
			
		||||
output.  Let's fix these.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 defs.h     |  8 ++++----
 | 
			
		||||
 diskdump.c | 24 ++++++++++++------------
 | 
			
		||||
 memory.c   |  2 +-
 | 
			
		||||
 symbols.c  | 12 ++++++++++++
 | 
			
		||||
 4 files changed, 29 insertions(+), 17 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index 2cae5b61e589..5218a94fe4a4 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -2112,13 +2112,13 @@ struct offset_table {                    /* stash of commonly-used offsets */
 | 
			
		||||
 	long bpf_prog_aux_name;
 | 
			
		||||
 	long page_private;
 | 
			
		||||
 	long swap_info_struct_bdev;
 | 
			
		||||
-	long zram_mempoll;
 | 
			
		||||
+	long zram_mem_pool;
 | 
			
		||||
 	long zram_compressor;
 | 
			
		||||
-	long zram_table_flag;
 | 
			
		||||
-	long zspoll_size_class;
 | 
			
		||||
+	long zram_table_entry_flags;
 | 
			
		||||
+	long zs_pool_size_class;
 | 
			
		||||
 	long size_class_size;
 | 
			
		||||
 	long gendisk_private_data;
 | 
			
		||||
-	long zram_table_entry;
 | 
			
		||||
+	long zram_table_entry;	/* unused; but cannot remove */
 | 
			
		||||
 	long module_core_size_rw;
 | 
			
		||||
 	long module_core_size_rx;
 | 
			
		||||
 	long module_init_size_rw;
 | 
			
		||||
diff --git a/diskdump.c b/diskdump.c
 | 
			
		||||
index 25054d96313e..f20f3ac519a1 100644
 | 
			
		||||
--- a/diskdump.c
 | 
			
		||||
+++ b/diskdump.c
 | 
			
		||||
@@ -2765,15 +2765,15 @@ zram_init(void)
 | 
			
		||||
 {
 | 
			
		||||
 	long zram_flag_shift;
 | 
			
		||||
 
 | 
			
		||||
-	MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(zram_mem_pool, "zram", "mem_pool");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
 | 
			
		||||
 	if (INVALID_MEMBER(zram_compressor))
 | 
			
		||||
 		MEMBER_OFFSET_INIT(zram_comp_algs, "zram", "comp_algs");
 | 
			
		||||
-	MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
 | 
			
		||||
-	if (INVALID_MEMBER(zram_table_flag))
 | 
			
		||||
-		MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "value");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "flags");
 | 
			
		||||
+	if (INVALID_MEMBER(zram_table_entry_flags))
 | 
			
		||||
+		MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "value");
 | 
			
		||||
 	STRUCT_SIZE_INIT(zram_table_entry, "zram_table_entry");
 | 
			
		||||
-	MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(zspage_huge, "zspage", "huge");
 | 
			
		||||
 
 | 
			
		||||
@@ -2826,7 +2826,7 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
 | 
			
		||||
 	if (zs_magic != ZSPAGE_MAGIC)
 | 
			
		||||
 		error(FATAL, "zspage magic incorrect: %x\n", zs_magic);
 | 
			
		||||
 
 | 
			
		||||
-	class = pool + OFFSET(zspoll_size_class);
 | 
			
		||||
+	class = pool + OFFSET(zs_pool_size_class);
 | 
			
		||||
 	class += (class_idx * sizeof(void *));
 | 
			
		||||
 	readmem(class, KVADDR, &class, sizeof(void *), "size_class", FAULT_ON_ERROR);
 | 
			
		||||
 	readmem(class + OFFSET(size_class_size), KVADDR,
 | 
			
		||||
@@ -2987,9 +2987,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 	ulong zram, zram_table_entry, sector, index, entry, flags, size,
 | 
			
		||||
 		outsize, off;
 | 
			
		||||
 
 | 
			
		||||
-	if (INVALID_MEMBER(zram_mempoll)) {
 | 
			
		||||
+	if (INVALID_MEMBER(zram_mem_pool)) {
 | 
			
		||||
 		zram_init();
 | 
			
		||||
-		if (INVALID_MEMBER(zram_mempoll)) {
 | 
			
		||||
+		if (INVALID_MEMBER(zram_mem_pool)) {
 | 
			
		||||
 			error(WARNING,
 | 
			
		||||
 			      "Some pages are swapped out to zram. "
 | 
			
		||||
 			      "Please run mod -s zram.\n");
 | 
			
		||||
@@ -3013,8 +3013,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 	readmem(zram, KVADDR, &zram_table_entry,
 | 
			
		||||
 		sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
 | 
			
		||||
 	zram_table_entry += (index * SIZE(zram_table_entry));
 | 
			
		||||
-	readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
 | 
			
		||||
-		sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
 | 
			
		||||
+	readmem(zram_table_entry + OFFSET(zram_table_entry_flags), KVADDR, &flags,
 | 
			
		||||
+		sizeof(void *), "zram_table_entry.flags", FAULT_ON_ERROR);
 | 
			
		||||
 	if (VALID_MEMBER(zram_compressor))
 | 
			
		||||
 		readmem(zram + OFFSET(zram_compressor), KVADDR, name, sizeof(name),
 | 
			
		||||
 			"zram compressor", FAULT_ON_ERROR);
 | 
			
		||||
@@ -3072,8 +3072,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 | 
			
		||||
 		goto out;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	readmem(zram + OFFSET(zram_mempoll), KVADDR, &zram,
 | 
			
		||||
-		sizeof(void *), "zram_mempoll", FAULT_ON_ERROR);
 | 
			
		||||
+	readmem(zram + OFFSET(zram_mem_pool), KVADDR, &zram,
 | 
			
		||||
+		sizeof(void *), "zram.mem_pool", FAULT_ON_ERROR);
 | 
			
		||||
 
 | 
			
		||||
 	obj_addr = zram_object_addr(zram, entry, zram_buf);
 | 
			
		||||
 	if (obj_addr == NULL) {
 | 
			
		||||
diff --git a/memory.c b/memory.c
 | 
			
		||||
index 86ccec5e2bac..791194a405d4 100644
 | 
			
		||||
--- a/memory.c
 | 
			
		||||
+++ b/memory.c
 | 
			
		||||
@@ -519,7 +519,7 @@ vm_init(void)
 | 
			
		||||
         	"swap_info_struct", "old_block_size");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(swap_info_struct_bdev, "swap_info_struct", "bdev");
 | 
			
		||||
 
 | 
			
		||||
-	MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
 | 
			
		||||
+	MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
 | 
			
		||||
 	MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
 | 
			
		||||
 
 | 
			
		||||
 	MEMBER_OFFSET_INIT(block_device_bd_inode, "block_device", "bd_inode");
 | 
			
		||||
diff --git a/symbols.c b/symbols.c
 | 
			
		||||
index 8e8b4c31d915..176c95026f03 100644
 | 
			
		||||
--- a/symbols.c
 | 
			
		||||
+++ b/symbols.c
 | 
			
		||||
@@ -10304,6 +10304,7 @@ dump_offset_table(char *spec, ulong makestruct)
 | 
			
		||||
                 OFFSET(page_active));
 | 
			
		||||
         fprintf(fp, "            page_compound_head: %ld\n",
 | 
			
		||||
                 OFFSET(page_compound_head));
 | 
			
		||||
+        fprintf(fp, "                  page_private: %ld\n", OFFSET(page_private));
 | 
			
		||||
 
 | 
			
		||||
 	fprintf(fp, "        trace_print_flags_mask: %ld\n",
 | 
			
		||||
 		OFFSET(trace_print_flags_mask));
 | 
			
		||||
@@ -10330,6 +10331,7 @@ dump_offset_table(char *spec, ulong makestruct)
 | 
			
		||||
 		OFFSET(swap_info_struct_inuse_pages));
 | 
			
		||||
         fprintf(fp, "swap_info_struct_old_block_size: %ld\n",
 | 
			
		||||
 		OFFSET(swap_info_struct_old_block_size));
 | 
			
		||||
+        fprintf(fp, "         swap_info_struct_bdev: %ld\n", OFFSET(swap_info_struct_bdev));
 | 
			
		||||
 	fprintf(fp, "         block_device_bd_inode: %ld\n",
 | 
			
		||||
 		OFFSET(block_device_bd_inode));
 | 
			
		||||
 	fprintf(fp, "          block_device_bd_list: %ld\n",
 | 
			
		||||
@@ -11359,6 +11361,8 @@ dump_offset_table(char *spec, ulong makestruct)
 | 
			
		||||
 		OFFSET(gendisk_part0));
 | 
			
		||||
 	fprintf(fp, "                 gendisk_queue: %ld\n",
 | 
			
		||||
 		OFFSET(gendisk_queue));
 | 
			
		||||
+	fprintf(fp, "          gendisk_private_data: %ld\n", OFFSET(gendisk_private_data));
 | 
			
		||||
+
 | 
			
		||||
 	fprintf(fp, "                 hd_struct_dev: %ld\n",
 | 
			
		||||
 		OFFSET(hd_struct_dev));
 | 
			
		||||
 	fprintf(fp, "             hd_struct_dkstats: %ld\n",
 | 
			
		||||
@@ -11765,6 +11769,14 @@ dump_offset_table(char *spec, ulong makestruct)
 | 
			
		||||
 	fprintf(fp, "            maple_metadata_end: %ld\n", OFFSET(maple_metadata_end));
 | 
			
		||||
 	fprintf(fp, "            maple_metadata_gap: %ld\n", OFFSET(maple_metadata_gap));
 | 
			
		||||
 
 | 
			
		||||
+	fprintf(fp, "                 zram_mem_pool: %ld\n", OFFSET(zram_mem_pool));
 | 
			
		||||
+	fprintf(fp, "               zram_compressor: %ld\n", OFFSET(zram_compressor));
 | 
			
		||||
+	fprintf(fp, "                zram_comp_algs: %ld\n", OFFSET(zram_comp_algs));
 | 
			
		||||
+	fprintf(fp, "        zram_table_entry_flags: %ld\n", OFFSET(zram_table_entry_flags));
 | 
			
		||||
+	fprintf(fp, "            zs_pool_size_class: %ld\n", OFFSET(zs_pool_size_class));
 | 
			
		||||
+	fprintf(fp, "               size_class_size: %ld\n", OFFSET(size_class_size));
 | 
			
		||||
+	fprintf(fp, "                   zspage_huge: %ld\n", OFFSET(zspage_huge));
 | 
			
		||||
+
 | 
			
		||||
 	fprintf(fp, "\n                    size_table:\n");
 | 
			
		||||
 	fprintf(fp, "                          page: %ld\n", SIZE(page));
 | 
			
		||||
 	fprintf(fp, "                    page_flags: %ld\n", SIZE(page_flags));
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,51 @@
 | 
			
		||||
From 6167a55b227db61eb52c2a4f96f44fc559a8b1d0 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Charles Haithcock <chaithco@redhat.com>
 | 
			
		||||
Date: Fri, 18 Jul 2025 16:14:25 -0600
 | 
			
		||||
Subject: [PATCH 2/5] doc: Update requirements for building on Fedora
 | 
			
		||||
 | 
			
		||||
Attempting to build on Fedora fails with the following error;
 | 
			
		||||
 | 
			
		||||
$ make
 | 
			
		||||
TARGET: RISCV64
 | 
			
		||||
 CRASH: 9.0.0++
 | 
			
		||||
   GDB: 16.2
 | 
			
		||||
 | 
			
		||||
Saving 'gdb-16.2.tar.gz'
 | 
			
		||||
[...]
 | 
			
		||||
checking for the correct version of gmp.h... no
 | 
			
		||||
configure: error: Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
 | 
			
		||||
Try the --with-gmp and/or --with-mpfr options to specify
 | 
			
		||||
their locations.  If you obtained GMP and/or MPFR from a vendor
 | 
			
		||||
distribution package, make sure that you have installed both the libraries
 | 
			
		||||
and the header files.  They may be located in separate packages.
 | 
			
		||||
make[2]: *** No targets specified and no makefile found.  Stop.
 | 
			
		||||
 | 
			
		||||
crash build failed
 | 
			
		||||
 | 
			
		||||
make[1]: *** [Makefile:316: gdb_merge] Error 1
 | 
			
		||||
make: *** [Makefile:307: all] Error 2
 | 
			
		||||
 | 
			
		||||
Installing gmp-devel and mpfr-devel fixed this, so this patch updates the
 | 
			
		||||
requirements for building on Fedora.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 README | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/README b/README
 | 
			
		||||
index 2e34fbb15f1a..f9824c7240bf 100644
 | 
			
		||||
--- a/README
 | 
			
		||||
+++ b/README
 | 
			
		||||
@@ -73,7 +73,7 @@
 | 
			
		||||
      that is created in the top-level kernel build directory must be saved.
 | 
			
		||||
 
 | 
			
		||||
   o  Requirements for building:
 | 
			
		||||
-      Fedora: make gcc gcc-c++ ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch texinfo libzstd-devel
 | 
			
		||||
+      Fedora: make gcc gcc-c++ ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch texinfo libzstd-devel gmp-devel mpfr-devel
 | 
			
		||||
       Ubuntu/Debian: make gcc g++ libncurses-dev zlib1g-dev liblzo2-dev libsnappy-dev bison wget patch texinfo libzstd-dev
 | 
			
		||||
       Arch Linux: make gcc ncurses zlib lzo snappy bison wget patch texinfo zstd
 | 
			
		||||
       openSUSE: make gcc gcc-c++ ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch texinfo libzstd-devel
 | 
			
		||||
-- 
 | 
			
		||||
2.50.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										211
									
								
								SOURCES/0003-Add-multi-threads-support-in-crash-target.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								SOURCES/0003-Add-multi-threads-support-in-crash-target.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,211 @@
 | 
			
		||||
From 099f74640c965cd9c0e3620b9b5a0367b81a4e33 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 25 Jun 2025 16:01:59 +1200
 | 
			
		||||
Subject: [PATCH 3/9] Add multi-threads support in crash target
 | 
			
		||||
 | 
			
		||||
Previously, only one thread is created in crash target by [1]. And this one
 | 
			
		||||
thread will work as the common container for different tasks whenever
 | 
			
		||||
"set <pid>" to it. Its tid number is 0 and will never be deleted.
 | 
			
		||||
 | 
			
		||||
In order to support multi-stacks, we enable multi-threads in crash
 | 
			
		||||
target. Each thread will represent one stack, and "info threads" will
 | 
			
		||||
list all available stacks, "thread <id>" will switch to it.
 | 
			
		||||
 | 
			
		||||
Since multi-stacks is task binded, each task switching will trigger
 | 
			
		||||
a thread delete of those tid number other than 0. In addition, we will
 | 
			
		||||
pass the tid number to each arch's get_current_task_reg(), in order to
 | 
			
		||||
retrive the regs value of the specific stack.
 | 
			
		||||
 | 
			
		||||
[1]: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg01085.html
 | 
			
		||||
 | 
			
		||||
Co-developed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Co-developed-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 arm64.c         |  2 +-
 | 
			
		||||
 crash_target.c  | 42 +++++++++++++++++++++++++++++++++++++++---
 | 
			
		||||
 defs.h          |  3 ++-
 | 
			
		||||
 gdb_interface.c |  6 +++---
 | 
			
		||||
 ppc64.c         |  4 ++--
 | 
			
		||||
 x86_64.c        |  4 ++--
 | 
			
		||||
 6 files changed, 49 insertions(+), 12 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arm64.c b/arm64.c
 | 
			
		||||
index ef4a2b8a6bef..1cdde5f12bd0 100644
 | 
			
		||||
--- a/arm64.c
 | 
			
		||||
+++ b/arm64.c
 | 
			
		||||
@@ -204,7 +204,7 @@ out:
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
 arm64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
-                   int size, void *value)
 | 
			
		||||
+                   int size, void *value, int sid)
 | 
			
		||||
 {
 | 
			
		||||
 	struct bt_info bt_info, bt_setup;
 | 
			
		||||
 	struct task_context *tc;
 | 
			
		||||
diff --git a/crash_target.c b/crash_target.c
 | 
			
		||||
index 5966b7bb4f01..71998ef2d806 100644
 | 
			
		||||
--- a/crash_target.c
 | 
			
		||||
+++ b/crash_target.c
 | 
			
		||||
@@ -27,8 +27,9 @@ void crash_target_init (void);
 | 
			
		||||
 
 | 
			
		||||
 extern "C" int gdb_readmem_callback(unsigned long, void *, int, int);
 | 
			
		||||
 extern "C" int crash_get_current_task_reg (int regno, const char *regname,
 | 
			
		||||
-                                  int regsize, void *val);
 | 
			
		||||
+                                  int regsize, void *val, int sid);
 | 
			
		||||
 extern "C" int gdb_change_thread_context (void);
 | 
			
		||||
+extern "C" int gdb_add_substack (int);
 | 
			
		||||
 extern "C" void crash_get_current_task_info(unsigned long *pid, char **comm);
 | 
			
		||||
 
 | 
			
		||||
 /* The crash target.  */
 | 
			
		||||
@@ -66,7 +67,12 @@ public:
 | 
			
		||||
     crash_get_current_task_info(&pid, &comm);
 | 
			
		||||
     return string_printf ("%ld %s", pid, comm);
 | 
			
		||||
   }
 | 
			
		||||
-
 | 
			
		||||
+  const char *extra_thread_info (thread_info *tp) override
 | 
			
		||||
+  {
 | 
			
		||||
+    static char buf[16] = {0};
 | 
			
		||||
+    snprintf(buf, sizeof(buf), "stack %ld", tp->ptid.tid());
 | 
			
		||||
+    return buf;
 | 
			
		||||
+  }
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 static void supply_registers(struct regcache *regcache, int regno)
 | 
			
		||||
@@ -79,7 +85,7 @@ static void supply_registers(struct regcache *regcache, int regno)
 | 
			
		||||
   if (regsize > sizeof (regval))
 | 
			
		||||
     error (_("fatal error: buffer size is not enough to fit register value"));
 | 
			
		||||
 
 | 
			
		||||
-  if (crash_get_current_task_reg (regno, regname, regsize, (void *)®val))
 | 
			
		||||
+  if (crash_get_current_task_reg (regno, regname, regsize, (void *)®val, inferior_thread()->ptid.tid()))
 | 
			
		||||
     regcache->raw_supply (regno, regval);
 | 
			
		||||
   else
 | 
			
		||||
     regcache->raw_supply (regno, NULL);
 | 
			
		||||
@@ -144,7 +150,37 @@ crash_target_init (void)
 | 
			
		||||
 extern "C" int
 | 
			
		||||
 gdb_change_thread_context (void)
 | 
			
		||||
 {
 | 
			
		||||
+  /* 1st, switch to tid 0 if we are not */
 | 
			
		||||
+  if (inferior_thread()->ptid.tid()) {
 | 
			
		||||
+       switch_to_thread (&(current_inferior()->thread_list.front()));
 | 
			
		||||
+  }
 | 
			
		||||
+  /* 2nd, delete threads whose tid is not 0 */
 | 
			
		||||
+  for (thread_info *tp : current_inferior()->threads_safe()) {
 | 
			
		||||
+       if (tp->ptid.tid() && tp->deletable()) {
 | 
			
		||||
+               delete_thread_silent(tp);
 | 
			
		||||
+               current_inferior()->highest_thread_num--;
 | 
			
		||||
+       }
 | 
			
		||||
+  }
 | 
			
		||||
+  /* 3rd, refresh regcache for tid 0 */
 | 
			
		||||
   target_fetch_registers(get_thread_regcache(inferior_thread()), -1);
 | 
			
		||||
   reinit_frame_cache();
 | 
			
		||||
   return TRUE;
 | 
			
		||||
 }
 | 
			
		||||
+
 | 
			
		||||
+/* Add a thread for each additional stack. Use stack ID as a thread ID */
 | 
			
		||||
+extern "C" int
 | 
			
		||||
+gdb_add_substack (int sid)
 | 
			
		||||
+{
 | 
			
		||||
+  thread_info *tp;
 | 
			
		||||
+  thread_info *current_thread = inferior_thread();
 | 
			
		||||
+
 | 
			
		||||
+  ptid_t ptid = ptid_t(CRASH_INFERIOR_PID, 0, sid + 1);
 | 
			
		||||
+  tp = current_inferior()->find_thread(ptid);
 | 
			
		||||
+  if (tp == nullptr) {
 | 
			
		||||
+    tp = add_thread_silent(current_inferior()->process_target(), ptid);
 | 
			
		||||
+  }
 | 
			
		||||
+  switch_to_thread (tp);
 | 
			
		||||
+  target_fetch_registers(get_thread_regcache(tp), -1);
 | 
			
		||||
+  switch_to_thread (current_thread);
 | 
			
		||||
+  return TRUE;
 | 
			
		||||
+}
 | 
			
		||||
\ No newline at end of file
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index 2fdb4db56a05..bbd6d4bbf8a8 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -1081,7 +1081,7 @@ struct machdep_table {
 | 
			
		||||
         void (*get_irq_affinity)(int);
 | 
			
		||||
         void (*show_interrupts)(int, ulong *);
 | 
			
		||||
 	int (*is_page_ptr)(ulong, physaddr_t *);
 | 
			
		||||
-	int (*get_current_task_reg)(int, const char *, int, void *);
 | 
			
		||||
+	int (*get_current_task_reg)(int, const char *, int, void *, int);
 | 
			
		||||
 	int (*is_cpu_prstatus_valid)(int cpu);
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
@@ -8324,5 +8324,6 @@ enum ppc64_regnum {
 | 
			
		||||
 
 | 
			
		||||
 /* crash_target.c */
 | 
			
		||||
 extern int gdb_change_thread_context (void);
 | 
			
		||||
+extern int gdb_add_substack (int);
 | 
			
		||||
 
 | 
			
		||||
 #endif /* !GDB_COMMON */
 | 
			
		||||
diff --git a/gdb_interface.c b/gdb_interface.c
 | 
			
		||||
index fa2e85ba2e9c..9f76f85f341a 100644
 | 
			
		||||
--- a/gdb_interface.c
 | 
			
		||||
+++ b/gdb_interface.c
 | 
			
		||||
@@ -1076,13 +1076,13 @@ unsigned long crash_get_kaslr_offset(void)
 | 
			
		||||
 
 | 
			
		||||
 /* Callbacks for crash_target */
 | 
			
		||||
 int crash_get_current_task_reg (int regno, const char *regname,
 | 
			
		||||
-				int regsize, void *value);
 | 
			
		||||
+				int regsize, void *value, int sid);
 | 
			
		||||
 int crash_get_current_task_reg (int regno, const char *regname,
 | 
			
		||||
-				int regsize, void *value)
 | 
			
		||||
+				int regsize, void *value, int sid)
 | 
			
		||||
 {
 | 
			
		||||
 	if (!machdep->get_current_task_reg)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
-	return machdep->get_current_task_reg(regno, regname, regsize, value);
 | 
			
		||||
+	return machdep->get_current_task_reg(regno, regname, regsize, value, sid);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /* arm64 kernel lr maybe has patuh */
 | 
			
		||||
diff --git a/ppc64.c b/ppc64.c
 | 
			
		||||
index 782107b5b018..7ac12feaee7d 100644
 | 
			
		||||
--- a/ppc64.c
 | 
			
		||||
+++ b/ppc64.c
 | 
			
		||||
@@ -56,7 +56,7 @@ static char * ppc64_check_eframe(struct ppc64_pt_regs *);
 | 
			
		||||
 static void ppc64_print_eframe(char *, struct ppc64_pt_regs *, 
 | 
			
		||||
 		struct bt_info *);
 | 
			
		||||
 static int ppc64_get_current_task_reg(int regno, const char *name, int size,
 | 
			
		||||
-		  void *value);
 | 
			
		||||
+		  void *value, int);
 | 
			
		||||
 static void parse_cmdline_args(void);
 | 
			
		||||
 static int ppc64_paca_percpu_offset_init(int);
 | 
			
		||||
 static void ppc64_init_cpu_info(void);
 | 
			
		||||
@@ -2512,7 +2512,7 @@ ppc64_print_eframe(char *efrm_str, struct ppc64_pt_regs *regs,
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
 ppc64_get_current_task_reg(int regno, const char *name, int size,
 | 
			
		||||
-		  void *value)
 | 
			
		||||
+		  void *value, int sid)
 | 
			
		||||
 {
 | 
			
		||||
 	struct bt_info bt_info, bt_setup;
 | 
			
		||||
 	struct task_context *tc;
 | 
			
		||||
diff --git a/x86_64.c b/x86_64.c
 | 
			
		||||
index d4bbd15d723e..a46fb9d8b72b 100644
 | 
			
		||||
--- a/x86_64.c
 | 
			
		||||
+++ b/x86_64.c
 | 
			
		||||
@@ -126,7 +126,7 @@ static int x86_64_get_framesize(struct bt_info *, ulong, ulong, char *);
 | 
			
		||||
 static void x86_64_framesize_debug(struct bt_info *);
 | 
			
		||||
 static void x86_64_get_active_set(void);
 | 
			
		||||
 static int x86_64_get_kvaddr_ranges(struct vaddr_range *);
 | 
			
		||||
-static int x86_64_get_current_task_reg(int, const char *, int, void *);
 | 
			
		||||
+static int x86_64_get_current_task_reg(int, const char *, int, void *, int);
 | 
			
		||||
 static int x86_64_verify_paddr(uint64_t);
 | 
			
		||||
 static void GART_init(void);
 | 
			
		||||
 static void x86_64_exception_stacks_init(void);
 | 
			
		||||
@@ -9233,7 +9233,7 @@ x86_64_get_kvaddr_ranges(struct vaddr_range *vrp)
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
 x86_64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
-			    int size, void *value)
 | 
			
		||||
+			    int size, void *value, int sid)
 | 
			
		||||
 {
 | 
			
		||||
 	struct bt_info bt_info, bt_setup;
 | 
			
		||||
 	struct task_context *tc;
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,98 @@
 | 
			
		||||
From 6642b2729067399696f8f24f29267b3483d895c6 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Tue, 8 Jul 2025 13:26:38 +1200
 | 
			
		||||
Subject: [PATCH 3/5] gdb: Fix a regression for eppic extension on gdb-16.2
 | 
			
		||||
 | 
			
		||||
There is a regression found when testing eppic extension on gdb-16.2
 | 
			
		||||
crash:
 | 
			
		||||
 | 
			
		||||
   crash> cgroup
 | 
			
		||||
   /root/.eppic/cgroup.c : line 99 : Error: undefined variable 'cgroup_roots'
 | 
			
		||||
 | 
			
		||||
The root cause is when doing gdb upgrading, the replacement of
 | 
			
		||||
gdb_get_datatype() is incorrect:
 | 
			
		||||
 | 
			
		||||
The original gdb-10.2 version:
 | 
			
		||||
 | 
			
		||||
   long value = SYMBOL_VALUE(expr->elts[2].symbol);
 | 
			
		||||
 | 
			
		||||
The incorrect gdb-16.2 replacement:
 | 
			
		||||
 | 
			
		||||
   long value = value_as_long(expr->evaluate());
 | 
			
		||||
 | 
			
		||||
According to gdb/tracepoint.c, the correct gdb-16.2 replacement should be:
 | 
			
		||||
 | 
			
		||||
   symbol *sym;
 | 
			
		||||
   expr::var_value_operation *vvop
 | 
			
		||||
     = (gdb::checked_static_cast<expr::var_value_operation *>
 | 
			
		||||
        (exp->op.get ()));
 | 
			
		||||
   sym = vvop->get_symbol ();
 | 
			
		||||
   long value = sym->value_longest ();
 | 
			
		||||
 | 
			
		||||
Otherwise, the value_as_long() will throw an exception when trying to
 | 
			
		||||
convert a struct into long, such as "cgroup_roots". The reason why this
 | 
			
		||||
issue only observed on crash extensions, is the faulty code block
 | 
			
		||||
triggered with "req->tcb", which is a callback for gdb_interface(), and
 | 
			
		||||
the callback is used by eppic extension, but the normal crash internal calls
 | 
			
		||||
hardly use it.
 | 
			
		||||
 | 
			
		||||
After:
 | 
			
		||||
   crash> cgroup
 | 
			
		||||
   0:/user.slice/user-1000.slice/session-2.scope
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 gdb-16.2.patch | 32 +++++++++++++++++++++++++++++++-
 | 
			
		||||
 1 file changed, 31 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/gdb-16.2.patch b/gdb-16.2.patch
 | 
			
		||||
index 151e4e2039d9..9d056580b2f7 100644
 | 
			
		||||
--- a/gdb-16.2.patch
 | 
			
		||||
+++ b/gdb-16.2.patch
 | 
			
		||||
@@ -9,7 +9,8 @@
 | 
			
		||||
 # to all subsequent patch applications.
 | 
			
		||||
 
 | 
			
		||||
 tar xvzmf gdb-16.2.tar.gz \
 | 
			
		||||
-	gdb-16.2/gdb/symfile.c
 | 
			
		||||
+	gdb-16.2/gdb/symfile.c \
 | 
			
		||||
+	gdb-16.2/gdb/symtab.c
 | 
			
		||||
 
 | 
			
		||||
 exit 0
 | 
			
		||||
 
 | 
			
		||||
@@ -1952,3 +1953,32 @@ exit 0
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
    /* Remember the bfd indexes for the .text, .data, .bss and
 | 
			
		||||
+--- gdb-16.2/gdb/symtab.c.orig
 | 
			
		||||
++++ gdb-16.2/gdb/symtab.c
 | 
			
		||||
+@@ -7690,7 +7690,11 @@
 | 
			
		||||
+                         console("expr->first_opcode(): OP_VAR_VALUE\n");
 | 
			
		||||
+                 type = expr->evaluate_type()->type();
 | 
			
		||||
+                 if (req->tcb) {
 | 
			
		||||
+-                        long value = value_as_long(expr->evaluate());
 | 
			
		||||
++			expr::var_value_operation *vvop
 | 
			
		||||
++			    = (gdb::checked_static_cast<expr::var_value_operation *>
 | 
			
		||||
++			       (expr->op.get ()));
 | 
			
		||||
++			sym = vvop->get_symbol ();
 | 
			
		||||
++			long value = sym->value_longest ();
 | 
			
		||||
+                         /* callback with symbol value */
 | 
			
		||||
+                         req->typecode = TYPE_CODE(type);
 | 
			
		||||
+                         req->tcb(EOP_VALUE, req, &value, 0, 0, 0);
 | 
			
		||||
+@@ -7701,8 +7705,12 @@
 | 
			
		||||
+                                 req->length = type->length();
 | 
			
		||||
+                         }
 | 
			
		||||
+                         if (TYPE_CODE(type) == TYPE_CODE_ENUM) {
 | 
			
		||||
++				expr::var_value_operation *vvop
 | 
			
		||||
++				    = (gdb::checked_static_cast<expr::var_value_operation *>
 | 
			
		||||
++				       (expr->op.get ()));
 | 
			
		||||
++				sym = vvop->get_symbol ();
 | 
			
		||||
+                                 req->typecode = TYPE_CODE(type);
 | 
			
		||||
+-                                req->value = value_as_long(expr->evaluate());
 | 
			
		||||
++                                req->value = sym->value_longest ();
 | 
			
		||||
+                                 req->tagname = (char *)TYPE_TAG_NAME(type);
 | 
			
		||||
+                                 if (!req->tagname) {
 | 
			
		||||
+                                         val = expr->evaluate_type();
 | 
			
		||||
-- 
 | 
			
		||||
2.50.0
 | 
			
		||||
 | 
			
		||||
@ -1,78 +0,0 @@
 | 
			
		||||
From 582febffa8b3567339148c2bb916fc70f2fc546e Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Johan Erlandsson <johan.erlandsson@sony.com>
 | 
			
		||||
Date: Fri, 20 Oct 2023 19:10:52 +0200
 | 
			
		||||
Subject: [PATCH 03/14] zram: Fixes for lookup_swap_cache()
 | 
			
		||||
 | 
			
		||||
Fix the following three issues:
 | 
			
		||||
(1) swap cache missing page tree offset
 | 
			
		||||
    The radix or xarray start at an offset inside struct address_space.
 | 
			
		||||
(2) swap cache entries are pointer to struct page
 | 
			
		||||
    The entries in radix, xarray (swap cache) are address to struct page.
 | 
			
		||||
(3) exclude shadow entries from swap cache lookup
 | 
			
		||||
    radix or xarray can contain shadow entries from previous page
 | 
			
		||||
    entries. These should be ignored when looking for a page pointer.
 | 
			
		||||
 | 
			
		||||
Without the patch,
 | 
			
		||||
- lookup_swap_cache() returns NULL since do_xarray() call returns FALSE,
 | 
			
		||||
- in try_zram_decompress(), since 'entry' is NULL, page is filled with 0,
 | 
			
		||||
    if (!entry || (flags & ZRAM_FLAG_SAME_BIT)) {
 | 
			
		||||
and pages in swap cache will be seen to be a 'zero' page.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Johan Erlandsson <johan.erlandsson@sony.com>
 | 
			
		||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 diskdump.c | 19 ++++++++++++++-----
 | 
			
		||||
 1 file changed, 14 insertions(+), 5 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/diskdump.c b/diskdump.c
 | 
			
		||||
index f20f3ac519a1..660c25729dad 100644
 | 
			
		||||
--- a/diskdump.c
 | 
			
		||||
+++ b/diskdump.c
 | 
			
		||||
@@ -27,6 +27,7 @@
 | 
			
		||||
 #include "diskdump.h"
 | 
			
		||||
 #include "xen_dom0.h"
 | 
			
		||||
 #include "vmcore.h"
 | 
			
		||||
+#include "maple_tree.h"
 | 
			
		||||
 
 | 
			
		||||
 #define BITMAP_SECT_LEN	4096
 | 
			
		||||
 
 | 
			
		||||
@@ -2877,11 +2878,16 @@ out:
 | 
			
		||||
 	return zram_buf;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static inline bool radix_tree_exceptional_entry(ulong entry)
 | 
			
		||||
+{
 | 
			
		||||
+	return entry & RADIX_TREE_EXCEPTIONAL_ENTRY;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static unsigned char *
 | 
			
		||||
 lookup_swap_cache(ulonglong pte_val, unsigned char *zram_buf)
 | 
			
		||||
 {
 | 
			
		||||
 	ulonglong swp_offset;
 | 
			
		||||
-	ulong swp_type, swp_space, page;
 | 
			
		||||
+	ulong swp_type, swp_space;
 | 
			
		||||
 	struct list_pair lp;
 | 
			
		||||
 	physaddr_t paddr;
 | 
			
		||||
 	static int is_xarray = -1;
 | 
			
		||||
@@ -2907,10 +2913,13 @@ lookup_swap_cache(ulonglong pte_val, unsigned char *zram_buf)
 | 
			
		||||
 	swp_space += (swp_offset >> SWAP_ADDRESS_SPACE_SHIFT) * SIZE(address_space);
 | 
			
		||||
 
 | 
			
		||||
 	lp.index = swp_offset;
 | 
			
		||||
-	if ((is_xarray ? do_xarray : do_radix_tree)(swp_space, RADIX_TREE_SEARCH, &lp)) {
 | 
			
		||||
-		readmem((ulong)lp.value, KVADDR, &page, sizeof(void *),
 | 
			
		||||
-				"swap_cache page", FAULT_ON_ERROR);
 | 
			
		||||
-		if (!is_page_ptr(page, &paddr)) {
 | 
			
		||||
+	if ((is_xarray ? do_xarray : do_radix_tree)
 | 
			
		||||
+		(swp_space+OFFSET(address_space_page_tree), RADIX_TREE_SEARCH, &lp)) {
 | 
			
		||||
+		if ((is_xarray ? xa_is_value : radix_tree_exceptional_entry)((ulong)lp.value)) {
 | 
			
		||||
+			/* ignore shadow values */
 | 
			
		||||
+			return NULL;
 | 
			
		||||
+		}
 | 
			
		||||
+		if (!is_page_ptr((ulong)lp.value, &paddr)) {
 | 
			
		||||
 			error(WARNING, "radix page: %lx: not a page pointer\n", lp.value);
 | 
			
		||||
 			return NULL;
 | 
			
		||||
 		}
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										174
									
								
								SOURCES/0004-Call-cmd_bt-silently-after-set-pid.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										174
									
								
								SOURCES/0004-Call-cmd_bt-silently-after-set-pid.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,174 @@
 | 
			
		||||
From d3ef6e456629fc5711708a88872304da5159c1c6 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 25 Jun 2025 16:02:00 +1200
 | 
			
		||||
Subject: [PATCH 4/9] Call cmd_bt silently after "set pid"
 | 
			
		||||
 | 
			
		||||
Cmd bt will list multi-stacks of one task. After we "set <pid>" switch
 | 
			
		||||
context to one task, we first need a bt call to detect the multi-stacks,
 | 
			
		||||
however we don't want any console output from it, so a nullfp is used for
 | 
			
		||||
output receive. The silent bt call is only triggered once as part of task
 | 
			
		||||
context switch by cmd set.
 | 
			
		||||
 | 
			
		||||
A array of user_regs pointers is reserved for each supported arch. If one
 | 
			
		||||
extra stack found, a user_regs structure will be allocated for storing regs
 | 
			
		||||
value of the stack.
 | 
			
		||||
 | 
			
		||||
Co-developed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Co-developed-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 arm64.c        |  4 ++++
 | 
			
		||||
 crash_target.c |  7 +++++++
 | 
			
		||||
 kernel.c       | 44 ++++++++++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 ppc64.c        |  4 ++++
 | 
			
		||||
 task.c         |  4 ++--
 | 
			
		||||
 x86_64.c       |  3 +++
 | 
			
		||||
 6 files changed, 64 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arm64.c b/arm64.c
 | 
			
		||||
index 1cdde5f12bd0..829130158902 100644
 | 
			
		||||
--- a/arm64.c
 | 
			
		||||
+++ b/arm64.c
 | 
			
		||||
@@ -126,6 +126,10 @@ struct user_regs_bitmap_struct {
 | 
			
		||||
 	ulong bitmap[32];
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+#define MAX_EXCEPTION_STACKS 7
 | 
			
		||||
+ulong extra_stacks_idx = 0;
 | 
			
		||||
+struct user_regs_bitmap_struct *extra_stacks_regs[MAX_EXCEPTION_STACKS] = {0};
 | 
			
		||||
+
 | 
			
		||||
 static inline bool is_mte_kvaddr(ulong addr)
 | 
			
		||||
 {
 | 
			
		||||
 	/* check for ARM64_MTE enabled */
 | 
			
		||||
diff --git a/crash_target.c b/crash_target.c
 | 
			
		||||
index 71998ef2d806..ad1480c9188f 100644
 | 
			
		||||
--- a/crash_target.c
 | 
			
		||||
+++ b/crash_target.c
 | 
			
		||||
@@ -31,6 +31,9 @@ extern "C" int crash_get_current_task_reg (int regno, const char *regname,
 | 
			
		||||
 extern "C" int gdb_change_thread_context (void);
 | 
			
		||||
 extern "C" int gdb_add_substack (int);
 | 
			
		||||
 extern "C" void crash_get_current_task_info(unsigned long *pid, char **comm);
 | 
			
		||||
+#if defined (X86_64) || defined (ARM64) || defined (PPC64)
 | 
			
		||||
+extern "C" void silent_call_bt(void);
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 /* The crash target.  */
 | 
			
		||||
 
 | 
			
		||||
@@ -164,6 +167,10 @@ gdb_change_thread_context (void)
 | 
			
		||||
   /* 3rd, refresh regcache for tid 0 */
 | 
			
		||||
   target_fetch_registers(get_thread_regcache(inferior_thread()), -1);
 | 
			
		||||
   reinit_frame_cache();
 | 
			
		||||
+#if defined (X86_64) || defined (ARM64) || defined (PPC64)
 | 
			
		||||
+  /* 4th, invoke bt silently to refresh the additional stacks */
 | 
			
		||||
+  silent_call_bt();
 | 
			
		||||
+#endif
 | 
			
		||||
   return TRUE;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
diff --git a/kernel.c b/kernel.c
 | 
			
		||||
index b8d3b7999974..e4213d7a663e 100644
 | 
			
		||||
--- a/kernel.c
 | 
			
		||||
+++ b/kernel.c
 | 
			
		||||
@@ -12002,3 +12002,47 @@ int get_linux_banner_from_vmlinux(char *buf, size_t size)
 | 
			
		||||
 
 | 
			
		||||
 	return TRUE;
 | 
			
		||||
 }
 | 
			
		||||
+
 | 
			
		||||
+#if defined(X86_64) || defined(ARM64) || defined(PPC64)
 | 
			
		||||
+extern ulong extra_stacks_idx;
 | 
			
		||||
+extern void *extra_stacks_regs[];
 | 
			
		||||
+void silent_call_bt(void);
 | 
			
		||||
+void silent_call_bt(void)
 | 
			
		||||
+{
 | 
			
		||||
+	jmp_buf main_loop_env_save;
 | 
			
		||||
+	unsigned long long flags_save = pc->flags;
 | 
			
		||||
+	FILE *fp_save = fp;
 | 
			
		||||
+	FILE *error_fp_save = pc->error_fp;
 | 
			
		||||
+	/* Redirect all cmd_bt() outputs into null */
 | 
			
		||||
+	fp = pc->nullfp;
 | 
			
		||||
+	pc->error_fp = pc->nullfp;
 | 
			
		||||
+
 | 
			
		||||
+	for (int i = 0; i < extra_stacks_idx; i++) {
 | 
			
		||||
+		/* Note: GETBUF/FREEBUF is not applicable for extra_stacks_regs,
 | 
			
		||||
+		   because we are reserving extra_stacks_regs by cmd_bt()
 | 
			
		||||
+		   for later use. But GETBUF/FREEBUF is designed for use only
 | 
			
		||||
+		   within one cmd. See process_command_line() -> restore_sanity()
 | 
			
		||||
+		   -> free_all_bufs(). So we use malloc/free instead. */
 | 
			
		||||
+		free(extra_stacks_regs[i]);
 | 
			
		||||
+		extra_stacks_regs[i] = NULL;
 | 
			
		||||
+	}
 | 
			
		||||
+	/* Prepare args used by cmd_bt() */
 | 
			
		||||
+	sprintf(pc->command_line, "bt\n");
 | 
			
		||||
+	argcnt = parse_line(pc->command_line, args);
 | 
			
		||||
+	optind = 1;
 | 
			
		||||
+	pc->flags |= RUNTIME;
 | 
			
		||||
+
 | 
			
		||||
+	/* Catch error FATAL generated by cmd_bt() if any */
 | 
			
		||||
+	memcpy(&main_loop_env_save, &pc->main_loop_env, sizeof(jmp_buf));
 | 
			
		||||
+	if (setjmp(pc->main_loop_env)) {
 | 
			
		||||
+		goto out;
 | 
			
		||||
+	}
 | 
			
		||||
+	cmd_bt();
 | 
			
		||||
+out:
 | 
			
		||||
+	/* Restore all */
 | 
			
		||||
+	memcpy(&pc->main_loop_env, &main_loop_env_save, sizeof(jmp_buf));
 | 
			
		||||
+	pc->flags = flags_save;
 | 
			
		||||
+	fp = fp_save;
 | 
			
		||||
+	pc->error_fp = error_fp_save;
 | 
			
		||||
+}
 | 
			
		||||
+#endif
 | 
			
		||||
diff --git a/ppc64.c b/ppc64.c
 | 
			
		||||
index 7ac12feaee7d..532eb3fe4a7e 100644
 | 
			
		||||
--- a/ppc64.c
 | 
			
		||||
+++ b/ppc64.c
 | 
			
		||||
@@ -80,6 +80,10 @@ struct user_regs_bitmap_struct {
 | 
			
		||||
 	ulong bitmap[32];
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+#define MAX_EXCEPTION_STACKS 7
 | 
			
		||||
+ulong extra_stacks_idx = 0;
 | 
			
		||||
+struct user_regs_bitmap_struct *extra_stacks_regs[MAX_EXCEPTION_STACKS] = {0};
 | 
			
		||||
+
 | 
			
		||||
 static int is_opal_context(ulong sp, ulong nip)
 | 
			
		||||
 {
 | 
			
		||||
 	uint64_t opal_start, opal_end;
 | 
			
		||||
diff --git a/task.c b/task.c
 | 
			
		||||
index e07b479a3bec..ec04b556c337 100644
 | 
			
		||||
--- a/task.c
 | 
			
		||||
+++ b/task.c
 | 
			
		||||
@@ -3062,7 +3062,7 @@ sort_context_array(void)
 | 
			
		||||
 	curtask = CURRENT_TASK();
 | 
			
		||||
 	qsort((void *)tt->context_array, (size_t)tt->running_tasks,
 | 
			
		||||
         	sizeof(struct task_context), sort_by_pid);
 | 
			
		||||
-	set_context(curtask, NO_PID, TRUE);
 | 
			
		||||
+	set_context(curtask, NO_PID, FALSE);
 | 
			
		||||
 
 | 
			
		||||
 	sort_context_by_task();
 | 
			
		||||
 }
 | 
			
		||||
@@ -3109,7 +3109,7 @@ sort_context_array_by_last_run(void)
 | 
			
		||||
 	curtask = CURRENT_TASK();
 | 
			
		||||
 	qsort((void *)tt->context_array, (size_t)tt->running_tasks,
 | 
			
		||||
         	sizeof(struct task_context), sort_by_last_run);
 | 
			
		||||
-	set_context(curtask, NO_PID, TRUE);
 | 
			
		||||
+	set_context(curtask, NO_PID, FALSE);
 | 
			
		||||
 
 | 
			
		||||
 	sort_context_by_task();
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/x86_64.c b/x86_64.c
 | 
			
		||||
index a46fb9d8b72b..ee23d8b5e41e 100644
 | 
			
		||||
--- a/x86_64.c
 | 
			
		||||
+++ b/x86_64.c
 | 
			
		||||
@@ -160,6 +160,9 @@ struct user_regs_bitmap_struct {
 | 
			
		||||
 	ulong bitmap[32];
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+ulong extra_stacks_idx = 0;
 | 
			
		||||
+struct user_regs_bitmap_struct *extra_stacks_regs[MAX_EXCEPTION_STACKS] = {0};
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  *  Do all necessary machine-specific setup here.  This is called several
 | 
			
		||||
  *  times during initialization.
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,42 @@
 | 
			
		||||
From 31a69d378efb4319a5b9ef8cf3d7a93030f5c863 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Ming Wang <wangming01@loongson.cn>
 | 
			
		||||
Date: Mon, 9 Jun 2025 11:03:02 +0800
 | 
			
		||||
Subject: [PATCH 4/5] Fix crash initialization failure on LoongArch with recent
 | 
			
		||||
 GDB versions
 | 
			
		||||
 | 
			
		||||
The crash tool failed to initialize on LoongArch64 when using
 | 
			
		||||
GDB 16.2 (and likely other recent GDB versions that have enhanced
 | 
			
		||||
LoongArch support) due to the error:
 | 
			
		||||
"fatal error: buffer size is not enough to fit register value".
 | 
			
		||||
 | 
			
		||||
This occurs in supply_registers() because GDB now correctly
 | 
			
		||||
reports the size of LoongArch LASX (256-bit) vector registers
 | 
			
		||||
(xr0-xr31) as 32 bytes. The `regval` buffer in `crash_target.c`
 | 
			
		||||
was previously fixed at 16 bytes.
 | 
			
		||||
 | 
			
		||||
This patch increases the `regval` buffer size to 32 bytes to
 | 
			
		||||
accommodate the largest LoongArch registers reported by GDB.
 | 
			
		||||
This allows crash to initialize successfully.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Ming Wang <wangming01@loongson.cn>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 crash_target.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/crash_target.c b/crash_target.c
 | 
			
		||||
index ad1480c9188f..49c6e88c5140 100644
 | 
			
		||||
--- a/crash_target.c
 | 
			
		||||
+++ b/crash_target.c
 | 
			
		||||
@@ -80,7 +80,7 @@ public:
 | 
			
		||||
 
 | 
			
		||||
 static void supply_registers(struct regcache *regcache, int regno)
 | 
			
		||||
 {
 | 
			
		||||
-  gdb_byte regval[16];
 | 
			
		||||
+  gdb_byte regval[32];
 | 
			
		||||
   struct gdbarch *arch = regcache->arch ();
 | 
			
		||||
   const char *regname = gdbarch_register_name(arch, regno);
 | 
			
		||||
   int regsize = register_size(arch, regno);
 | 
			
		||||
-- 
 | 
			
		||||
2.50.0
 | 
			
		||||
 | 
			
		||||
@ -1,171 +0,0 @@
 | 
			
		||||
From f2ee6fa6c841ddc37ba665909dafbc7294c34d64 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Fri, 17 Nov 2023 15:52:19 +0800
 | 
			
		||||
Subject: [PATCH 04/14] symbols: expand all kernel module symtable if not all
 | 
			
		||||
 expanded previously
 | 
			
		||||
 | 
			
		||||
There is an issue that, for kernel modules, "dis -rl" fails to display
 | 
			
		||||
modules code line number data after execute "bt" command in crash.
 | 
			
		||||
 | 
			
		||||
Without the patch:
 | 
			
		||||
  crsah> mod -S
 | 
			
		||||
  crash> bt
 | 
			
		||||
  PID: 1500     TASK: ff2bd8b093524000  CPU: 16   COMMAND: "lpfc_worker_0"
 | 
			
		||||
   #0 [ff2c9f725c39f9e0] machine_kexec at ffffffff8e0686d3
 | 
			
		||||
   ...snip...
 | 
			
		||||
   #8 [ff2c9f725c39fcc0] __lpfc_sli_release_iocbq_s4 at ffffffffc0f2f425 [lpfc]
 | 
			
		||||
   ...snip...
 | 
			
		||||
  crash> dis -rl ffffffffc0f60f82
 | 
			
		||||
  0xffffffffc0f60eb0 <lpfc_nlp_get>:      nopl   0x0(%rax,%rax,1) [FTRACE NOP]
 | 
			
		||||
  0xffffffffc0f60eb5 <lpfc_nlp_get+5>:    push   %rbp
 | 
			
		||||
  0xffffffffc0f60eb6 <lpfc_nlp_get+6>:    push   %rbx
 | 
			
		||||
  0xffffffffc0f60eb7 <lpfc_nlp_get+7>:    test   %rdi,%rdi
 | 
			
		||||
 | 
			
		||||
With the patch:
 | 
			
		||||
  crash> mod -S
 | 
			
		||||
  crash> bt
 | 
			
		||||
  PID: 1500     TASK: ff2bd8b093524000  CPU: 16   COMMAND: "lpfc_worker_0"
 | 
			
		||||
   #0 [ff2c9f725c39f9e0] machine_kexec at ffffffff8e0686d3
 | 
			
		||||
   ...snip...
 | 
			
		||||
   #8 [ff2c9f725c39fcc0] __lpfc_sli_release_iocbq_s4 at ffffffffc0f2f425 [lpfc]
 | 
			
		||||
   ...snip...
 | 
			
		||||
  crash> dis -rl ffffffffc0f60f82
 | 
			
		||||
  /usr/src/debug/kernel-4.18.0-425.13.1.el8_7/linux-4.18.0-425.13.1.el8_7.x86_64/drivers/scsi/lpfc/lpfc_hbadisc.c: 6756
 | 
			
		||||
  0xffffffffc0f60eb0 <lpfc_nlp_get>:      nopl   0x0(%rax,%rax,1) [FTRACE NOP]
 | 
			
		||||
  /usr/src/debug/kernel-4.18.0-425.13.1.el8_7/linux-4.18.0-425.13.1.el8_7.x86_64/drivers/scsi/lpfc/lpfc_hbadisc.c: 6759
 | 
			
		||||
  0xffffffffc0f60eb5 <lpfc_nlp_get+5>:    push   %rbp
 | 
			
		||||
 | 
			
		||||
The root cause is, after kernel module been loaded by mod command, the symtable
 | 
			
		||||
is not expanded in gdb side. crash bt or dis command will trigger such an
 | 
			
		||||
expansion. However the symtable expansion is different for the 2 commands:
 | 
			
		||||
 | 
			
		||||
The stack trace of "dis -rl" for symtable expanding:
 | 
			
		||||
 | 
			
		||||
  #0  0x00000000008d8d9f in add_compunit_symtab_to_objfile ...
 | 
			
		||||
  #1  0x00000000006d3293 in buildsym_compunit::end_symtab_with_blockvector ...
 | 
			
		||||
  #2  0x00000000006d336a in buildsym_compunit::end_symtab_from_static_block ...
 | 
			
		||||
  #3  0x000000000077e8e9 in process_full_comp_unit ...
 | 
			
		||||
  #4  process_queue ...
 | 
			
		||||
  #5  dw2_do_instantiate_symtab ...
 | 
			
		||||
  #6  0x000000000077ed67 in dw2_instantiate_symtab ...
 | 
			
		||||
  #7  0x000000000077f75e in dw2_expand_all_symtabs ...
 | 
			
		||||
  #8  0x00000000008f254d in gdb_get_line_number ...
 | 
			
		||||
  #9  0x00000000008f22af in gdb_command_funnel_1 ...
 | 
			
		||||
  #10 0x00000000008f2003 in gdb_command_funnel ...
 | 
			
		||||
  #11 0x00000000005b7f02 in gdb_interface ...
 | 
			
		||||
  #12 0x00000000005f5bd8 in get_line_number ...
 | 
			
		||||
  #13 0x000000000059e574 in cmd_dis ...
 | 
			
		||||
 | 
			
		||||
The stack trace of "bt" for symtable expanding:
 | 
			
		||||
 | 
			
		||||
  #0  0x00000000008d8d9f in add_compunit_symtab_to_objfile ...
 | 
			
		||||
  #1  0x00000000006d3293 in buildsym_compunit::end_symtab_with_blockvector ...
 | 
			
		||||
  #2  0x00000000006d336a in buildsym_compunit::end_symtab_from_static_block ...
 | 
			
		||||
  #3  0x000000000077e8e9 in process_full_comp_unit ...
 | 
			
		||||
  #4  process_queue ...
 | 
			
		||||
  #5  dw2_do_instantiate_symtab ...
 | 
			
		||||
  #6  0x000000000077ed67 in dw2_instantiate_symtab ...
 | 
			
		||||
  #7  0x000000000077f8ed in dw2_lookup_symbol ...
 | 
			
		||||
  #8  0x00000000008e6d03 in lookup_symbol_via_quick_fns ...
 | 
			
		||||
  #9  0x00000000008e7153 in lookup_symbol_in_objfile ...
 | 
			
		||||
  #10 0x00000000008e73c6 in lookup_symbol_global_or_static_iterator_cb ...
 | 
			
		||||
  #11 0x00000000008b99c4 in svr4_iterate_over_objfiles_in_search_order ...
 | 
			
		||||
  #12 0x00000000008e754e in lookup_global_or_static_symbol ...
 | 
			
		||||
  #13 0x00000000008e75da in lookup_static_symbol ...
 | 
			
		||||
  #14 0x00000000008e632c in lookup_symbol_aux ...
 | 
			
		||||
  #15 0x00000000008e5a7a in lookup_symbol_in_language ...
 | 
			
		||||
  #16 0x00000000008e5b30 in lookup_symbol ...
 | 
			
		||||
  #17 0x00000000008f2a4a in gdb_get_datatype ...
 | 
			
		||||
  #18 0x00000000008f22c0 in gdb_command_funnel_1 ...
 | 
			
		||||
  #19 0x00000000008f2003 in gdb_command_funnel ...
 | 
			
		||||
  #20 0x00000000005b7f02 in gdb_interface ...
 | 
			
		||||
  #21 0x00000000005f8a9f in datatype_info ...
 | 
			
		||||
  #22 0x0000000000599947 in cpu_map_size ...
 | 
			
		||||
  #23 0x00000000005a975d in get_cpus_online ...
 | 
			
		||||
  #24 0x0000000000637a8b in diskdump_get_prstatus_percpu ...
 | 
			
		||||
  #25 0x000000000062f0e4 in get_netdump_regs_x86_64 ...
 | 
			
		||||
  #26 0x000000000059fe68 in back_trace ...
 | 
			
		||||
  #27 0x00000000005ab1cb in cmd_bt ...
 | 
			
		||||
 | 
			
		||||
For the stacktrace of "dis -rl", it calls dw2_expand_all_symtabs() to expand
 | 
			
		||||
all symtable of the objfile, or "*.ko.debug" in our case. However for
 | 
			
		||||
the stacktrace of "bt", it doesn't expand all, but only a subset of symtable
 | 
			
		||||
which is enough to find a symbol by dw2_lookup_symbol(). As a result, the
 | 
			
		||||
objfile->compunit_symtabs, which is the head of a single linked list of
 | 
			
		||||
struct compunit_symtab, is not NULL but didn't contain all symtables. It
 | 
			
		||||
will not be reinitialized in gdb_get_line_number() by "dis -rl" because
 | 
			
		||||
!objfile_has_full_symbols(objfile) check will fail, so it cannot display
 | 
			
		||||
the proper code line number data.
 | 
			
		||||
 | 
			
		||||
Since objfile_has_full_symbols(objfile) check cannot ensure all symbols
 | 
			
		||||
been expanded, this patch add a new member as a flag for struct objfile
 | 
			
		||||
to record if all symbols have been expanded. The flag will be set only ofter
 | 
			
		||||
expand_all_symtabs been called.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 gdb-10.2.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 50 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
 | 
			
		||||
index d81030d946e8..2f7d585105aa 100644
 | 
			
		||||
--- a/gdb-10.2.patch
 | 
			
		||||
+++ b/gdb-10.2.patch
 | 
			
		||||
@@ -3187,3 +3187,53 @@ exit 0
 | 
			
		||||
        result = stringtab + symbol_entry->_n._n_n._n_offset;
 | 
			
		||||
      }
 | 
			
		||||
    else
 | 
			
		||||
+--- gdb-10.2/gdb/objfiles.h.orig
 | 
			
		||||
++++ gdb-10.2/gdb/objfiles.h
 | 
			
		||||
+@@ -712,6 +712,8 @@ struct objfile
 | 
			
		||||
+      next time.  If an objfile does not have the symbols, it will
 | 
			
		||||
+      never have them.  */
 | 
			
		||||
+   bool skip_jit_symbol_lookup = false;
 | 
			
		||||
++
 | 
			
		||||
++  bool all_symtabs_expanded = false;
 | 
			
		||||
+ };
 | 
			
		||||
+ 
 | 
			
		||||
+ /* A deleter for objfile.  */
 | 
			
		||||
+--- gdb-10.2/gdb/symfile.c.orig
 | 
			
		||||
++++ gdb-10.2/gdb/symfile.c
 | 
			
		||||
+@@ -1133,8 +1133,10 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
 | 
			
		||||
+ 	printf_filtered (_("Expanding full symbols from %ps...\n"),
 | 
			
		||||
+ 			 styled_string (file_name_style.style (), name));
 | 
			
		||||
+ 
 | 
			
		||||
+-      if (objfile->sf)
 | 
			
		||||
++      if (objfile->sf) {
 | 
			
		||||
+ 	objfile->sf->qf->expand_all_symtabs (objfile);
 | 
			
		||||
++	objfile->all_symtabs_expanded = true;
 | 
			
		||||
++      }
 | 
			
		||||
+     }
 | 
			
		||||
+ 
 | 
			
		||||
+   /* Note that we only print a message if we have no symbols and have
 | 
			
		||||
+--- gdb-10.2/gdb/symtab.c.orig
 | 
			
		||||
++++ gdb-10.2/gdb/symtab.c
 | 
			
		||||
+@@ -7097,8 +7097,9 @@ gdb_get_line_number(struct gnu_request *req)
 | 
			
		||||
+                  */
 | 
			
		||||
+                 if (req->lm) {
 | 
			
		||||
+                         objfile = req->lm->loaded_objfile;
 | 
			
		||||
+-                        if (!objfile_has_full_symbols(objfile) && objfile->sf) {
 | 
			
		||||
++                        if (!objfile->all_symtabs_expanded && objfile->sf) {
 | 
			
		||||
+                                 objfile->sf->qf->expand_all_symtabs(objfile);
 | 
			
		||||
++                                objfile->all_symtabs_expanded = true;
 | 
			
		||||
+                                 sal = find_pc_line(pc, 0);
 | 
			
		||||
+                         }
 | 
			
		||||
+                 }
 | 
			
		||||
+@@ -7761,8 +7765,10 @@ iterate_datatypes (struct gnu_request *req)
 | 
			
		||||
+ {
 | 
			
		||||
+   for (objfile *objfile : current_program_space->objfiles ())
 | 
			
		||||
+     {
 | 
			
		||||
+-      if (objfile->sf)
 | 
			
		||||
++      if (objfile->sf) {
 | 
			
		||||
+         objfile->sf->qf->expand_all_symtabs(objfile);
 | 
			
		||||
++        objfile->all_symtabs_expanded = true;
 | 
			
		||||
++      }
 | 
			
		||||
+ 
 | 
			
		||||
+       for (compunit_symtab *cust : objfile->compunits ())
 | 
			
		||||
+         {
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,93 @@
 | 
			
		||||
From 2c69f93e59c6b2efac5bae9f7891dbe1e0094fdd Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Shivang Upadhyay <shivangu@linux.ibm.com>
 | 
			
		||||
Date: Mon, 21 Jul 2025 13:47:33 +0530
 | 
			
		||||
Subject: [PATCH 5/5] gdb: Disable DT_DEBUG lookup by GDB inside the vmcore
 | 
			
		||||
 | 
			
		||||
Crash with GDB 16.2, the following warnings are printed:
 | 
			
		||||
 | 
			
		||||
crash>
 | 
			
		||||
crash: page excluded: kernel virtual address: c0000000022d6098  type: "gdb_readmem_callback"
 | 
			
		||||
crash: page excluded: kernel virtual address: c0000000022d6098  type: "gdb_readmem_callback"
 | 
			
		||||
 | 
			
		||||
This occurs because the elf_locate_base function in GDB 16.2
 | 
			
		||||
attempts to read the address of the dynamic linker runtime
 | 
			
		||||
structure, which is present in the .dynamic section of the
 | 
			
		||||
executable. However, this section may be excluded from the
 | 
			
		||||
dump by makedumpfile.
 | 
			
		||||
 | 
			
		||||
The repeated calls to elf_locate_base were introduced by gdb
 | 
			
		||||
commit [1] aebb370 ("gdb, solib-svr4: support namespaces in
 | 
			
		||||
DSO iteration") via svr4_iterate_over_objfiles_in_search_order.
 | 
			
		||||
 | 
			
		||||
To check whether the kernel includes DT_DEBUG information,
 | 
			
		||||
prints were added inside crash::xfer_partial, which is
 | 
			
		||||
called through elf_locate_base when reading from vmcore.
 | 
			
		||||
Even when running crash on /proc/kcore, all output data was
 | 
			
		||||
zero. This confirms that DT_DEBUG information is never
 | 
			
		||||
present in the kernel image.
 | 
			
		||||
 | 
			
		||||
`mod -S` continues to function correctly after the following
 | 
			
		||||
patch:
 | 
			
		||||
 | 
			
		||||
...
 | 
			
		||||
crash> mod -S
 | 
			
		||||
Enable debuginfod for this session? (y or [n])
 | 
			
		||||
     MODULE       NAME                             TEXT_BASE         SIZE  OBJECT FILE
 | 
			
		||||
c0080000004a0300  dm_log                        c008000000480000   196608  XXX/lib/modules/5.14.0-592.el9.ppc64le/kernel/drivers/md/dm-log.ko
 | 
			
		||||
c0080000006d1100  sd_mod                        c008000000580000   196608  XXX/lib/modules/5.14.0-592.el9.ppc64le/kernel/drivers/scsi/sd_mod.ko
 | 
			
		||||
c0080000005c0080  dm_region_hash                c0080000005a0000   196608  XXX/lib/modules/5.14.0-592.el9.ppc64le/kernel/drivers/md/dm-region-hash.ko
 | 
			
		||||
c008000000770700  sg                            c008000000620000   262144  XXX/lib/modules/5.14.0-592.el9.ppc64le/kernel/drivers/scsi/sg.ko
 | 
			
		||||
c008000000660500  dm_mirror                     c008000000640000   196608  XXX/lib/modules/5.14.0-592.el9.ppc64le/kernel/drivers/md/dm-mirror.ko
 | 
			
		||||
...
 | 
			
		||||
 | 
			
		||||
Commit e906eaca2b1a ("Fix the issue of "page excluded"
 | 
			
		||||
messages flooding") attempted fix this by suppressing these
 | 
			
		||||
warnings for regular users, but the warnings still appear
 | 
			
		||||
when crash is started in debug mode.
 | 
			
		||||
 | 
			
		||||
To fix this, remove the DT_DEBUG read call, from the
 | 
			
		||||
elf_locate_base function in GDB that tries to read the
 | 
			
		||||
.dynamic section, as this information is not useful for
 | 
			
		||||
debugging kernel images in either dump or live kernel
 | 
			
		||||
scenarios.
 | 
			
		||||
 | 
			
		||||
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aebb370
 | 
			
		||||
 | 
			
		||||
Cc: Tao liu <ltao@redhat.com>
 | 
			
		||||
Cc: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
 | 
			
		||||
Signed-off-by: shivang.upadhyay <shivangu@linux.ibm.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 gdb-16.2.patch | 18 ++++++++++++++++++
 | 
			
		||||
 1 file changed, 18 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/gdb-16.2.patch b/gdb-16.2.patch
 | 
			
		||||
index 9d056580b2f7..6767bf7d7bf0 100644
 | 
			
		||||
--- a/gdb-16.2.patch
 | 
			
		||||
+++ b/gdb-16.2.patch
 | 
			
		||||
@@ -1982,3 +1982,21 @@ exit 0
 | 
			
		||||
                                  req->tagname = (char *)TYPE_TAG_NAME(type);
 | 
			
		||||
                                  if (!req->tagname) {
 | 
			
		||||
                                          val = expr->evaluate_type();
 | 
			
		||||
+--- gdb-16.2/gdb/solib-svr4.c.orig
 | 
			
		||||
++++ gdb-16.2/gdb/solib-svr4.c
 | 
			
		||||
+@@ -741,13 +741,13 @@
 | 
			
		||||
+ 	return 0;
 | 
			
		||||
+       return extract_typed_address (pbuf, ptr_type);
 | 
			
		||||
+     }
 | 
			
		||||
+-
 | 
			
		||||
++#ifndef CRASH_MERGE
 | 
			
		||||
+   /* Find DT_DEBUG.  */
 | 
			
		||||
+   if (gdb_bfd_scan_elf_dyntag (DT_DEBUG, current_program_space->exec_bfd (),
 | 
			
		||||
+ 			       &dyn_ptr, NULL)
 | 
			
		||||
+       || scan_dyntag_auxv (DT_DEBUG, &dyn_ptr, NULL))
 | 
			
		||||
+     return dyn_ptr;
 | 
			
		||||
+-
 | 
			
		||||
++#endif
 | 
			
		||||
+   /* This may be a static executable.  Look for the symbol
 | 
			
		||||
+      conventionally named _r_debug, as a last resort.  */
 | 
			
		||||
+   bound_minimal_symbol msymbol
 | 
			
		||||
-- 
 | 
			
		||||
2.50.0
 | 
			
		||||
 | 
			
		||||
@ -1,67 +0,0 @@
 | 
			
		||||
From 0c5ef6a4a3a2759915ffe72b1366dce2f32f65c5 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Tue, 14 Nov 2023 16:32:07 +0800
 | 
			
		||||
Subject: [PATCH 05/14] symbols: skip load .init.* sections if module was
 | 
			
		||||
 successfully initialized
 | 
			
		||||
 | 
			
		||||
There might be address overlap of one modules .init.text symbols and
 | 
			
		||||
another modules .text symbols. As a result, gdb fails to translate the
 | 
			
		||||
address to symbol name correctly:
 | 
			
		||||
 | 
			
		||||
  crash> sym -m virtio_blk | grep MODULE
 | 
			
		||||
  ffffffffc00a4000 MODULE START: virtio_blk
 | 
			
		||||
  ffffffffc00a86ec MODULE END: virtio_blk
 | 
			
		||||
  crash> gdb info address floppy_module_init
 | 
			
		||||
  Symbol "floppy_module_init" is a function at address 0xffffffffc00a4131.
 | 
			
		||||
 | 
			
		||||
Since the .init.* sections of a module had been freed by kernel if the
 | 
			
		||||
module was initialized successfully, there is no need to load the .init.*
 | 
			
		||||
sections data from "*.ko.debug" in gdb to create such an overlap.
 | 
			
		||||
lm->mod_init_module_ptr is used as a flag of whether module is freed.
 | 
			
		||||
 | 
			
		||||
Without the patch:
 | 
			
		||||
  crash> mod -S
 | 
			
		||||
  crash> struct blk_mq_ops 0xffffffffc00a7160
 | 
			
		||||
  struct blk_mq_ops {
 | 
			
		||||
    queue_rq = 0xffffffffc00a45b0 <floppy_module_init+1151>, <-- translated from module floppy
 | 
			
		||||
    map_queue = 0xffffffff813015c0 <blk_mq_map_queue>,
 | 
			
		||||
    ...snip...
 | 
			
		||||
    complete = 0xffffffffc00a4370 <floppy_module_init+575>,
 | 
			
		||||
    init_request = 0xffffffffc00a4260 <floppy_module_init+303>,
 | 
			
		||||
    ...snip...
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
With the patch:
 | 
			
		||||
  crash> mod -S
 | 
			
		||||
  crash> struct blk_mq_ops 0xffffffffc00a7160
 | 
			
		||||
  struct blk_mq_ops {
 | 
			
		||||
    queue_rq = 0xffffffffc00a45b0 <virtio_queue_rq>, <-- translated from module virtio_blk
 | 
			
		||||
    map_queue = 0xffffffff813015c0 <blk_mq_map_queue>,
 | 
			
		||||
    ...snip...
 | 
			
		||||
    complete = 0xffffffffc00a4370 <virtblk_request_done>,
 | 
			
		||||
    init_request = 0xffffffffc00a4260 <virtblk_init_request>,
 | 
			
		||||
    ...snip...
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 symbols.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/symbols.c b/symbols.c
 | 
			
		||||
index 176c95026f03..5d919910164e 100644
 | 
			
		||||
--- a/symbols.c
 | 
			
		||||
+++ b/symbols.c
 | 
			
		||||
@@ -13295,7 +13295,7 @@ add_symbol_file_kallsyms(struct load_module *lm, struct gnu_request *req)
 | 
			
		||||
 			shift_string_right(req->buf, strlen(buf));
 | 
			
		||||
 			BCOPY(buf, req->buf, strlen(buf));
 | 
			
		||||
 			retval = TRUE;
 | 
			
		||||
-		} else {
 | 
			
		||||
+		} else if (lm->mod_init_module_ptr || !STRNEQ(section_name, ".init.")) {
 | 
			
		||||
 			sprintf(buf, " -s %s 0x%lx", section_name, section_vaddr);
 | 
			
		||||
 			while ((len + strlen(buf)) >= buflen) {
 | 
			
		||||
 				RESIZEBUF(req->buf, buflen, buflen * 2);
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										237
									
								
								SOURCES/0005-x86_64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										237
									
								
								SOURCES/0005-x86_64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,237 @@
 | 
			
		||||
From 7b488818107fff9f92e9778749d0046f2024e6af Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 25 Jun 2025 16:02:01 +1200
 | 
			
		||||
Subject: [PATCH 5/9] x86_64: Add gdb multi-stack unwind support
 | 
			
		||||
 | 
			
		||||
Whenever extra stack is found, a user_regs structure is allocated and
 | 
			
		||||
regs value copied there. Later the values will be retrived by
 | 
			
		||||
get_current_task_reg() by given the thread's tid, aka the index of
 | 
			
		||||
stack.
 | 
			
		||||
 | 
			
		||||
Co-developed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Co-developed-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 x86_64.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 | 
			
		||||
 1 file changed, 125 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/x86_64.c b/x86_64.c
 | 
			
		||||
index ee23d8b5e41e..cfefe3f80c4f 100644
 | 
			
		||||
--- a/x86_64.c
 | 
			
		||||
+++ b/x86_64.c
 | 
			
		||||
@@ -3508,6 +3508,8 @@ x86_64_exception_RIP_message(struct bt_info *bt, ulong rip)
 | 
			
		||||
 #define STACK_TRANSITION_ERRMSG_I_P \
 | 
			
		||||
 "cannot transition from IRQ stack to current process stack:\n        IRQ stack pointer: %lx\n    process stack pointer: %lx\n       current stack base: %lx\n"
 | 
			
		||||
 
 | 
			
		||||
+#define SET_REG_BITMAP(REGMAP, TYPE, MEMBER) \
 | 
			
		||||
+	SET_BIT(REGMAP, REG_SEQ(TYPE, MEMBER))
 | 
			
		||||
 /*
 | 
			
		||||
  *  Low-budget back tracer -- dump text return addresses, following call chain
 | 
			
		||||
  *  when possible, along with any verifiable exception frames.
 | 
			
		||||
@@ -3528,6 +3530,7 @@ x86_64_low_budget_back_trace_cmd(struct bt_info *bt_in)
 | 
			
		||||
 	ulong last_process_stack_eframe;
 | 
			
		||||
 	ulong user_mode_eframe;
 | 
			
		||||
 	char *rip_symbol;
 | 
			
		||||
+	char buf[BUFSIZE];
 | 
			
		||||
 
 | 
			
		||||
         /*
 | 
			
		||||
          *  User may have made a run-time switch.
 | 
			
		||||
@@ -3551,6 +3554,7 @@ x86_64_low_budget_back_trace_cmd(struct bt_info *bt_in)
 | 
			
		||||
 	irq_eframe = 0;
 | 
			
		||||
 	last_process_stack_eframe = 0;
 | 
			
		||||
 	bt->call_target = NULL;
 | 
			
		||||
+	extra_stacks_idx = 0;
 | 
			
		||||
 	rsp = bt->stkptr;
 | 
			
		||||
 	ms = machdep->machspec;
 | 
			
		||||
 
 | 
			
		||||
@@ -3632,6 +3636,90 @@ x86_64_low_budget_back_trace_cmd(struct bt_info *bt_in)
 | 
			
		||||
 		level++;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (is_task_active(bt->task) && bt->flags & BT_DUMPFILE_SEARCH) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] =
 | 
			
		||||
+				(struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		extra_stacks_regs[extra_stacks_idx]->ur.ip = bt->instptr;
 | 
			
		||||
+		extra_stacks_regs[extra_stacks_idx]->ur.sp = bt->stkptr + 8;
 | 
			
		||||
+		SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			x86_64_user_regs_struct, ip);
 | 
			
		||||
+		SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			x86_64_user_regs_struct, sp);
 | 
			
		||||
+
 | 
			
		||||
+		/* Sometimes bp is needed for stack unwinding, so we try to get
 | 
			
		||||
+		   it. The bt->instptr usually points to a inst after a call
 | 
			
		||||
+		   inst, let's check the previous call inst. Note the call inst
 | 
			
		||||
+		   len is 5 */
 | 
			
		||||
+		open_tmpfile2();
 | 
			
		||||
+		sprintf(buf, "x/1i 0x%lx", bt->instptr - 5);
 | 
			
		||||
+		gdb_pass_through(buf, pc->tmpfile2, GNU_RETURN_ON_ERROR);
 | 
			
		||||
+		rewind(pc->tmpfile2);
 | 
			
		||||
+		fgets(buf, BUFSIZE, pc->tmpfile2);
 | 
			
		||||
+		if (strstr(buf, "call")) {
 | 
			
		||||
+			if (strstr(buf, "<relocate_range>") ||
 | 
			
		||||
+			    strstr(buf, "<relocate_kernel>")) {
 | 
			
		||||
+				/* OK, we are calling relocate_kernel(), which
 | 
			
		||||
+				 * is written in assembly and hasn't changed for
 | 
			
		||||
+				 * years, so we get some extra regs out of it. */
 | 
			
		||||
+				readmem(bt->stkptr - sizeof(ulong) * 6, KVADDR, buf,
 | 
			
		||||
+					sizeof(ulong) * 6, "relocate_kernel", FAULT_ON_ERROR);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.r15 =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 0);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.r14 =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 1);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.r13 =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 2);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.r12 =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 3);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.bp =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 4);
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx]->ur.bx =
 | 
			
		||||
+					*(ulong *)(buf + sizeof(ulong) * 5);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, r15);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, r14);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, r13);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, r12);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, bp);
 | 
			
		||||
+				SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+					x86_64_user_regs_struct, bx);
 | 
			
		||||
+			} else {
 | 
			
		||||
+				/* This is a try-best effort. Usually the call
 | 
			
		||||
+				   inst will result in a next-inst addr pushed
 | 
			
		||||
+				   in and a rbp push of the calling function.
 | 
			
		||||
+				   So we can get rbp here */
 | 
			
		||||
+				readmem(extra_stacks_regs[extra_stacks_idx]->ur.sp
 | 
			
		||||
+					- sizeof(ulong) * 2, KVADDR,
 | 
			
		||||
+					&extra_stacks_regs[extra_stacks_idx]->ur.bp,
 | 
			
		||||
+					sizeof(ulong), "extra_stacks_regs.bp", FAULT_ON_ERROR);
 | 
			
		||||
+				if (INSTACK(extra_stacks_regs[extra_stacks_idx]->ur.bp, bt)) {
 | 
			
		||||
+					SET_REG_BITMAP(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+						x86_64_user_regs_struct, bp);
 | 
			
		||||
+					extra_stacks_regs[extra_stacks_idx]->ur.ip -= 5;
 | 
			
		||||
+				}
 | 
			
		||||
+			}
 | 
			
		||||
+		}
 | 
			
		||||
+		close_tmpfile2();
 | 
			
		||||
+		/*
 | 
			
		||||
+		 * bt->machdep is handled at x86_64_get_stack_frame(), so skip it
 | 
			
		||||
+		 */
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.sp !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.sp &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.ip !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.ip)) {
 | 
			
		||||
+			gdb_add_substack(extra_stacks_idx++);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
 
 | 
			
		||||
         if ((estack = x86_64_in_exception_stack(bt, &estack_index))) {
 | 
			
		||||
 in_exception_stack:
 | 
			
		||||
@@ -4159,6 +4247,7 @@ x86_64_dwarf_back_trace_cmd(struct bt_info *bt_in)
 | 
			
		||||
 	last_process_stack_eframe = 0;
 | 
			
		||||
 	bt->call_target = NULL;
 | 
			
		||||
 	bt->bptr = 0;
 | 
			
		||||
+	extra_stacks_idx = 0;
 | 
			
		||||
 	rsp = bt->stkptr;
 | 
			
		||||
 	if (!rsp) {
 | 
			
		||||
 		error(INFO, "cannot determine starting stack pointer\n");
 | 
			
		||||
@@ -4799,6 +4888,31 @@ x86_64_exception_frame(ulong flags, ulong kvaddr, char *local,
 | 
			
		||||
 	} else if (machdep->flags & ORC)
 | 
			
		||||
 		bt->bptr = rbp;
 | 
			
		||||
 
 | 
			
		||||
+	/*
 | 
			
		||||
+	* Preserve registers set for each additional in-kernel stack
 | 
			
		||||
+	*/
 | 
			
		||||
+	if (!(cs & 3) && verified && flags & EFRAME_PRINT &&
 | 
			
		||||
+	    extra_stacks_idx < MAX_EXCEPTION_STACKS &&
 | 
			
		||||
+	    !(bt->flags & BT_EFRAME_SEARCH)) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] = (struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		memcpy(&extra_stacks_regs[extra_stacks_idx]->ur,
 | 
			
		||||
+			pt_regs_buf, SIZE(pt_regs));
 | 
			
		||||
+		for (int i = 0; i < SIZE(pt_regs)/sizeof(long); i++)
 | 
			
		||||
+			SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap, i);
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.sp !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.sp &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.ip !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.ip)) {
 | 
			
		||||
+			gdb_add_substack(extra_stacks_idx++);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	if (kvaddr)
 | 
			
		||||
 		FREEBUF(pt_regs_buf);
 | 
			
		||||
 
 | 
			
		||||
@@ -5002,9 +5116,6 @@ get_reg_from_inactive_task_frame(struct bt_info *bt, char *reg_name,
 | 
			
		||||
 	return reg_value;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-#define SET_REG_BITMAP(REGMAP, TYPE, MEMBER) \
 | 
			
		||||
-	SET_BIT(REGMAP, REG_SEQ(TYPE, MEMBER))
 | 
			
		||||
-
 | 
			
		||||
 /*
 | 
			
		||||
  *  Get a stack frame combination of pc and ra from the most relevent spot.
 | 
			
		||||
  */
 | 
			
		||||
@@ -9221,7 +9332,8 @@ x86_64_get_kvaddr_ranges(struct vaddr_range *vrp)
 | 
			
		||||
 	case R##_REGNUM: \
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap, \
 | 
			
		||||
 			REG_SEQ(x86_64_user_regs_struct, r))) { \
 | 
			
		||||
-			FREEBUF(ur_bitmap); \
 | 
			
		||||
+			if (!sid) \
 | 
			
		||||
+				FREEBUF(ur_bitmap); \
 | 
			
		||||
 			return FALSE; \
 | 
			
		||||
 		} \
 | 
			
		||||
 		break;
 | 
			
		||||
@@ -9256,6 +9368,12 @@ x86_64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
 	if (!tc)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
 
 | 
			
		||||
+	/* Non zero stack ID, use extra stacks regs */
 | 
			
		||||
+	if (sid && sid <= extra_stacks_idx) {
 | 
			
		||||
+		ur_bitmap = extra_stacks_regs[sid - 1];
 | 
			
		||||
+		goto get_sub;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	/*
 | 
			
		||||
 	* Task is active, grab CPU's registers
 | 
			
		||||
 	*/
 | 
			
		||||
@@ -9280,6 +9398,7 @@ x86_64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	/* Get subset registers from stack frame*/
 | 
			
		||||
+get_sub:
 | 
			
		||||
 	switch (regno) {
 | 
			
		||||
 		CHECK_REG_CASE(RAX,   ax);
 | 
			
		||||
 		CHECK_REG_CASE(RBX,   bx);
 | 
			
		||||
@@ -9341,7 +9460,7 @@ get_all:
 | 
			
		||||
 		COPY_REG_CASE(ORIG_RAX, orig_ax);
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	if (bt_info.need_free) {
 | 
			
		||||
+	if (!sid && bt_info.need_free) {
 | 
			
		||||
 		FREEBUF(ur_bitmap);
 | 
			
		||||
 		bt_info.need_free = FALSE;
 | 
			
		||||
 	}
 | 
			
		||||
@@ -9805,4 +9924,4 @@ x86_64_swp_offset(ulong entry)
 | 
			
		||||
 	return SWP_OFFSET(entry);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
-#endif  /* X86_64 */ 
 | 
			
		||||
+#endif  /* X86_64 */
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										181
									
								
								SOURCES/0006-arm64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								SOURCES/0006-arm64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,181 @@
 | 
			
		||||
From 08271e45e4ea6263fc2957d1e876becd6cfc1a0d Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 25 Jun 2025 16:02:02 +1200
 | 
			
		||||
Subject: [PATCH 6/9] arm64: Add gdb multi-stack unwind support
 | 
			
		||||
 | 
			
		||||
Co-developed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Co-developed-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 arm64.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 | 
			
		||||
 1 file changed, 92 insertions(+), 4 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arm64.c b/arm64.c
 | 
			
		||||
index 829130158902..354d17ab6a19 100644
 | 
			
		||||
--- a/arm64.c
 | 
			
		||||
+++ b/arm64.c
 | 
			
		||||
@@ -226,6 +226,12 @@ arm64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
 	tc = CURRENT_CONTEXT();
 | 
			
		||||
 	if (!tc)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
+
 | 
			
		||||
+	if (sid && sid <= extra_stacks_idx) {
 | 
			
		||||
+		ur_bitmap = extra_stacks_regs[extra_stacks_idx - 1];
 | 
			
		||||
+		goto get_sub;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	BZERO(&bt_setup, sizeof(struct bt_info));
 | 
			
		||||
 	clone_bt_info(&bt_setup, &bt_info, tc);
 | 
			
		||||
 	fill_stackbuf(&bt_info);
 | 
			
		||||
@@ -241,25 +247,29 @@ arm64_get_current_task_reg(int regno, const char *name,
 | 
			
		||||
 		goto get_all;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+get_sub:
 | 
			
		||||
 	switch (regno) {
 | 
			
		||||
 	case X0_REGNUM ... X30_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(arm64_pt_regs, regs[0]) + regno - X0_REGNUM)) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case SP_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(arm64_pt_regs, sp))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PC_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(arm64_pt_regs, pc))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
@@ -287,7 +297,7 @@ get_all:
 | 
			
		||||
 		break;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-	if (bt_info.need_free) {
 | 
			
		||||
+	if (!sid && bt_info.need_free) {
 | 
			
		||||
 		FREEBUF(ur_bitmap);
 | 
			
		||||
 		bt_info.need_free = FALSE;
 | 
			
		||||
 	}
 | 
			
		||||
@@ -3680,6 +3690,7 @@ arm64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
 	int level;
 | 
			
		||||
 	ulong exception_frame;
 | 
			
		||||
 	FILE *ofp;
 | 
			
		||||
+	extra_stacks_idx = 0;
 | 
			
		||||
 
 | 
			
		||||
 	if (bt->flags & BT_OPT_BACK_TRACE) {
 | 
			
		||||
 		if (machdep->flags & UNW_4_14) {
 | 
			
		||||
@@ -3733,6 +3744,35 @@ arm64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
 		stackframe.fp = bt->frameptr;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (is_task_active(bt->task)) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] = (struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		if (bt->task != tt->panic_task && stackframe.sp) {
 | 
			
		||||
+			readmem(stackframe.sp - 8, KVADDR, &extra_stacks_regs[extra_stacks_idx]->ur.pc,
 | 
			
		||||
+				sizeof(ulong), "extra_stacks_regs.pc", RETURN_ON_ERROR);
 | 
			
		||||
+			readmem(stackframe.sp - 16, KVADDR, &extra_stacks_regs[extra_stacks_idx]->ur.sp,
 | 
			
		||||
+				sizeof(ulong), "extra_stacks_regs.sp", RETURN_ON_ERROR);
 | 
			
		||||
+		} else {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx]->ur.pc = stackframe.pc;
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx]->ur.sp = stackframe.sp;
 | 
			
		||||
+		}
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(arm64_pt_regs, pc));
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(arm64_pt_regs, sp));
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.sp !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.sp &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.pc !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.pc)) {
 | 
			
		||||
+			gdb_add_substack (extra_stacks_idx++);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	if (bt->flags & BT_TEXT_SYMBOLS) {
 | 
			
		||||
 		arm64_print_text_symbols(bt, &stackframe, ofp);
 | 
			
		||||
                 if (BT_REFERENCE_FOUND(bt)) {
 | 
			
		||||
@@ -3854,6 +3894,35 @@ arm64_back_trace_cmd_v2(struct bt_info *bt)
 | 
			
		||||
 		stackframe.fp = bt->frameptr;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	if (is_task_active(bt->task)) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] = (struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		if (bt->task != tt->panic_task && stackframe.sp) {
 | 
			
		||||
+			readmem(stackframe.sp - 8, KVADDR, &extra_stacks_regs[extra_stacks_idx]->ur.pc,
 | 
			
		||||
+				sizeof(ulong), "extra_stacks_regs.pc", RETURN_ON_ERROR);
 | 
			
		||||
+			readmem(stackframe.sp - 16, KVADDR, &extra_stacks_regs[extra_stacks_idx]->ur.sp,
 | 
			
		||||
+				sizeof(ulong), "extra_stacks_regs.sp", RETURN_ON_ERROR);
 | 
			
		||||
+		} else {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx]->ur.pc = stackframe.pc;
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx]->ur.sp = stackframe.sp;
 | 
			
		||||
+		}
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(arm64_pt_regs, pc));
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(arm64_pt_regs, sp));
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.sp !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.sp &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.pc !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.pc)) {
 | 
			
		||||
+			gdb_add_substack (extra_stacks_idx++);
 | 
			
		||||
+		}		
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	if (bt->flags & BT_TEXT_SYMBOLS) {
 | 
			
		||||
 		arm64_print_text_symbols(bt, &stackframe, ofp);
 | 
			
		||||
                 if (BT_REFERENCE_FOUND(bt)) {
 | 
			
		||||
@@ -4468,6 +4537,25 @@ arm64_print_exception_frame(struct bt_info *bt, ulong pt_regs, int mode, FILE *o
 | 
			
		||||
 			fprintf(ofp, "ORIG_X0: %016lx  SYSCALLNO: %lx",
 | 
			
		||||
 				(ulong)regs->orig_x0, (ulong)regs->syscallno);
 | 
			
		||||
 			fprintf(ofp, "  PSTATE: %08lx\n", (ulong)regs->pstate);
 | 
			
		||||
+		} else if (!(bt->flags & BT_EFRAME_SEARCH)) {
 | 
			
		||||
+			if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+				extra_stacks_regs[extra_stacks_idx] =
 | 
			
		||||
+					(struct user_regs_bitmap_struct *)
 | 
			
		||||
+					malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+			}
 | 
			
		||||
+			memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+				sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+			memcpy(&extra_stacks_regs[extra_stacks_idx]->ur, regs,
 | 
			
		||||
+				sizeof(struct arm64_pt_regs));
 | 
			
		||||
+			for (int i = 0; i < sizeof(struct arm64_pt_regs)/sizeof(long); i++)
 | 
			
		||||
+				SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap, i);
 | 
			
		||||
+			if (!bt->machdep ||
 | 
			
		||||
+			     (extra_stacks_regs[extra_stacks_idx]->ur.sp !=
 | 
			
		||||
+			      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.sp &&
 | 
			
		||||
+			      extra_stacks_regs[extra_stacks_idx]->ur.pc !=
 | 
			
		||||
+			      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.pc)) {
 | 
			
		||||
+				gdb_add_substack (extra_stacks_idx++);
 | 
			
		||||
+			}			
 | 
			
		||||
 		}
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -1,47 +0,0 @@
 | 
			
		||||
From c15da07526291a5c357010cb4aaf4bde6151e642 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Johan Erlandsson <johan.erlandsson@sony.com>
 | 
			
		||||
Date: Wed, 19 Apr 2023 11:26:04 +0200
 | 
			
		||||
Subject: [PATCH 06/14] use NR_SWAPCACHE when nr_swapper_spaces isn't available
 | 
			
		||||
 | 
			
		||||
In 5.12 the following change was introduced:
 | 
			
		||||
b6038942480e ("mm: memcg: add swapcache stat for memcg v2")
 | 
			
		||||
 | 
			
		||||
Then the variable 'nr_swapper_spaces' is not read (unless
 | 
			
		||||
CONFIG_DEBUG_VM=y).  In GKI builds this variable is then optimized
 | 
			
		||||
out. But the same change provided a new way to obtain the same
 | 
			
		||||
information, using NR_SWAPCACHE.
 | 
			
		||||
 | 
			
		||||
Reported-by: xueguolun <xueguolun@xiaomi.com>
 | 
			
		||||
Signed-off-by: Johan Erlandsson <johan.erlandsson@sony.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 memory.c | 6 ++++--
 | 
			
		||||
 1 file changed, 4 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/memory.c b/memory.c
 | 
			
		||||
index 791194a405d4..b84e974a3325 100644
 | 
			
		||||
--- a/memory.c
 | 
			
		||||
+++ b/memory.c
 | 
			
		||||
@@ -8486,7 +8486,7 @@ dump_kmeminfo(void)
 | 
			
		||||
 	ulong hugetlb_total_pages, hugetlb_total_free_pages = 0;
 | 
			
		||||
 	int done_hugetlb_calc = 0; 
 | 
			
		||||
 	long nr_file_pages, nr_slab;
 | 
			
		||||
-	ulong swapper_space_nrpages;
 | 
			
		||||
+	long swapper_space_nrpages;
 | 
			
		||||
 	ulong pct;
 | 
			
		||||
 	uint tmp;
 | 
			
		||||
 	struct meminfo meminfo;
 | 
			
		||||
@@ -8609,7 +8609,9 @@ dump_kmeminfo(void)
 | 
			
		||||
 		char *swapper_space = GETBUF(SIZE(address_space));
 | 
			
		||||
 
 | 
			
		||||
 		swapper_space_nrpages = 0;
 | 
			
		||||
-		if (symbol_exists("nr_swapper_spaces") &&
 | 
			
		||||
+		if (dump_vm_stat("NR_SWAPCACHE", &swapper_space_nrpages, 0)) {
 | 
			
		||||
+			;
 | 
			
		||||
+		} else if (symbol_exists("nr_swapper_spaces") &&
 | 
			
		||||
 			(len = get_array_length("nr_swapper_spaces",
 | 
			
		||||
 				NULL, 0))) {
 | 
			
		||||
 			char *nr_swapper_space =
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,43 +0,0 @@
 | 
			
		||||
From 2e513114e7d77fadc88011f186ef943ccf397d35 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Date: Wed, 29 Nov 2023 13:47:34 +0100
 | 
			
		||||
Subject: [PATCH 07/14] Fix identity_map_base value dump on S390
 | 
			
		||||
 | 
			
		||||
Kernel virtual base instead of identity base is printed
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 s390.c  | 2 +-
 | 
			
		||||
 s390x.c | 2 +-
 | 
			
		||||
 2 files changed, 2 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/s390.c b/s390.c
 | 
			
		||||
index 42f5cc63ae52..a8b2bcca86c7 100644
 | 
			
		||||
--- a/s390.c
 | 
			
		||||
+++ b/s390.c
 | 
			
		||||
@@ -183,7 +183,7 @@ s390_dump_machdep_table(ulong arg)
 | 
			
		||||
 	fprintf(fp, ")\n");
 | 
			
		||||
 
 | 
			
		||||
 	fprintf(fp, "             kvbase: %lx\n", machdep->kvbase);
 | 
			
		||||
-	fprintf(fp, "  identity_map_base: %lx\n", machdep->kvbase);
 | 
			
		||||
+	fprintf(fp, "  identity_map_base: %lx\n", machdep->identity_map_base);
 | 
			
		||||
 	fprintf(fp, "           pagesize: %d\n", machdep->pagesize);
 | 
			
		||||
 	fprintf(fp, "          pageshift: %d\n", machdep->pageshift);
 | 
			
		||||
 	fprintf(fp, "           pagemask: %llx\n", machdep->pagemask);
 | 
			
		||||
diff --git a/s390x.c b/s390x.c
 | 
			
		||||
index d7ee3755fc0b..096c072186f5 100644
 | 
			
		||||
--- a/s390x.c
 | 
			
		||||
+++ b/s390x.c
 | 
			
		||||
@@ -650,7 +650,7 @@ s390x_dump_machdep_table(ulong arg)
 | 
			
		||||
 	fprintf(fp, ")\n");
 | 
			
		||||
 
 | 
			
		||||
 	fprintf(fp, "             kvbase: %lx\n", machdep->kvbase);
 | 
			
		||||
-	fprintf(fp, "  identity_map_base: %lx\n", machdep->kvbase);
 | 
			
		||||
+	fprintf(fp, "  identity_map_base: %lx\n", machdep->identity_map_base);
 | 
			
		||||
 	fprintf(fp, "           pagesize: %d\n", machdep->pagesize);
 | 
			
		||||
 	fprintf(fp, "          pageshift: %d\n", machdep->pageshift);
 | 
			
		||||
 	fprintf(fp, "           pagemask: %llx\n", machdep->pagemask);
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										180
									
								
								SOURCES/0007-ppc64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								SOURCES/0007-ppc64-Add-gdb-multi-stack-unwind-support.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,180 @@
 | 
			
		||||
From 0c14080b7d7bacadba3611568bd87b347677fa12 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Wed, 25 Jun 2025 16:02:03 +1200
 | 
			
		||||
Subject: [PATCH 7/9] ppc64: Add gdb multi-stack unwind support
 | 
			
		||||
 | 
			
		||||
Please note, there is a known issue which some ppc cannot stack unwind
 | 
			
		||||
successfully as:
 | 
			
		||||
 | 
			
		||||
    crash> bt
 | 
			
		||||
    PID: 2        TASK: c000000004797f80  CPU: 0    COMMAND: "kthreadd"
 | 
			
		||||
     #0 [c00000000484fbc0] _end at c00000000484fd70  (unreliable)
 | 
			
		||||
     #1 [c00000000484fd70] __switch_to at c00000000001fabc
 | 
			
		||||
     #2 [c00000000484fdd0] __schedule at c0000000011ca9dc
 | 
			
		||||
     #3 [c00000000484feb0] schedule at c0000000011caeb0
 | 
			
		||||
     #4 [c00000000484ff20] kthreadd at c0000000001af6c4
 | 
			
		||||
     #5 [c00000000484ffe0] start_kernel_thread at c00000000000ded8
 | 
			
		||||
    crash> gdb bt
 | 
			
		||||
    #0  0xc00000000484fd70 in ?? ()
 | 
			
		||||
    gdb: gdb request failed: bt
 | 
			
		||||
 | 
			
		||||
This has nothing to do with bt/gdb bt, see root cause in [1][2].
 | 
			
		||||
 | 
			
		||||
[1]: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg01124.html
 | 
			
		||||
[2]: https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg01139.html
 | 
			
		||||
 | 
			
		||||
Co-developed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
 | 
			
		||||
Co-developed-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 ppc64.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 | 
			
		||||
 1 file changed, 64 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/ppc64.c b/ppc64.c
 | 
			
		||||
index 532eb3fe4a7e..d1a506773c93 100644
 | 
			
		||||
--- a/ppc64.c
 | 
			
		||||
+++ b/ppc64.c
 | 
			
		||||
@@ -2053,6 +2053,7 @@ ppc64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
 	char buf[BUFSIZE];
 | 
			
		||||
 	struct gnu_request *req;
 | 
			
		||||
 	extern void print_stack_text_syms(struct bt_info *, ulong, ulong);
 | 
			
		||||
+	extra_stacks_idx = 0;
 | 
			
		||||
 
 | 
			
		||||
         bt->flags |= BT_EXCEPTION_FRAME;
 | 
			
		||||
 
 | 
			
		||||
@@ -2071,6 +2072,29 @@ ppc64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
         req->pc = bt->instptr;
 | 
			
		||||
         req->sp = bt->stkptr;
 | 
			
		||||
 
 | 
			
		||||
+	if (is_task_active(bt->task)) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] =
 | 
			
		||||
+				(struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		extra_stacks_regs[extra_stacks_idx]->ur.nip = req->pc;
 | 
			
		||||
+		extra_stacks_regs[extra_stacks_idx]->ur.gpr[1] = req->sp;
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(ppc64_pt_regs, nip));
 | 
			
		||||
+		SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap,
 | 
			
		||||
+			REG_SEQ(ppc64_pt_regs, gpr[0]) + 1);
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.gpr[1] !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.gpr[1] &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.nip !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.nip)) {
 | 
			
		||||
+			gdb_add_substack (extra_stacks_idx++);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	if (bt->flags &
 | 
			
		||||
 	(BT_TEXT_SYMBOLS|BT_TEXT_SYMBOLS_PRINT|BT_TEXT_SYMBOLS_NOPRINT)) {
 | 
			
		||||
 		if (!INSTACK(req->sp, bt))
 | 
			
		||||
@@ -2512,6 +2536,28 @@ ppc64_print_eframe(char *efrm_str, struct ppc64_pt_regs *regs,
 | 
			
		||||
 	fprintf(fp, " %s [%lx] exception frame:\n", efrm_str, regs->trap);
 | 
			
		||||
 	ppc64_print_regs(regs);
 | 
			
		||||
 	ppc64_print_nip_lr(regs, 1);
 | 
			
		||||
+
 | 
			
		||||
+	if (!((regs->msr >> MSR_PR_LG) & 0x1) && 
 | 
			
		||||
+	    !(bt->flags & BT_EFRAME_SEARCH)) {
 | 
			
		||||
+		if (!extra_stacks_regs[extra_stacks_idx]) {
 | 
			
		||||
+			extra_stacks_regs[extra_stacks_idx] =
 | 
			
		||||
+				(struct user_regs_bitmap_struct *)
 | 
			
		||||
+				malloc(sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		}
 | 
			
		||||
+		memset(extra_stacks_regs[extra_stacks_idx], 0,
 | 
			
		||||
+			sizeof(struct user_regs_bitmap_struct));
 | 
			
		||||
+		memcpy(&extra_stacks_regs[extra_stacks_idx]->ur, regs,
 | 
			
		||||
+			sizeof(struct ppc64_pt_regs));
 | 
			
		||||
+		for (int i = 0; i < sizeof(struct ppc64_pt_regs)/sizeof(ulong); i++)
 | 
			
		||||
+			SET_BIT(extra_stacks_regs[extra_stacks_idx]->bitmap, i);
 | 
			
		||||
+		if (!bt->machdep ||
 | 
			
		||||
+		     (extra_stacks_regs[extra_stacks_idx]->ur.gpr[1] !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.gpr[1] &&
 | 
			
		||||
+		      extra_stacks_regs[extra_stacks_idx]->ur.nip !=
 | 
			
		||||
+		      ((struct user_regs_bitmap_struct *)(bt->machdep))->ur.nip)) {
 | 
			
		||||
+			gdb_add_substack (extra_stacks_idx++);
 | 
			
		||||
+		}
 | 
			
		||||
+	}
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
@@ -2552,6 +2598,12 @@ ppc64_get_current_task_reg(int regno, const char *name, int size,
 | 
			
		||||
 	tc = CURRENT_CONTEXT();
 | 
			
		||||
 	if (!tc)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
+
 | 
			
		||||
+	if (sid && sid <= extra_stacks_idx) {
 | 
			
		||||
+		ur_bitmap = extra_stacks_regs[sid - 1];
 | 
			
		||||
+		goto get_sub;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
 	BZERO(&bt_setup, sizeof(struct bt_info));
 | 
			
		||||
 	clone_bt_info(&bt_setup, &bt_info, tc);
 | 
			
		||||
 	fill_stackbuf(&bt_info);
 | 
			
		||||
@@ -2570,39 +2622,45 @@ ppc64_get_current_task_reg(int regno, const char *name, int size,
 | 
			
		||||
 		goto get_all;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+get_sub:
 | 
			
		||||
 	switch (regno) {
 | 
			
		||||
 	case PPC64_R0_REGNUM ... PPC64_R31_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(ppc64_pt_regs, gpr[0]) + regno - PPC64_R0_REGNUM)) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PPC64_PC_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(ppc64_pt_regs, nip))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PPC64_MSR_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(ppc64_pt_regs, msr))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PPC64_LR_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(ppc64_pt_regs, link))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PPC64_CTR_REGNUM:
 | 
			
		||||
 		if (!NUM_IN_BITMAP(ur_bitmap->bitmap,
 | 
			
		||||
 		    REG_SEQ(ppc64_pt_regs, ctr))) {
 | 
			
		||||
-			FREEBUF(ur_bitmap);
 | 
			
		||||
+			if (!sid)
 | 
			
		||||
+				FREEBUF(ur_bitmap);
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
@@ -2645,7 +2703,7 @@ get_all:
 | 
			
		||||
 		ret = TRUE;
 | 
			
		||||
 		break;
 | 
			
		||||
 	}
 | 
			
		||||
-	if (bt_info.need_free) {
 | 
			
		||||
+	if (!sid && bt_info.need_free) {
 | 
			
		||||
 		FREEBUF(ur_bitmap);
 | 
			
		||||
 		bt_info.need_free = FALSE;
 | 
			
		||||
 	}
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,42 @@
 | 
			
		||||
From e906eaca2b1a77fe9f8ba512484b4e914c303f11 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
Date: Wed, 11 Jun 2025 11:19:01 +0800
 | 
			
		||||
Subject: [PATCH 8/9] Fix the issue of "page excluded" messages flooding
 | 
			
		||||
 | 
			
		||||
The current issue is only observed on PPC64le machine when loading crash,
 | 
			
		||||
E.g:
 | 
			
		||||
  ...
 | 
			
		||||
  crash: page excluded: kernel virtual address: c0000000022d6098  type: "gdb_readmem_callback"
 | 
			
		||||
  crash: page excluded: kernel virtual address: c0000000022d6098  type: "gdb_readmem_callback"
 | 
			
		||||
  ...
 | 
			
		||||
  crash>
 | 
			
		||||
 | 
			
		||||
And this issue can not be reproduced on crash 8, which only occurred
 | 
			
		||||
after the gdb-16.2 upgrade(see commit dfb2bb55e530).
 | 
			
		||||
 | 
			
		||||
So far I haven't found out why it always reads the same address(excluded
 | 
			
		||||
page) many times, anyway, crash tool should avoid flooding messages firstly,
 | 
			
		||||
similarly let's use the same debug level(8) such as the read_diskdump()(see
 | 
			
		||||
diskdump.c).
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 memory.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/memory.c b/memory.c
 | 
			
		||||
index 0d8d89862383..58624bb5f44c 100644
 | 
			
		||||
--- a/memory.c
 | 
			
		||||
+++ b/memory.c
 | 
			
		||||
@@ -2504,7 +2504,7 @@ readmem(ulonglong addr, int memtype, void *buffer, long size,
 | 
			
		||||
 
 | 
			
		||||
 		case PAGE_EXCLUDED:
 | 
			
		||||
 			RETURN_ON_PARTIAL_READ();
 | 
			
		||||
-                        if (PRINT_ERROR_MESSAGE)
 | 
			
		||||
+                        if (CRASHDEBUG(8))
 | 
			
		||||
                         	error(INFO, PAGE_EXCLUDED_ERRMSG, memtype_string(memtype, 0), addr, type);
 | 
			
		||||
                         goto readmem_error;
 | 
			
		||||
 
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -1,70 +0,0 @@
 | 
			
		||||
From 4c78eb4a9199631fe94845cb3fbd6376aae1251d Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Date: Wed, 29 Nov 2023 13:47:35 +0100
 | 
			
		||||
Subject: [PATCH 08/14] s390x: fix virtual vs physical address confusion
 | 
			
		||||
 | 
			
		||||
Physical and virtual addresses are the same on S390X.
 | 
			
		||||
That led to missing to use PTOV and VTOP macros where
 | 
			
		||||
they actually expected.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 s390x.c | 12 ++++++------
 | 
			
		||||
 1 file changed, 6 insertions(+), 6 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/s390x.c b/s390x.c
 | 
			
		||||
index 096c072186f5..957b839a5fa9 100644
 | 
			
		||||
--- a/s390x.c
 | 
			
		||||
+++ b/s390x.c
 | 
			
		||||
@@ -311,7 +311,7 @@ static struct s390x_cpu *s390x_cpu_get(struct bt_info *bt)
 | 
			
		||||
 	readmem(lowcore_ptr + cpu * sizeof(long), KVADDR,
 | 
			
		||||
 		&prefix, sizeof(long), "lowcore_ptr", FAULT_ON_ERROR);
 | 
			
		||||
 	for (i = 0; i < s390x_cpu_cnt; i++) {
 | 
			
		||||
-		if (s390x_cpu_vec[i].prefix == prefix)
 | 
			
		||||
+		if (s390x_cpu_vec[i].prefix == VTOP(prefix))
 | 
			
		||||
 			return &s390x_cpu_vec[i];
 | 
			
		||||
 	}
 | 
			
		||||
 	error(FATAL, "cannot determine CPU for task: %lx\n", bt->task);
 | 
			
		||||
@@ -985,12 +985,12 @@ int s390x_vtop(ulong table, ulong vaddr, physaddr_t *phys_addr, int verbose)
 | 
			
		||||
 						  verbose);
 | 
			
		||||
 		if (!entry)
 | 
			
		||||
 			return FALSE;
 | 
			
		||||
-		table = entry & ~0xfffULL;
 | 
			
		||||
+		table = PTOV(entry & ~0xfffULL);
 | 
			
		||||
 		/* Check if this a 2GB page */
 | 
			
		||||
 		if ((entry & 0x400ULL) && (level == 1)) {
 | 
			
		||||
 			/* Add the 2GB frame offset & return the final value. */
 | 
			
		||||
 			table &= ~0x7fffffffULL;
 | 
			
		||||
-			*phys_addr = table + (vaddr & 0x7fffffffULL);
 | 
			
		||||
+			*phys_addr = VTOP(table + (vaddr & 0x7fffffffULL));
 | 
			
		||||
 			return TRUE;
 | 
			
		||||
 		}
 | 
			
		||||
 		len = entry & 0x3ULL;
 | 
			
		||||
@@ -1001,12 +1001,12 @@ int s390x_vtop(ulong table, ulong vaddr, physaddr_t *phys_addr, int verbose)
 | 
			
		||||
 	if (entry & 0x400ULL) {
 | 
			
		||||
 		/* Add the 1MB page offset and return the final value. */
 | 
			
		||||
 		table &= ~0xfffffULL;
 | 
			
		||||
-		*phys_addr = table + (vaddr & 0xfffffULL);
 | 
			
		||||
+		*phys_addr = VTOP(table + (vaddr & 0xfffffULL));
 | 
			
		||||
 		return TRUE;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	/* Get the page table entry */
 | 
			
		||||
-	entry = _kl_pg_table_deref_s390x(vaddr, entry & ~0x7ffULL, verbose);
 | 
			
		||||
+	entry = _kl_pg_table_deref_s390x(vaddr, PTOV(entry & ~0x7ffULL), verbose);
 | 
			
		||||
 	if (!entry)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
 
 | 
			
		||||
@@ -1033,7 +1033,7 @@ s390x_vmalloc_start(void)
 | 
			
		||||
 {
 | 
			
		||||
 	unsigned long highmem_addr,high_memory;
 | 
			
		||||
 	highmem_addr=symbol_value("high_memory");
 | 
			
		||||
-       	readmem(highmem_addr, PHYSADDR, &high_memory,sizeof(long),
 | 
			
		||||
+	readmem(highmem_addr, KVADDR, &high_memory,sizeof(long),
 | 
			
		||||
 		"highmem",FAULT_ON_ERROR);
 | 
			
		||||
 	return high_memory;
 | 
			
		||||
 }
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,35 @@
 | 
			
		||||
From 7e8a2796580d992ed19b2e49b5d555e432303e96 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: "k-hagio-ab@nec.com" <k-hagio-ab@nec.com>
 | 
			
		||||
Date: Tue, 17 Jun 2025 06:08:52 +0000
 | 
			
		||||
Subject: [PATCH 9/9] Fix "kmem -p" option on Linux 6.16-rc1 and later kernels
 | 
			
		||||
 | 
			
		||||
Kernel commit acc53a0b4c156 ("mm: rename page->index to
 | 
			
		||||
page->__folio_index"), which is contained in Linux 6.16-rc1 and later
 | 
			
		||||
kernels, renamed the member.  Without the patch, the "kmem -p" option
 | 
			
		||||
fails with the following error:
 | 
			
		||||
 | 
			
		||||
  kmem: invalid structure member offset: page_index
 | 
			
		||||
        FILE: memory.c  LINE: 6016  FUNCTION: dump_mem_map_SPARSEMEM()
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 memory.c | 2 ++
 | 
			
		||||
 1 file changed, 2 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/memory.c b/memory.c
 | 
			
		||||
index 58624bb5f44c..400d31a04cd4 100644
 | 
			
		||||
--- a/memory.c
 | 
			
		||||
+++ b/memory.c
 | 
			
		||||
@@ -531,6 +531,8 @@ vm_init(void)
 | 
			
		||||
 		ASSIGN_OFFSET(page_mapping) = MEMBER_OFFSET("page", "_mapcount") +
 | 
			
		||||
 			STRUCT_SIZE("atomic_t") + sizeof(ulong);
 | 
			
		||||
         MEMBER_OFFSET_INIT(page_index, "page", "index");
 | 
			
		||||
+	if (INVALID_MEMBER(page_index))		/* 6.16 and later */
 | 
			
		||||
+		MEMBER_OFFSET_INIT(page_index, "page", "__folio_index");
 | 
			
		||||
 	if (INVALID_MEMBER(page_index))
 | 
			
		||||
 		ANON_MEMBER_OFFSET_INIT(page_index, "page", "index");
 | 
			
		||||
         MEMBER_OFFSET_INIT(page_buffers, "page", "buffers");
 | 
			
		||||
-- 
 | 
			
		||||
2.47.1
 | 
			
		||||
 | 
			
		||||
@ -1,323 +0,0 @@
 | 
			
		||||
From d0164e7e480ad2ffd3fe73fe53c46087e5e137a6 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Date: Thu, 7 Dec 2023 16:54:06 +0100
 | 
			
		||||
Subject: [PATCH 09/14] s390x: uncouple physical and virtual memory spaces
 | 
			
		||||
 | 
			
		||||
Rework VTOP and PTOV macros to reflect the future
 | 
			
		||||
uncoupling of physical and virtual address spaces
 | 
			
		||||
in kernel. Existing versions are not affected.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 defs.h  |  20 +++++-
 | 
			
		||||
 s390x.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 | 
			
		||||
 2 files changed, 228 insertions(+), 4 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/defs.h b/defs.h
 | 
			
		||||
index 5218a94fe4a4..20237b72a10b 100644
 | 
			
		||||
--- a/defs.h
 | 
			
		||||
+++ b/defs.h
 | 
			
		||||
@@ -4564,9 +4564,9 @@ struct efi_memory_desc_t {
 | 
			
		||||
 #define _64BIT_
 | 
			
		||||
 #define MACHINE_TYPE       "S390X"
 | 
			
		||||
 
 | 
			
		||||
-#define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
 | 
			
		||||
-#define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
 | 
			
		||||
-#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
 | 
			
		||||
+#define PTOV(X)            s390x_PTOV((ulong)(X))
 | 
			
		||||
+#define VTOP(X)            s390x_VTOP((ulong)(X))
 | 
			
		||||
+#define IS_VMALLOC_ADDR(X) s390x_IS_VMALLOC_ADDR(X)
 | 
			
		||||
 #define PTRS_PER_PTE    512
 | 
			
		||||
 #define PTRS_PER_PMD    1024
 | 
			
		||||
 #define PTRS_PER_PGD    2048
 | 
			
		||||
@@ -6827,7 +6827,21 @@ void get_s390_panicmsg(char *);
 | 
			
		||||
  *  s390x.c
 | 
			
		||||
  */
 | 
			
		||||
 #ifdef S390X
 | 
			
		||||
+
 | 
			
		||||
+struct machine_specific
 | 
			
		||||
+{
 | 
			
		||||
+	ulong (*virt_to_phys)(ulong vaddr);
 | 
			
		||||
+	ulong (*phys_to_virt)(ulong paddr);
 | 
			
		||||
+	int (*is_vmalloc_addr)(ulong vaddr);
 | 
			
		||||
+	ulong __kaslr_offset_phys;
 | 
			
		||||
+	ulong amode31_start;
 | 
			
		||||
+	ulong amode31_end;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 void s390x_init(int);
 | 
			
		||||
+ulong s390x_PTOV(ulong);
 | 
			
		||||
+ulong s390x_VTOP(ulong);
 | 
			
		||||
+int s390x_IS_VMALLOC_ADDR(ulong);
 | 
			
		||||
 void s390x_dump_machdep_table(ulong);
 | 
			
		||||
 #define display_idt_table() \
 | 
			
		||||
         error(FATAL, "-d option is not applicable to S390X architecture\n")
 | 
			
		||||
diff --git a/s390x.c b/s390x.c
 | 
			
		||||
index 957b839a5fa9..794ae825906d 100644
 | 
			
		||||
--- a/s390x.c
 | 
			
		||||
+++ b/s390x.c
 | 
			
		||||
@@ -47,6 +47,7 @@
 | 
			
		||||
 #define S390X_PSW_MASK_PSTATE	0x0001000000000000UL
 | 
			
		||||
 
 | 
			
		||||
 #define S390X_LC_VMCORE_INFO	0xe0c
 | 
			
		||||
+#define S390X_LC_OS_INFO	0xe18
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * Flags for Region and Segment table entries.
 | 
			
		||||
@@ -168,6 +169,19 @@ static struct line_number_hook s390x_line_number_hooks[];
 | 
			
		||||
 static int s390x_is_uvaddr(ulong, struct task_context *);
 | 
			
		||||
 static int s390x_get_kvaddr_ranges(struct vaddr_range *);
 | 
			
		||||
 static int set_s390x_max_physmem_bits(void);
 | 
			
		||||
+static ulong s390x_generic_VTOP(ulong vaddr);
 | 
			
		||||
+static ulong s390x_generic_PTOV(ulong paddr);
 | 
			
		||||
+static int s390x_generic_IS_VMALLOC_ADDR(ulong vaddr);
 | 
			
		||||
+static ulong s390x_vr_VTOP(ulong vaddr);
 | 
			
		||||
+static ulong s390x_vr_PTOV(ulong paddr);
 | 
			
		||||
+static int s390x_vr_IS_VMALLOC_ADDR(ulong vaddr);
 | 
			
		||||
+static int s390x_vr_is_kvaddr(ulong);
 | 
			
		||||
+
 | 
			
		||||
+struct machine_specific s390x_machine_specific = {
 | 
			
		||||
+	.virt_to_phys = s390x_generic_VTOP,
 | 
			
		||||
+	.phys_to_virt = s390x_generic_PTOV,
 | 
			
		||||
+	.is_vmalloc_addr = s390x_generic_IS_VMALLOC_ADDR,
 | 
			
		||||
+};
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * struct lowcore name (old: "_lowcore", new: "lowcore")
 | 
			
		||||
@@ -546,6 +560,191 @@ static void s390x_check_kaslr(void)
 | 
			
		||||
 	free(vmcoreinfo);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+#define OS_INFO_VERSION_MAJOR		1
 | 
			
		||||
+#define OS_INFO_VERSION_MINOR		1
 | 
			
		||||
+
 | 
			
		||||
+#define OS_INFO_VMCOREINFO		0
 | 
			
		||||
+#define OS_INFO_REIPL_BLOCK		1
 | 
			
		||||
+#define OS_INFO_FLAGS_ENTRY		2
 | 
			
		||||
+#define OS_INFO_RESERVED		3
 | 
			
		||||
+#define OS_INFO_IDENTITY_BASE		4
 | 
			
		||||
+#define OS_INFO_KASLR_OFFSET		5
 | 
			
		||||
+#define OS_INFO_KASLR_OFF_PHYS		6
 | 
			
		||||
+#define OS_INFO_VMEMMAP			7
 | 
			
		||||
+#define OS_INFO_AMODE31_START		8
 | 
			
		||||
+#define OS_INFO_AMODE31_END		9
 | 
			
		||||
+
 | 
			
		||||
+struct os_info_entry {
 | 
			
		||||
+	union {
 | 
			
		||||
+		__u64	addr;
 | 
			
		||||
+		__u64	val;
 | 
			
		||||
+	};
 | 
			
		||||
+	__u64	size;
 | 
			
		||||
+	__u32	csum;
 | 
			
		||||
+} __attribute__((packed));
 | 
			
		||||
+
 | 
			
		||||
+struct os_info {
 | 
			
		||||
+	__u64	magic;
 | 
			
		||||
+	__u32	csum;
 | 
			
		||||
+	__u16	version_major;
 | 
			
		||||
+	__u16	version_minor;
 | 
			
		||||
+	__u64	crashkernel_addr;
 | 
			
		||||
+	__u64	crashkernel_size;
 | 
			
		||||
+	struct	os_info_entry entry[10];
 | 
			
		||||
+	__u8	reserved[3864];
 | 
			
		||||
+} __attribute__((packed));
 | 
			
		||||
+
 | 
			
		||||
+struct vm_info {
 | 
			
		||||
+	__u64 __identity_base;
 | 
			
		||||
+	__u64 __kaslr_offset;
 | 
			
		||||
+	__u64 __kaslr_offset_phys;
 | 
			
		||||
+	__u64 amode31_start;
 | 
			
		||||
+	__u64 amode31_end;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static bool
 | 
			
		||||
+vmcoreinfo_read_u64(const char *key, __u64 *val)
 | 
			
		||||
+{
 | 
			
		||||
+	char *string;
 | 
			
		||||
+
 | 
			
		||||
+	string = pc->read_vmcoreinfo(key);
 | 
			
		||||
+	if (string) {
 | 
			
		||||
+		*val = strtoul(string, NULL, 16);
 | 
			
		||||
+		free(string);
 | 
			
		||||
+		return true;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	return false;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool vmcoreinfo_read_vm_info(struct vm_info *_vm_info)
 | 
			
		||||
+{
 | 
			
		||||
+	struct vm_info vm_info;
 | 
			
		||||
+
 | 
			
		||||
+	if (!vmcoreinfo_read_u64("IDENTITYBASE",  &vm_info.__identity_base) ||
 | 
			
		||||
+	    !vmcoreinfo_read_u64("KERNELOFFSET",  &vm_info.__kaslr_offset) ||
 | 
			
		||||
+	    !vmcoreinfo_read_u64("KERNELOFFPHYS", &vm_info.__kaslr_offset_phys) ||
 | 
			
		||||
+	    !vmcoreinfo_read_u64("SAMODE31",      &vm_info.amode31_start) ||
 | 
			
		||||
+	    !vmcoreinfo_read_u64("EAMODE31",      &vm_info.amode31_end))
 | 
			
		||||
+		return false;
 | 
			
		||||
+
 | 
			
		||||
+	*_vm_info = vm_info;
 | 
			
		||||
+
 | 
			
		||||
+	return true;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool os_info_read_vm_info(struct vm_info *vm_info)
 | 
			
		||||
+{
 | 
			
		||||
+	struct os_info os_info;
 | 
			
		||||
+	ulong addr;
 | 
			
		||||
+
 | 
			
		||||
+	if (!readmem(S390X_LC_OS_INFO, PHYSADDR, &addr,
 | 
			
		||||
+		    sizeof(addr), "s390x os_info ptr",
 | 
			
		||||
+		    QUIET|RETURN_ON_ERROR))
 | 
			
		||||
+		return false;
 | 
			
		||||
+
 | 
			
		||||
+	if (addr == 0)
 | 
			
		||||
+		return true;
 | 
			
		||||
+
 | 
			
		||||
+	if (!readmem(addr, PHYSADDR, &os_info,
 | 
			
		||||
+		    offsetof(struct os_info, reserved), "s390x os_info header",
 | 
			
		||||
+		    QUIET|RETURN_ON_ERROR))
 | 
			
		||||
+		return false;
 | 
			
		||||
+
 | 
			
		||||
+	vm_info->__identity_base      = os_info.entry[OS_INFO_IDENTITY_BASE].val;
 | 
			
		||||
+	vm_info->__kaslr_offset       = os_info.entry[OS_INFO_KASLR_OFFSET].val;
 | 
			
		||||
+	vm_info->__kaslr_offset_phys  = os_info.entry[OS_INFO_KASLR_OFF_PHYS].val;
 | 
			
		||||
+	vm_info->amode31_start        = os_info.entry[OS_INFO_AMODE31_START].val;
 | 
			
		||||
+	vm_info->amode31_end          = os_info.entry[OS_INFO_AMODE31_END].val;
 | 
			
		||||
+
 | 
			
		||||
+	return true;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool vm_info_empty(struct vm_info *vm_info)
 | 
			
		||||
+{
 | 
			
		||||
+	return !vm_info->__kaslr_offset;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static bool s390x_init_vm(void)
 | 
			
		||||
+{
 | 
			
		||||
+	struct vm_info vm_info;
 | 
			
		||||
+
 | 
			
		||||
+	if (pc->flags & PROC_KCORE) {
 | 
			
		||||
+		if (!vmcoreinfo_read_vm_info(&vm_info))
 | 
			
		||||
+			return true;
 | 
			
		||||
+	} else {
 | 
			
		||||
+		if (!os_info_read_vm_info(&vm_info))
 | 
			
		||||
+			return false;
 | 
			
		||||
+	}
 | 
			
		||||
+	if (vm_info_empty(&vm_info))
 | 
			
		||||
+		return true;
 | 
			
		||||
+
 | 
			
		||||
+	machdep->identity_map_base		= vm_info.__identity_base;
 | 
			
		||||
+	machdep->kvbase				= vm_info.__kaslr_offset;
 | 
			
		||||
+	machdep->machspec->__kaslr_offset_phys	= vm_info.__kaslr_offset_phys;
 | 
			
		||||
+	machdep->machspec->amode31_start	= vm_info.amode31_start;
 | 
			
		||||
+	machdep->machspec->amode31_end		= vm_info.amode31_end;
 | 
			
		||||
+
 | 
			
		||||
+	machdep->is_kvaddr			= s390x_vr_is_kvaddr;
 | 
			
		||||
+	machdep->machspec->virt_to_phys		= s390x_vr_VTOP;
 | 
			
		||||
+	machdep->machspec->phys_to_virt		= s390x_vr_PTOV;
 | 
			
		||||
+	machdep->machspec->is_vmalloc_addr	= s390x_vr_IS_VMALLOC_ADDR;
 | 
			
		||||
+
 | 
			
		||||
+	return true;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static ulong s390x_generic_VTOP(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return vaddr - machdep->kvbase;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static ulong s390x_generic_PTOV(ulong paddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return paddr + machdep->kvbase;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int s390x_generic_IS_VMALLOC_ADDR(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return vt->vmalloc_start && vaddr >= vt->vmalloc_start;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static ulong s390x_vr_VTOP(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	if (vaddr < LOWCORE_SIZE)
 | 
			
		||||
+		return vaddr;
 | 
			
		||||
+	if ((vaddr < machdep->machspec->amode31_end) &&
 | 
			
		||||
+	    (vaddr >= machdep->machspec->amode31_start))
 | 
			
		||||
+		return vaddr;
 | 
			
		||||
+	if (vaddr < machdep->kvbase)
 | 
			
		||||
+		return vaddr - machdep->identity_map_base;
 | 
			
		||||
+	return vaddr - machdep->kvbase + machdep->machspec->__kaslr_offset_phys;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static ulong s390x_vr_PTOV(ulong paddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return paddr + machdep->identity_map_base;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int s390x_vr_IS_VMALLOC_ADDR(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return (vaddr >= vt->vmalloc_start && vaddr < machdep->kvbase);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+ulong s390x_VTOP(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return machdep->machspec->virt_to_phys(vaddr);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+ulong s390x_PTOV(ulong paddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return machdep->machspec->phys_to_virt(paddr);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+int s390x_IS_VMALLOC_ADDR(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return machdep->machspec->is_vmalloc_addr(vaddr);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  *  Do all necessary machine-specific setup here.  This is called several
 | 
			
		||||
  *  times during initialization.
 | 
			
		||||
@@ -560,6 +759,7 @@ s390x_init(int when)
 | 
			
		||||
 		machdep->process_elf_notes = s390x_process_elf_notes;
 | 
			
		||||
 		break;
 | 
			
		||||
 	case PRE_SYMTAB:
 | 
			
		||||
+		machdep->machspec = &s390x_machine_specific;
 | 
			
		||||
 		machdep->verify_symbol = s390x_verify_symbol;
 | 
			
		||||
 		if (pc->flags & KERNEL_DEBUG_QUERY)
 | 
			
		||||
 			return;
 | 
			
		||||
@@ -587,6 +787,8 @@ s390x_init(int when)
 | 
			
		||||
 		machdep->kvbase = 0;
 | 
			
		||||
 		machdep->identity_map_base = 0;
 | 
			
		||||
 		machdep->is_kvaddr =  generic_is_kvaddr;
 | 
			
		||||
+		if (!s390x_init_vm())
 | 
			
		||||
+			error(FATAL, "cannot initialize VM parameters.");
 | 
			
		||||
 		machdep->is_uvaddr =  s390x_is_uvaddr;
 | 
			
		||||
 		machdep->eframe_search = s390x_eframe_search;
 | 
			
		||||
 		machdep->back_trace = s390x_back_trace_cmd;
 | 
			
		||||
@@ -681,7 +883,9 @@ s390x_dump_machdep_table(ulong arg)
 | 
			
		||||
 	fprintf(fp, "         dis_filter: s390x_dis_filter()\n");
 | 
			
		||||
 	fprintf(fp, "           cmd_mach: s390x_cmd_mach()\n");
 | 
			
		||||
 	fprintf(fp, "       get_smp_cpus: s390x_get_smp_cpus()\n");
 | 
			
		||||
-	fprintf(fp, "          is_kvaddr: generic_is_kvaddr()\n");
 | 
			
		||||
+	fprintf(fp, "          is_kvaddr: %s()\n", machdep->is_kvaddr == s390x_vr_is_kvaddr ?
 | 
			
		||||
+					  "s390x_vr_is_kvaddr" :
 | 
			
		||||
+					  "generic_is_kvaddr");
 | 
			
		||||
 	fprintf(fp, "          is_uvaddr: s390x_is_uvaddr()\n");
 | 
			
		||||
 	fprintf(fp, "       verify_paddr: generic_verify_paddr()\n");
 | 
			
		||||
 	fprintf(fp, "  get_kvaddr_ranges: s390x_get_kvaddr_ranges()\n");
 | 
			
		||||
@@ -702,6 +906,12 @@ s390x_dump_machdep_table(ulong arg)
 | 
			
		||||
 	fprintf(fp, "           machspec: %lx\n", (ulong)machdep->machspec);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int
 | 
			
		||||
+s390x_vr_is_kvaddr(ulong vaddr)
 | 
			
		||||
+{
 | 
			
		||||
+	return (vaddr < LOWCORE_SIZE) || (vaddr >= machdep->identity_map_base);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Check if address is in context's address space
 | 
			
		||||
  */
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,160 +0,0 @@
 | 
			
		||||
From 5187a0320cc54a9cb8b326cf012e69795950a716 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Song Shuai <songshuaishuai@tinylab.org>
 | 
			
		||||
Date: Tue, 12 Dec 2023 18:20:50 +0800
 | 
			
		||||
Subject: [PATCH 10/14] RISCV64: Dump NT_PRSTATUS in 'help -n'
 | 
			
		||||
 | 
			
		||||
With the patch we can get full dump of "struct elf_prstatus" in 'help -n':
 | 
			
		||||
```
 | 
			
		||||
crash> help -n
 | 
			
		||||
<snip>
 | 
			
		||||
Elf64_Nhdr:
 | 
			
		||||
               n_namesz: 5 ("CORE")
 | 
			
		||||
               n_descsz: 376
 | 
			
		||||
                 n_type: 1 (NT_PRSTATUS)
 | 
			
		||||
                         si.signo: 0  si.code: 0  si.errno: 0
 | 
			
		||||
                         cursig: 0  sigpend: 0  sighold: 0
 | 
			
		||||
                         pid: 1  ppid: 0  pgrp: 0  sid:0
 | 
			
		||||
                         utime: 0.000000  stime: 0.000000
 | 
			
		||||
                         cutime: 0.000000  cstime: 0.000000
 | 
			
		||||
                         epc: ffffffff8000a1dc   ra: ffffffff800af958   sp: ff6000001fc501c0
 | 
			
		||||
                          gp: ffffffff81515d38   tp: ff600000000d8000   t0: 6666666666663c5b
 | 
			
		||||
                          t1: ff600000000d88c8   t2: 666666666666663c   s0: ff6000001fc50320
 | 
			
		||||
                          s1: ffffffff815170d8   a0: ff6000001fc501c8   a1: c0000000ffffefff
 | 
			
		||||
                          a2: 0000000000000000   a3: 0000000000000001   a4: 0000000000000000
 | 
			
		||||
                          a5: ff60000001782c00   a6: 000000000130e0f0   a7: 0000000000000000
 | 
			
		||||
                          s2: ffffffff81517820   s3: ff6000001fc501c8   s4: 000000000000000f
 | 
			
		||||
                          s5: 0000000000000000   s6: ff20000000013e60   s7: 0000000000000000
 | 
			
		||||
                          s8: ff60000000861000   s9: 00007fffc3641694  s10: 00007fffc3641690
 | 
			
		||||
                         s11: 00005555796ed240   t3: 0000000000010297   t4: ffffffff80c17810
 | 
			
		||||
                          t5: ffffffff8195e7b8   t6: ff6000001fc50048
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         0000000000000001 0000000000000000
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         0000000000000000 0000000000000000
 | 
			
		||||
                         ffffffff8000a1dc ffffffff800af958
 | 
			
		||||
                         ff6000001fc501c0 ffffffff81515d38
 | 
			
		||||
                         ff600000000d8000 6666666666663c5b
 | 
			
		||||
<snip>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 netdump.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 84 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/netdump.c b/netdump.c
 | 
			
		||||
index 390786364959..32586b6809d3 100644
 | 
			
		||||
--- a/netdump.c
 | 
			
		||||
+++ b/netdump.c
 | 
			
		||||
@@ -2578,6 +2578,8 @@ dump_Elf64_Nhdr(Elf64_Off offset, int store)
 | 
			
		||||
 				display_ELF_note(EM_PPC64, PRSTATUS_NOTE, note, nd->ofp);
 | 
			
		||||
 			if (machine_type("ARM64") && (note->n_type == NT_PRSTATUS))
 | 
			
		||||
 				display_ELF_note(EM_AARCH64, PRSTATUS_NOTE, note, nd->ofp);
 | 
			
		||||
+			if (machine_type("RISCV64") && (note->n_type == NT_PRSTATUS))
 | 
			
		||||
+				display_ELF_note(EM_RISCV, PRSTATUS_NOTE, note, nd->ofp);
 | 
			
		||||
 		}
 | 
			
		||||
 		for (i = lf = 0; i < note->n_descsz/sizeof(ulonglong); i++) {
 | 
			
		||||
 			if (((i%2)==0)) {
 | 
			
		||||
@@ -3399,6 +3401,80 @@ display_prstatus_arm64(void *note_ptr, FILE *ofp)
 | 
			
		||||
 		space(sp), pr->pr_reg[33], pr->pr_fpvalid);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+struct riscv64_elf_siginfo {
 | 
			
		||||
+    int si_signo;
 | 
			
		||||
+    int si_code;
 | 
			
		||||
+    int si_errno;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+struct riscv64_elf_prstatus {
 | 
			
		||||
+    struct riscv64_elf_siginfo pr_info;
 | 
			
		||||
+    short pr_cursig;
 | 
			
		||||
+    unsigned long pr_sigpend;
 | 
			
		||||
+    unsigned long pr_sighold;
 | 
			
		||||
+    pid_t pr_pid;
 | 
			
		||||
+    pid_t pr_ppid;
 | 
			
		||||
+    pid_t pr_pgrp;
 | 
			
		||||
+    pid_t pr_sid;
 | 
			
		||||
+    struct timeval pr_utime;
 | 
			
		||||
+    struct timeval pr_stime;
 | 
			
		||||
+    struct timeval pr_cutime;
 | 
			
		||||
+    struct timeval pr_cstime;
 | 
			
		||||
+/*  elf_gregset_t pr_reg; => typedef struct user_regs_struct elf_gregset_t; */
 | 
			
		||||
+    unsigned long pr_reg[32];
 | 
			
		||||
+    int pr_fpvalid;
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
+static void
 | 
			
		||||
+display_prstatus_riscv64(void *note_ptr, FILE *ofp)
 | 
			
		||||
+{
 | 
			
		||||
+	struct riscv64_elf_prstatus *pr;
 | 
			
		||||
+	Elf64_Nhdr *note;
 | 
			
		||||
+	int sp;
 | 
			
		||||
+
 | 
			
		||||
+	note = (Elf64_Nhdr *)note_ptr;
 | 
			
		||||
+	pr = (struct riscv64_elf_prstatus *)(
 | 
			
		||||
+		(char *)note + sizeof(Elf64_Nhdr) + note->n_namesz);
 | 
			
		||||
+	pr = (struct riscv64_elf_prstatus *)roundup((ulong)pr, 4);
 | 
			
		||||
+	sp = nd->num_prstatus_notes ? 25 : 22;
 | 
			
		||||
+
 | 
			
		||||
+	fprintf(ofp,
 | 
			
		||||
+		"%ssi.signo: %d  si.code: %d  si.errno: %d\n"
 | 
			
		||||
+		"%scursig: %d  sigpend: %lx  sighold: %lx\n"
 | 
			
		||||
+		"%spid: %d  ppid: %d  pgrp: %d  sid:%d\n"
 | 
			
		||||
+		"%sutime: %01lld.%06d  stime: %01lld.%06d\n"
 | 
			
		||||
+		"%scutime: %01lld.%06d  cstime: %01lld.%06d\n",
 | 
			
		||||
+		space(sp), pr->pr_info.si_signo, pr->pr_info.si_code, pr->pr_info.si_errno,
 | 
			
		||||
+		space(sp), pr->pr_cursig, pr->pr_sigpend, pr->pr_sighold,
 | 
			
		||||
+		space(sp), pr->pr_pid, pr->pr_ppid, pr->pr_pgrp, pr->pr_sid,
 | 
			
		||||
+		space(sp), (long long)pr->pr_utime.tv_sec, (int)pr->pr_utime.tv_usec,
 | 
			
		||||
+		(long long)pr->pr_stime.tv_sec, (int)pr->pr_stime.tv_usec,
 | 
			
		||||
+		space(sp), (long long)pr->pr_cutime.tv_sec, (int)pr->pr_cutime.tv_usec,
 | 
			
		||||
+		(long long)pr->pr_cstime.tv_sec, (int)pr->pr_cstime.tv_usec);
 | 
			
		||||
+	fprintf(ofp,
 | 
			
		||||
+		"%sepc: %016lx   ra: %016lx   sp: %016lx\n"
 | 
			
		||||
+		"%s gp: %016lx   tp: %016lx   t0: %016lx\n"
 | 
			
		||||
+		"%s t1: %016lx   t2: %016lx   s0: %016lx\n"
 | 
			
		||||
+		"%s s1: %016lx   a0: %016lx   a1: %016lx\n"
 | 
			
		||||
+		"%s a2: %016lx   a3: %016lx   a4: %016lx\n"
 | 
			
		||||
+		"%s a5: %016lx   a6: %016lx   a7: %016lx\n"
 | 
			
		||||
+		"%s s2: %016lx   s3: %016lx   s4: %016lx\n"
 | 
			
		||||
+		"%s s5: %016lx   s6: %016lx   s7: %016lx\n"
 | 
			
		||||
+		"%s s8: %016lx   s9: %016lx  s10: %016lx\n"
 | 
			
		||||
+		"%ss11: %016lx   t3: %016lx   t4: %016lx\n"
 | 
			
		||||
+		"%s t5: %016lx   t6: %016lx\n",
 | 
			
		||||
+		space(sp), pr->pr_reg[0], pr->pr_reg[1], pr->pr_reg[2],
 | 
			
		||||
+		space(sp), pr->pr_reg[3], pr->pr_reg[4], pr->pr_reg[5],
 | 
			
		||||
+		space(sp), pr->pr_reg[6], pr->pr_reg[7], pr->pr_reg[8],
 | 
			
		||||
+		space(sp), pr->pr_reg[9], pr->pr_reg[10], pr->pr_reg[11],
 | 
			
		||||
+		space(sp), pr->pr_reg[12], pr->pr_reg[13], pr->pr_reg[14],
 | 
			
		||||
+		space(sp), pr->pr_reg[15], pr->pr_reg[16], pr->pr_reg[17],
 | 
			
		||||
+		space(sp), pr->pr_reg[18], pr->pr_reg[19], pr->pr_reg[20],
 | 
			
		||||
+		space(sp), pr->pr_reg[21], pr->pr_reg[22], pr->pr_reg[23],
 | 
			
		||||
+		space(sp), pr->pr_reg[24], pr->pr_reg[25], pr->pr_reg[26],
 | 
			
		||||
+		space(sp), pr->pr_reg[27], pr->pr_reg[28], pr->pr_reg[29],
 | 
			
		||||
+		space(sp), pr->pr_reg[30], pr->pr_reg[31]);
 | 
			
		||||
+}
 | 
			
		||||
 
 | 
			
		||||
 void
 | 
			
		||||
 display_ELF_note(int machine, int type, void *note, FILE *ofp)
 | 
			
		||||
@@ -3449,6 +3525,14 @@ display_ELF_note(int machine, int type, void *note, FILE *ofp)
 | 
			
		||||
 			break;
 | 
			
		||||
 		}
 | 
			
		||||
 		break;
 | 
			
		||||
+	case EM_RISCV:
 | 
			
		||||
+		switch (type)
 | 
			
		||||
+		{
 | 
			
		||||
+		case PRSTATUS_NOTE:
 | 
			
		||||
+			display_prstatus_riscv64(note, ofp);
 | 
			
		||||
+			break;
 | 
			
		||||
+		}
 | 
			
		||||
+		break;
 | 
			
		||||
 
 | 
			
		||||
 	default:
 | 
			
		||||
 		return;
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,87 +0,0 @@
 | 
			
		||||
From 9b69093e623f1d54c373b1e091900d40576c059b Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Song Shuai <songshuaishuai@tinylab.org>
 | 
			
		||||
Date: Tue, 12 Dec 2023 18:20:51 +0800
 | 
			
		||||
Subject: [PATCH 11/14] RISCV64: Fix 'bt' output when no ra on the stack top
 | 
			
		||||
 | 
			
		||||
Same as the Linux commit f766f77a74f5 ("riscv/stacktrace: Fix
 | 
			
		||||
stack output without ra on the stack top").
 | 
			
		||||
 | 
			
		||||
When a function doesn't have a callee, then it will not
 | 
			
		||||
push ra into the stack, such as lkdtm functions, so
 | 
			
		||||
correct the FP of the second frame and use pt_regs to get
 | 
			
		||||
the right PC of the second frame.
 | 
			
		||||
 | 
			
		||||
Before this patch, the `bt -f` outputs only the first frame with
 | 
			
		||||
the wrong PC and FP of next frame:
 | 
			
		||||
```
 | 
			
		||||
crash> bt -f
 | 
			
		||||
PID: 1        TASK: ff600000000e0000  CPU: 1    COMMAND: "sh"
 | 
			
		||||
 #0 [ff20000000013cf0] lkdtm_EXCEPTION at ffffffff805303c0
 | 
			
		||||
    [PC: ffffffff805303c0 RA: ff20000000013d10 SP: ff20000000013cf0 SIZE: 16] <- wrong next PC
 | 
			
		||||
    ff20000000013cf0: 0000000000000001 ff20000000013d10 <- next FP
 | 
			
		||||
    ff20000000013d00: ff20000000013d40
 | 
			
		||||
crash>
 | 
			
		||||
```
 | 
			
		||||
After this patch, the `bt` outputs the full frames:
 | 
			
		||||
```
 | 
			
		||||
crash> bt
 | 
			
		||||
PID: 1        TASK: ff600000000e0000  CPU: 1    COMMAND: "sh"
 | 
			
		||||
 #0 [ff20000000013cf0] lkdtm_EXCEPTION at ffffffff805303c0
 | 
			
		||||
 #1 [ff20000000013d00] lkdtm_do_action at ffffffff8052fe36
 | 
			
		||||
 #2 [ff20000000013d10] direct_entry at ffffffff80530018
 | 
			
		||||
 #3 [ff20000000013d40] full_proxy_write at ffffffff80305044
 | 
			
		||||
 #4 [ff20000000013d80] vfs_write at ffffffff801b68b4
 | 
			
		||||
 #5 [ff20000000013e30] ksys_write at ffffffff801b6c4a
 | 
			
		||||
 #6 [ff20000000013e80] __riscv_sys_write at ffffffff801b6cc4
 | 
			
		||||
 #7 [ff20000000013e90] do_trap_ecall_u at ffffffff80836798
 | 
			
		||||
crash>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
 | 
			
		||||
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 riscv64.c | 15 +++++++++++++--
 | 
			
		||||
 1 file changed, 13 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/riscv64.c b/riscv64.c
 | 
			
		||||
index 0aaa14b2671e..872be594d72b 100644
 | 
			
		||||
--- a/riscv64.c
 | 
			
		||||
+++ b/riscv64.c
 | 
			
		||||
@@ -747,11 +747,14 @@ riscv64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
 {
 | 
			
		||||
 	struct riscv64_unwind_frame current, previous;
 | 
			
		||||
 	struct stackframe curr_frame;
 | 
			
		||||
+	struct riscv64_register * regs;
 | 
			
		||||
 	int level = 0;
 | 
			
		||||
 
 | 
			
		||||
 	if (bt->flags & BT_REGS_NOT_FOUND)
 | 
			
		||||
 		return;
 | 
			
		||||
 
 | 
			
		||||
+	regs = (struct riscv64_register *) bt->machdep;
 | 
			
		||||
+
 | 
			
		||||
 	current.pc = bt->instptr;
 | 
			
		||||
 	current.sp = bt->stkptr;
 | 
			
		||||
 	current.fp = bt->frameptr;
 | 
			
		||||
@@ -788,8 +791,16 @@ riscv64_back_trace_cmd(struct bt_info *bt)
 | 
			
		||||
 		    sizeof(curr_frame), "get stack frame", RETURN_ON_ERROR))
 | 
			
		||||
 			return;
 | 
			
		||||
 
 | 
			
		||||
-		previous.pc = curr_frame.ra;
 | 
			
		||||
-		previous.fp = curr_frame.fp;
 | 
			
		||||
+		/* correct PC and FP of the second frame when the first frame has no callee */
 | 
			
		||||
+
 | 
			
		||||
+		if (regs && (regs->regs[RISCV64_REGS_EPC] == current.pc) && curr_frame.fp & 0x7){
 | 
			
		||||
+			previous.pc = regs->regs[RISCV64_REGS_RA];
 | 
			
		||||
+			previous.fp = curr_frame.ra;
 | 
			
		||||
+		} else {
 | 
			
		||||
+			previous.pc = curr_frame.ra;
 | 
			
		||||
+			previous.fp = curr_frame.fp;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
 		previous.sp = current.fp;
 | 
			
		||||
 
 | 
			
		||||
 		riscv64_dump_backtrace_entry(bt, symbol, ¤t, &previous, level++);
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,265 +0,0 @@
 | 
			
		||||
From 19d3c56c9fca9dea49dced0414becc6d1b12e9fc Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Huang Shijie <shijie@os.amperecomputing.com>
 | 
			
		||||
Date: Thu, 14 Dec 2023 15:15:20 +0800
 | 
			
		||||
Subject: [PATCH 12/14] arm64: rewrite the arm64_get_vmcoreinfo_ul to
 | 
			
		||||
 arm64_get_vmcoreinfo
 | 
			
		||||
 | 
			
		||||
Rewrite the arm64_get_vmcoreinfo_ul to arm64_get_vmcoreinfo,
 | 
			
		||||
add a new parameter "base" for it.
 | 
			
		||||
 | 
			
		||||
Also use it to simplify the arm64 code.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 arm64.c | 99 +++++++++++++++++++++++----------------------------------
 | 
			
		||||
 1 file changed, 39 insertions(+), 60 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arm64.c b/arm64.c
 | 
			
		||||
index 2b6b0e588d4e..57965c6cb3c8 100644
 | 
			
		||||
--- a/arm64.c
 | 
			
		||||
+++ b/arm64.c
 | 
			
		||||
@@ -92,6 +92,7 @@ static void arm64_get_crash_notes(void);
 | 
			
		||||
 static void arm64_calc_VA_BITS(void);
 | 
			
		||||
 static int arm64_is_uvaddr(ulong, struct task_context *);
 | 
			
		||||
 static void arm64_calc_KERNELPACMASK(void);
 | 
			
		||||
+static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base);
 | 
			
		||||
 
 | 
			
		||||
 struct kernel_range {
 | 
			
		||||
 	unsigned long modules_vaddr, modules_end;
 | 
			
		||||
@@ -124,7 +125,6 @@ void
 | 
			
		||||
 arm64_init(int when)
 | 
			
		||||
 {
 | 
			
		||||
 	ulong value;
 | 
			
		||||
-	char *string;
 | 
			
		||||
 	struct machine_specific *ms;
 | 
			
		||||
 
 | 
			
		||||
 #if defined(__x86_64__)
 | 
			
		||||
@@ -160,11 +160,8 @@ arm64_init(int when)
 | 
			
		||||
 		if (!ms->kimage_voffset && STREQ(pc->live_memsrc, "/dev/crash"))
 | 
			
		||||
 			ioctl(pc->mfd, DEV_CRASH_ARCH_DATA, &ms->kimage_voffset);
 | 
			
		||||
 
 | 
			
		||||
-		if (!ms->kimage_voffset &&
 | 
			
		||||
-		    (string = pc->read_vmcoreinfo("NUMBER(kimage_voffset)"))) {
 | 
			
		||||
-			ms->kimage_voffset = htol(string, QUIET, NULL);
 | 
			
		||||
-			free(string);
 | 
			
		||||
-		}
 | 
			
		||||
+		if (!ms->kimage_voffset)
 | 
			
		||||
+			arm64_get_vmcoreinfo(&ms->kimage_voffset, "NUMBER(kimage_voffset)", NUM_HEX);
 | 
			
		||||
 
 | 
			
		||||
 		if (ms->kimage_voffset ||
 | 
			
		||||
 		    (ACTIVE() && (symbol_value_from_proc_kallsyms("kimage_voffset") != BADVAL))) {
 | 
			
		||||
@@ -185,11 +182,8 @@ arm64_init(int when)
 | 
			
		||||
 		if (kernel_symbol_exists("kimage_voffset"))
 | 
			
		||||
 			machdep->flags |= NEW_VMEMMAP;
 | 
			
		||||
 
 | 
			
		||||
-		if (!machdep->pagesize && 
 | 
			
		||||
-		    (string = pc->read_vmcoreinfo("PAGESIZE"))) {
 | 
			
		||||
-			machdep->pagesize = atoi(string);
 | 
			
		||||
-			free(string);
 | 
			
		||||
-		}
 | 
			
		||||
+		if (!machdep->pagesize && arm64_get_vmcoreinfo(&value, "PAGESIZE", NUM_DEC))
 | 
			
		||||
+			machdep->pagesize = (unsigned int)value;
 | 
			
		||||
 
 | 
			
		||||
 		if (!machdep->pagesize) {
 | 
			
		||||
 			/*
 | 
			
		||||
@@ -443,9 +437,8 @@ arm64_init(int when)
 | 
			
		||||
 		arm64_get_section_size_bits();
 | 
			
		||||
 
 | 
			
		||||
 		if (!machdep->max_physmem_bits) {
 | 
			
		||||
-			if ((string = pc->read_vmcoreinfo("NUMBER(MAX_PHYSMEM_BITS)"))) {
 | 
			
		||||
-				machdep->max_physmem_bits = atol(string);
 | 
			
		||||
-				free(string);
 | 
			
		||||
+			if (arm64_get_vmcoreinfo(&machdep->max_physmem_bits, "NUMBER(MAX_PHYSMEM_BITS)", NUM_DEC)) {
 | 
			
		||||
+				/* nothing */
 | 
			
		||||
 			} else if (machdep->machspec->VA_BITS == 52)  /* guess */
 | 
			
		||||
 				machdep->max_physmem_bits = _MAX_PHYSMEM_BITS_52;
 | 
			
		||||
 			else if (THIS_KERNEL_VERSION >= LINUX(3,17,0)) 
 | 
			
		||||
@@ -573,16 +566,28 @@ static int arm64_get_struct_page_max_shift(struct machine_specific *ms)
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /* Return TRUE if we succeed, return FALSE on failure. */
 | 
			
		||||
-static int arm64_get_vmcoreinfo_ul(unsigned long *vaddr, const char* label)
 | 
			
		||||
+static int
 | 
			
		||||
+arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base)
 | 
			
		||||
 {
 | 
			
		||||
+	int err = 0;
 | 
			
		||||
 	char *string = pc->read_vmcoreinfo(label);
 | 
			
		||||
 
 | 
			
		||||
 	if (!string)
 | 
			
		||||
 		return FALSE;
 | 
			
		||||
 
 | 
			
		||||
-	*vaddr  = strtoul(string, NULL, 0);
 | 
			
		||||
+	switch (base) {
 | 
			
		||||
+	case NUM_HEX:
 | 
			
		||||
+		*vaddr  = strtoul(string, NULL, 16);
 | 
			
		||||
+		break;
 | 
			
		||||
+	case NUM_DEC:
 | 
			
		||||
+		*vaddr  = strtoul(string, NULL, 10);
 | 
			
		||||
+		break;
 | 
			
		||||
+	default:
 | 
			
		||||
+		err++;
 | 
			
		||||
+		error(INFO, "Unknown type:%#x, (NUM_HEX|NUM_DEC)\n", base);
 | 
			
		||||
+	}
 | 
			
		||||
 	free(string);
 | 
			
		||||
-	return TRUE;
 | 
			
		||||
+	return err ? FALSE: TRUE;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
@@ -594,21 +599,21 @@ static struct kernel_range *arm64_get_range_v5_18(struct machine_specific *ms)
 | 
			
		||||
 	struct kernel_range *r = &tmp_range;
 | 
			
		||||
 
 | 
			
		||||
 	/* Get the MODULES_VADDR ~ MODULES_END */
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->modules_vaddr, "NUMBER(MODULES_VADDR)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->modules_vaddr, "NUMBER(MODULES_VADDR)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->modules_end, "NUMBER(MODULES_END)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->modules_end, "NUMBER(MODULES_END)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
 
 | 
			
		||||
 	/* Get the VMEMMAP_START ~ VMEMMAP_END */
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->vmemmap_vaddr, "NUMBER(VMEMMAP_START)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->vmemmap_vaddr, "NUMBER(VMEMMAP_START)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->vmemmap_end, "NUMBER(VMEMMAP_END)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->vmemmap_end, "NUMBER(VMEMMAP_END)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
 
 | 
			
		||||
 	/* Get the VMALLOC_START ~ VMALLOC_END */
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->vmalloc_start_addr, "NUMBER(VMALLOC_START)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->vmalloc_start_addr, "NUMBER(VMALLOC_START)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
-	if (!arm64_get_vmcoreinfo_ul(&r->vmalloc_end, "NUMBER(VMALLOC_END)"))
 | 
			
		||||
+	if (!arm64_get_vmcoreinfo(&r->vmalloc_end, "NUMBER(VMALLOC_END)", NUM_HEX))
 | 
			
		||||
 		return NULL;
 | 
			
		||||
 
 | 
			
		||||
 	return r;
 | 
			
		||||
@@ -888,12 +893,7 @@ range_failed:
 | 
			
		||||
 /* Get the size of struct page {} */
 | 
			
		||||
 static void arm64_get_struct_page_size(struct machine_specific *ms)
 | 
			
		||||
 {
 | 
			
		||||
-	char *string;
 | 
			
		||||
-
 | 
			
		||||
-	string = pc->read_vmcoreinfo("SIZE(page)");
 | 
			
		||||
-	if (string)
 | 
			
		||||
-		ms->struct_page_size = atol(string);
 | 
			
		||||
-	free(string);
 | 
			
		||||
+	arm64_get_vmcoreinfo(&ms->struct_page_size, "SIZE(page)", NUM_DEC);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
@@ -1469,16 +1469,12 @@ arm64_calc_phys_offset(void)
 | 
			
		||||
 		physaddr_t paddr;
 | 
			
		||||
 		ulong vaddr;
 | 
			
		||||
 		struct syment *sp;
 | 
			
		||||
-		char *string;
 | 
			
		||||
 
 | 
			
		||||
 		if ((machdep->flags & NEW_VMEMMAP) &&
 | 
			
		||||
 		    ms->kimage_voffset && (sp = kernel_symbol_search("memstart_addr"))) {
 | 
			
		||||
 			if (pc->flags & PROC_KCORE) {
 | 
			
		||||
-				if ((string = pc->read_vmcoreinfo("NUMBER(PHYS_OFFSET)"))) {
 | 
			
		||||
-					ms->phys_offset = htol(string, QUIET, NULL);
 | 
			
		||||
-					free(string);
 | 
			
		||||
+				if (arm64_get_vmcoreinfo(&ms->phys_offset, "NUMBER(PHYS_OFFSET)", NUM_HEX))
 | 
			
		||||
 					return;
 | 
			
		||||
-				}
 | 
			
		||||
 				vaddr = symbol_value_from_proc_kallsyms("memstart_addr");
 | 
			
		||||
 				if (vaddr == BADVAL)
 | 
			
		||||
 					vaddr = sp->value;
 | 
			
		||||
@@ -1560,9 +1556,8 @@ arm64_get_section_size_bits(void)
 | 
			
		||||
 	} else
 | 
			
		||||
 		machdep->section_size_bits = _SECTION_SIZE_BITS;
 | 
			
		||||
 
 | 
			
		||||
-	if ((string = pc->read_vmcoreinfo("NUMBER(SECTION_SIZE_BITS)"))) {
 | 
			
		||||
-		machdep->section_size_bits = atol(string);
 | 
			
		||||
-		free(string);
 | 
			
		||||
+	if (arm64_get_vmcoreinfo(&machdep->section_size_bits, "NUMBER(SECTION_SIZE_BITS)", NUM_DEC)) {
 | 
			
		||||
+		/* nothing */
 | 
			
		||||
 	} else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
 | 
			
		||||
 		if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == IKCONFIG_Y) {
 | 
			
		||||
 			if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR)
 | 
			
		||||
@@ -1581,15 +1576,11 @@ arm64_get_section_size_bits(void)
 | 
			
		||||
 static int
 | 
			
		||||
 arm64_kdump_phys_base(ulong *phys_offset)
 | 
			
		||||
 {
 | 
			
		||||
-	char *string;
 | 
			
		||||
 	struct syment *sp;
 | 
			
		||||
 	physaddr_t paddr;
 | 
			
		||||
 
 | 
			
		||||
-	if ((string = pc->read_vmcoreinfo("NUMBER(PHYS_OFFSET)"))) {
 | 
			
		||||
-		*phys_offset = htol(string, QUIET, NULL);
 | 
			
		||||
-		free(string);
 | 
			
		||||
+	if (arm64_get_vmcoreinfo(phys_offset, "NUMBER(PHYS_OFFSET)", NUM_HEX))
 | 
			
		||||
 		return TRUE;
 | 
			
		||||
-	}
 | 
			
		||||
 
 | 
			
		||||
 	if ((machdep->flags & NEW_VMEMMAP) &&
 | 
			
		||||
 	    machdep->machspec->kimage_voffset &&
 | 
			
		||||
@@ -4592,10 +4583,9 @@ static int
 | 
			
		||||
 arm64_set_va_bits_by_tcr(void)
 | 
			
		||||
 {
 | 
			
		||||
 	ulong value;
 | 
			
		||||
-	char *string;
 | 
			
		||||
 
 | 
			
		||||
-	if ((string = pc->read_vmcoreinfo("NUMBER(TCR_EL1_T1SZ)")) ||
 | 
			
		||||
-	    (string = pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
 | 
			
		||||
+	if (arm64_get_vmcoreinfo(&value, "NUMBER(TCR_EL1_T1SZ)", NUM_HEX) ||
 | 
			
		||||
+		arm64_get_vmcoreinfo(&value, "NUMBER(tcr_el1_t1sz)", NUM_HEX)) {
 | 
			
		||||
 		/* See ARMv8 ARM for the description of
 | 
			
		||||
 		 * TCR_EL1.T1SZ and how it can be used
 | 
			
		||||
 		 * to calculate the vabits_actual
 | 
			
		||||
@@ -4604,10 +4594,9 @@ arm64_set_va_bits_by_tcr(void)
 | 
			
		||||
 		 * Basically:
 | 
			
		||||
 		 * vabits_actual = 64 - T1SZ;
 | 
			
		||||
 		 */
 | 
			
		||||
-		value = 64 - strtoll(string, NULL, 0);
 | 
			
		||||
+		value = 64 - value;
 | 
			
		||||
 		if (CRASHDEBUG(1))
 | 
			
		||||
 			fprintf(fp,  "vmcoreinfo : vabits_actual: %ld\n", value);
 | 
			
		||||
-		free(string);
 | 
			
		||||
 		machdep->machspec->VA_BITS_ACTUAL = value;
 | 
			
		||||
 		machdep->machspec->VA_BITS = value;
 | 
			
		||||
 		machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
 | 
			
		||||
@@ -4623,13 +4612,8 @@ arm64_calc_VA_BITS(void)
 | 
			
		||||
 	int bitval;
 | 
			
		||||
 	struct syment *sp;
 | 
			
		||||
 	ulong vabits_actual, value;
 | 
			
		||||
-	char *string;
 | 
			
		||||
 
 | 
			
		||||
-	if ((string = pc->read_vmcoreinfo("NUMBER(VA_BITS)"))) {
 | 
			
		||||
-		value = atol(string);
 | 
			
		||||
-		free(string);
 | 
			
		||||
-		machdep->machspec->CONFIG_ARM64_VA_BITS = value;
 | 
			
		||||
-	}
 | 
			
		||||
+	arm64_get_vmcoreinfo(&machdep->machspec->CONFIG_ARM64_VA_BITS, "NUMBER(VA_BITS)", NUM_DEC);
 | 
			
		||||
 
 | 
			
		||||
 	if (kernel_symbol_exists("vabits_actual")) {
 | 
			
		||||
 		if (pc->flags & PROC_KCORE) {
 | 
			
		||||
@@ -4754,9 +4738,7 @@ arm64_calc_virtual_memory_ranges(void)
 | 
			
		||||
 	ulong PUD_SIZE = UNINITIALIZED;
 | 
			
		||||
 
 | 
			
		||||
 	if (!machdep->machspec->CONFIG_ARM64_VA_BITS) {
 | 
			
		||||
-		if ((string = pc->read_vmcoreinfo("NUMBER(VA_BITS)"))) {
 | 
			
		||||
-			value = atol(string);
 | 
			
		||||
-			free(string);
 | 
			
		||||
+		if (arm64_get_vmcoreinfo(&value, "NUMBER(VA_BITS)", NUM_DEC)) {
 | 
			
		||||
 			machdep->machspec->CONFIG_ARM64_VA_BITS = value;
 | 
			
		||||
 		} else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
 | 
			
		||||
 			if ((ret = get_kernel_config("CONFIG_ARM64_VA_BITS",
 | 
			
		||||
@@ -4852,11 +4834,8 @@ arm64_swp_offset(ulong pte)
 | 
			
		||||
 static void arm64_calc_KERNELPACMASK(void)
 | 
			
		||||
 {
 | 
			
		||||
 	ulong value;
 | 
			
		||||
-	char *string;
 | 
			
		||||
 
 | 
			
		||||
-	if ((string = pc->read_vmcoreinfo("NUMBER(KERNELPACMASK)"))) {
 | 
			
		||||
-		value = htol(string, QUIET, NULL);
 | 
			
		||||
-		free(string);
 | 
			
		||||
+	if (arm64_get_vmcoreinfo(&value, "NUMBER(KERNELPACMASK)", NUM_HEX)) {
 | 
			
		||||
 		machdep->machspec->CONFIG_ARM64_KERNELPACMASK = value;
 | 
			
		||||
 		if (CRASHDEBUG(1))
 | 
			
		||||
 			fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n", value);
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,36 +0,0 @@
 | 
			
		||||
From 38435c3acec075b076353ca28f557a0dfe1341c3 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Li Zhijian <lizhijian@fujitsu.com>
 | 
			
		||||
Date: Fri, 15 Dec 2023 10:44:21 +0800
 | 
			
		||||
Subject: [PATCH 13/14] help.c: Remove "kmem -l" help messages
 | 
			
		||||
 | 
			
		||||
"kmem -l" option has existed when crash git project initialization, but
 | 
			
		||||
its help message was not accurate (extra arguments a|i|ic|id was missing).
 | 
			
		||||
 | 
			
		||||
In addition, those symbols required by the -l option were for very old
 | 
			
		||||
kernels, at least 2.6 kernels don't contain them.  Also, this option has
 | 
			
		||||
not been fixed for a long time.
 | 
			
		||||
 | 
			
		||||
Instead of document this option, hide it from help messages.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 help.c | 2 --
 | 
			
		||||
 1 file changed, 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/help.c b/help.c
 | 
			
		||||
index cc7ab20e343e..d80e843703c1 100644
 | 
			
		||||
--- a/help.c
 | 
			
		||||
+++ b/help.c
 | 
			
		||||
@@ -6888,8 +6888,6 @@ char *help_kmem[] = {
 | 
			
		||||
 "            members of the associated page struct are displayed.",
 | 
			
		||||
 "   address  when used with -c, the address must be a page pointer address;",
 | 
			
		||||
 "            the page_hash_table entry containing the page is displayed.",
 | 
			
		||||
-"   address  when used with -l, the address must be a page pointer address;",
 | 
			
		||||
-"            the page address is displayed if it is contained with the list.",
 | 
			
		||||
 "   address  when used with -v, the address can be a mapped kernel virtual",
 | 
			
		||||
 "            address or physical address; the mapped region containing the",
 | 
			
		||||
 "            address is displayed.\n",
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,65 +0,0 @@
 | 
			
		||||
From 53d2577cef98b76b122aade94349637a11e06138 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Date: Tue, 26 Dec 2023 09:19:28 +0800
 | 
			
		||||
Subject: [PATCH 14/14] x86_64: check bt->bptr before calculate framesize
 | 
			
		||||
 | 
			
		||||
Previously the value of bt->bptr is not checked, which may led to a
 | 
			
		||||
wrong prev_sp and framesize. As a result, bt->stackbuf[] will be
 | 
			
		||||
accessed out of range, and segfault.
 | 
			
		||||
 | 
			
		||||
Before:
 | 
			
		||||
  crash> set debug 1
 | 
			
		||||
  crash> bt
 | 
			
		||||
  ...snip...
 | 
			
		||||
  --- <NMI exception stack> ---
 | 
			
		||||
   #8 [ffffffff9a603e10] __switch_to_asm at ffffffff99800214
 | 
			
		||||
  rsp: ffffffff9a603e10 textaddr: ffffffff99800214 -> spo: 0 bpo: 0 spr: 0 bpr: 0 type: 0 end: 0
 | 
			
		||||
   #9 [ffffffff9a603e40] __schedule at ffffffff9960dfb1
 | 
			
		||||
  rsp: ffffffff9a603e40 textaddr: ffffffff9960dfb1 -> spo: 16 bpo: -16 spr: 4 bpr: 1 type: 0 end: 0
 | 
			
		||||
  rsp: ffffffff9a603e40 rbp: ffffb9ca076e7ca8 prev_sp: ffffb9ca076e7cb8 framesize: 1829650024
 | 
			
		||||
  Segmentation fault (core dumped)
 | 
			
		||||
 | 
			
		||||
  (gdb) p/x bt->stackbase
 | 
			
		||||
  $1 = 0xffffffff9a600000
 | 
			
		||||
  (gdb) p/x bt->stacktop
 | 
			
		||||
  $2 = 0xffffffff9a604000
 | 
			
		||||
 | 
			
		||||
After:
 | 
			
		||||
  crash> set debug 1
 | 
			
		||||
  crash> bt
 | 
			
		||||
  ...snip...
 | 
			
		||||
  --- <NMI exception stack> ---
 | 
			
		||||
   #8 [ffffffff9a603e10] __switch_to_asm at ffffffff99800214
 | 
			
		||||
  rsp: ffffffff9a603e10 textaddr: ffffffff99800214 -> spo: 0 bpo: 0 spr: 0 bpr: 0 type: 0 end: 0
 | 
			
		||||
   #9 [ffffffff9a603e40] __schedule at ffffffff9960dfb1
 | 
			
		||||
  rsp: ffffffff9a603e40 textaddr: ffffffff9960dfb1 -> spo: 16 bpo: -16 spr: 4 bpr: 1 type: 0 end: 0
 | 
			
		||||
   #10 [ffffffff9a603e98] schedule_idle at ffffffff9960e87c
 | 
			
		||||
  rsp: ffffffff9a603e98 textaddr: ffffffff9960e87c -> spo: 8 bpo: 0 spr: 5 bpr: 0 type: 0 end: 0
 | 
			
		||||
  rsp: ffffffff9a603e98 prev_sp: ffffffff9a603ea8 framesize: 0
 | 
			
		||||
  ...snip...
 | 
			
		||||
 | 
			
		||||
Check bt->bptr value before calculate framesize. Only bt->bptr within
 | 
			
		||||
the range of bt->stackbase and bt->stacktop will be regarded as valid.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Tao Liu <ltao@redhat.com>
 | 
			
		||||
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
 | 
			
		||||
---
 | 
			
		||||
 x86_64.c | 2 +-
 | 
			
		||||
 1 file changed, 1 insertion(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/x86_64.c b/x86_64.c
 | 
			
		||||
index 42ade4817ad9..f59991f8c4c5 100644
 | 
			
		||||
--- a/x86_64.c
 | 
			
		||||
+++ b/x86_64.c
 | 
			
		||||
@@ -8649,7 +8649,7 @@ x86_64_get_framesize(struct bt_info *bt, ulong textaddr, ulong rsp, char *stack_
 | 
			
		||||
 				if (CRASHDEBUG(1))
 | 
			
		||||
 					fprintf(fp, "rsp: %lx prev_sp: %lx framesize: %d\n",
 | 
			
		||||
 							rsp, prev_sp, framesize);
 | 
			
		||||
-			} else if ((korc->sp_reg == ORC_REG_BP) && bt->bptr) {
 | 
			
		||||
+			} else if ((korc->sp_reg == ORC_REG_BP) && bt->bptr && INSTACK(bt->bptr, bt)) {
 | 
			
		||||
 				prev_sp = bt->bptr + korc->sp_offset;
 | 
			
		||||
 				framesize = (prev_sp - (rsp + 8) - 8);
 | 
			
		||||
 				if (CRASHDEBUG(1))
 | 
			
		||||
-- 
 | 
			
		||||
2.41.0
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
--- crash-8.0.4/Makefile.orig
 | 
			
		||||
+++ crash-8.0.4/Makefile
 | 
			
		||||
--- crash-9.0.0/Makefile.orig
 | 
			
		||||
+++ crash-9.0.0/Makefile
 | 
			
		||||
@@ -204,7 +204,7 @@ GDB_FLAGS=
 | 
			
		||||
 # TARGET_CFLAGS will be configured automatically by configure
 | 
			
		||||
 TARGET_CFLAGS=
 | 
			
		||||
@ -18,8 +18,8 @@
 | 
			
		||||
 	@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
 | 
			
		||||
 	@rm -f ${PROGRAM}
 | 
			
		||||
 	@if [ ! -f ${GDB}/config.status ]; then \
 | 
			
		||||
--- crash-8.0.4/configure.c.orig
 | 
			
		||||
+++ crash-8.0.4/configure.c
 | 
			
		||||
--- crash-9.0.0/configure.c.orig
 | 
			
		||||
+++ crash-9.0.0/configure.c
 | 
			
		||||
@@ -810,7 +810,8 @@ build_configure(struct supported_gdb_version *sp)
 | 
			
		||||
                         fprintf(fp2, "%s\n", sp->GDB);
 | 
			
		||||
                         sprintf(target_data.gdb_version, "%s", &sp->GDB[4]);
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
--- crash-8.0.4/Makefile.orig
 | 
			
		||||
+++ crash-8.0.4/Makefile
 | 
			
		||||
--- crash-9.0.0/Makefile.orig
 | 
			
		||||
+++ crash-9.0.0/Makefile
 | 
			
		||||
@@ -256,7 +256,7 @@ all: make_configure
 | 
			
		||||
 gdb_merge: force
 | 
			
		||||
 	@if [ ! -f ${GDB}/README ]; then \
 | 
			
		||||
@ -9,8 +9,8 @@
 | 
			
		||||
 	@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
 | 
			
		||||
 	@rm -f ${PROGRAM}
 | 
			
		||||
 	@if [ ! -f ${GDB}/config.status ]; then \
 | 
			
		||||
--- crash-8.0.4/diskdump.c.orig
 | 
			
		||||
+++ crash-8.0.4/diskdump.c
 | 
			
		||||
--- crash-9.0.0/diskdump.c.orig
 | 
			
		||||
+++ crash-9.0.0/diskdump.c
 | 
			
		||||
@@ -23,6 +23,9 @@
 | 
			
		||||
  * GNU General Public License for more details.
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										567
									
								
								SPECS/crash.spec
									
									
									
									
									
								
							
							
						
						
									
										567
									
								
								SPECS/crash.spec
									
									
									
									
									
								
							@ -3,36 +3,37 @@
 | 
			
		||||
#
 | 
			
		||||
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
 | 
			
		||||
Name: crash
 | 
			
		||||
Version: 8.0.4
 | 
			
		||||
Release: 2%{?dist}.alma
 | 
			
		||||
Version: 9.0.0
 | 
			
		||||
Release: 4%{?dist}.alma.1
 | 
			
		||||
License: GPLv3
 | 
			
		||||
Group: Development/Debuggers
 | 
			
		||||
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
 | 
			
		||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
 | 
			
		||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-16.2.tar.gz
 | 
			
		||||
URL: https://crash-utility.github.io
 | 
			
		||||
ExclusiveOS: Linux
 | 
			
		||||
ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} aarch64 ppc64le
 | 
			
		||||
BuildRequires: ncurses-devel zlib-devel lzo-devel bison snappy-devel wget patch texinfo libzstd-devel
 | 
			
		||||
BuildRequires: gcc gcc-c++ make
 | 
			
		||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel bison texinfo libzstd-devel
 | 
			
		||||
BuildRequires: make gcc gcc-c++
 | 
			
		||||
BuildRequires: gmp-devel mpfr-devel
 | 
			
		||||
Requires: binutils
 | 
			
		||||
Provides: bundled(libiberty)
 | 
			
		||||
Provides: bundled(gdb) = 10.2
 | 
			
		||||
Provides: bundled(gdb) = 16.2
 | 
			
		||||
Patch0: lzo_snappy_zstd.patch
 | 
			
		||||
Patch1: crash-8.0.4_build.patch
 | 
			
		||||
Patch2: 0001-Fix-rd-command-for-zram-data-display-in-Linux-6.2-an.patch
 | 
			
		||||
Patch3: 0002-Fix-typos-in-offset_table-and-missing-help-o-items.patch
 | 
			
		||||
Patch4: 0003-zram-Fixes-for-lookup_swap_cache.patch
 | 
			
		||||
Patch5: 0004-symbols-expand-all-kernel-module-symtable-if-not-all.patch
 | 
			
		||||
Patch6: 0005-symbols-skip-load-.init.-sections-if-module-was-succ.patch
 | 
			
		||||
Patch7: 0006-use-NR_SWAPCACHE-when-nr_swapper_spaces-isn-t-availa.patch
 | 
			
		||||
Patch8: 0007-Fix-identity_map_base-value-dump-on-S390.patch
 | 
			
		||||
Patch9: 0008-s390x-fix-virtual-vs-physical-address-confusion.patch
 | 
			
		||||
Patch10: 0009-s390x-uncouple-physical-and-virtual-memory-spaces.patch
 | 
			
		||||
Patch11: 0010-RISCV64-Dump-NT_PRSTATUS-in-help-n.patch
 | 
			
		||||
Patch12: 0011-RISCV64-Fix-bt-output-when-no-ra-on-the-stack-top.patch
 | 
			
		||||
Patch13: 0012-arm64-rewrite-the-arm64_get_vmcoreinfo_ul-to-arm64_g.patch
 | 
			
		||||
Patch14: 0013-help.c-Remove-kmem-l-help-messages.patch
 | 
			
		||||
Patch15: 0014-x86_64-check-bt-bptr-before-calculate-framesize.patch
 | 
			
		||||
Patch1: crash-9.0.0_build.patch
 | 
			
		||||
Patch2: 0001-vmware_guestdump-Version-7-support.patch
 | 
			
		||||
Patch3: 0002-Fix-incorrect-task-state-during-exit.patch
 | 
			
		||||
Patch4: 0003-Add-multi-threads-support-in-crash-target.patch
 | 
			
		||||
Patch5: 0004-Call-cmd_bt-silently-after-set-pid.patch
 | 
			
		||||
Patch6: 0005-x86_64-Add-gdb-multi-stack-unwind-support.patch
 | 
			
		||||
Patch7: 0006-arm64-Add-gdb-multi-stack-unwind-support.patch
 | 
			
		||||
Patch8: 0007-ppc64-Add-gdb-multi-stack-unwind-support.patch
 | 
			
		||||
Patch9: 0008-Fix-the-issue-of-page-excluded-messages-flooding.patch
 | 
			
		||||
Patch10: 0009-Fix-kmem-p-option-on-Linux-6.16-rc1-and-later-kernel.patch
 | 
			
		||||
Patch11: 0001-x86_64-filter-unwanted-warning-message-for-bt-T-cmd.patch
 | 
			
		||||
Patch12: 0002-doc-Update-requirements-for-building-on-Fedora.patch
 | 
			
		||||
Patch13: 0003-gdb-Fix-a-regression-for-eppic-extension-on-gdb-16.2.patch
 | 
			
		||||
Patch14: 0004-Fix-crash-initialization-failure-on-LoongArch-with-r.patch
 | 
			
		||||
Patch15: 0005-gdb-Disable-DT_DEBUG-lookup-by-GDB-inside-the-vmcore.patch
 | 
			
		||||
Patch16: 0001-Add-blk_mq-shared-tags-support-for-dev-d-D.patch
 | 
			
		||||
 | 
			
		||||
%description
 | 
			
		||||
The core analysis suite is a self-contained tool that can be used to
 | 
			
		||||
@ -41,9 +42,8 @@ netdump, diskdump and kdump packages from AlmaLinux, the mcore kernel patch
 | 
			
		||||
offered by Mission Critical Linux, or the LKCD kernel patch.
 | 
			
		||||
 | 
			
		||||
%package devel
 | 
			
		||||
Requires: %{name} = %{version}, zlib-devel lzo-devel snappy-devel
 | 
			
		||||
Requires: %{name} = %{version}, zlib-devel
 | 
			
		||||
Summary: kernel crash analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
 | 
			
		||||
Group: Development/Debuggers
 | 
			
		||||
 | 
			
		||||
%description devel
 | 
			
		||||
The core analysis suite is a self-contained tool that can be used to
 | 
			
		||||
@ -54,7 +54,7 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
 | 
			
		||||
%prep
 | 
			
		||||
%setup -n %{name}-%{version} -q
 | 
			
		||||
%patch -P 0 -p1 -b lzo_snappy_zstd.patch
 | 
			
		||||
%patch -P 1 -p1 -b crash-8.0.4_build.patch
 | 
			
		||||
%patch -P 1 -p1 -b crash-9.0.0_build.patch
 | 
			
		||||
%patch -P 2 -p1
 | 
			
		||||
%patch -P 3 -p1
 | 
			
		||||
%patch -P 4 -p1
 | 
			
		||||
@ -69,8 +69,10 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
 | 
			
		||||
%patch -P 13 -p1
 | 
			
		||||
%patch -P 14 -p1
 | 
			
		||||
%patch -P 15 -p1
 | 
			
		||||
%patch -P 16 -p1
 | 
			
		||||
 | 
			
		||||
%build
 | 
			
		||||
 | 
			
		||||
cp %{SOURCE1} .
 | 
			
		||||
make -j`nproc` RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
 | 
			
		||||
 | 
			
		||||
@ -84,9 +86,6 @@ mkdir -p %{buildroot}%{_includedir}/crash
 | 
			
		||||
chmod 0644 defs.h
 | 
			
		||||
cp -p defs.h %{buildroot}%{_includedir}/crash
 | 
			
		||||
 | 
			
		||||
%clean
 | 
			
		||||
rm -rf %{buildroot}
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%{_bindir}/crash
 | 
			
		||||
%{_mandir}/man8/crash.8*
 | 
			
		||||
@ -96,405 +95,287 @@ rm -rf %{buildroot}
 | 
			
		||||
%{_includedir}/*
 | 
			
		||||
 | 
			
		||||
%changelog
 | 
			
		||||
* Wed Mar 27 2024 Eduard Abdullin <eabdullin@almalinux.org> - 8.0.4-2.alma
 | 
			
		||||
- AlmaLinux changes
 | 
			
		||||
* Mon Sep 15 2025 Eduard Abdullin <eabdullin@almalinux.org> - 9.0.0-4.alma.1
 | 
			
		||||
- Debrand for AlmaLinux
 | 
			
		||||
 | 
			
		||||
* Wed Aug 6 2025 Tao Liu <ltao@redhat.com> - 9.0.0-4
 | 
			
		||||
- Add blk_mq shared tags support for dev -d/-D
 | 
			
		||||
 | 
			
		||||
* Mon Jul 28 2025 Lianbo Jiang <lijiang@redhat.com> - 9.0.0-3
 | 
			
		||||
- x86_64: filter unwanted warning message for "bt -T" cmd
 | 
			
		||||
- doc: Update requirements for building on Fedora
 | 
			
		||||
- gdb: Fix a regression for eppic extension on gdb-16.2
 | 
			
		||||
- Fix crash initialization failure on LoongArch with recent GDB versions
 | 
			
		||||
- gdb: Disable DT_DEBUG lookup by GDB inside the vmcore
 | 
			
		||||
 | 
			
		||||
* Tue Jul 01 2025 Lianbo Jiang <lijiang@redhat.com> - 9.0.0-2
 | 
			
		||||
- vmware_guestdump: Version 7 support
 | 
			
		||||
- Fix incorrect task state during exit
 | 
			
		||||
- Add multi-threads support in crash target
 | 
			
		||||
- Call cmd_bt silently after "set pid"
 | 
			
		||||
- x86_64: Add gdb multi-stack unwind support
 | 
			
		||||
- arm64: Add gdb multi-stack unwind support
 | 
			
		||||
- ppc64: Add gdb multi-stack unwind support
 | 
			
		||||
- Fix the issue of "page excluded" messages flooding
 | 
			
		||||
- Fix "kmem -p" option on Linux 6.16-rc1 and later kernels
 | 
			
		||||
 | 
			
		||||
* Mon Apr 28 2025 Lianbo Jiang <lijiang@redhat.com> - 9.0.0-1
 | 
			
		||||
- Rebase to upstream crash 9.0.0
 | 
			
		||||
 | 
			
		||||
* Thu Nov 14 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.6-1
 | 
			
		||||
- Rebase to upstream crash 8.0.6
 | 
			
		||||
 | 
			
		||||
* Sat May 11 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.5-1
 | 
			
		||||
- Rebase to upstream crash 8.0.5
 | 
			
		||||
 | 
			
		||||
* Mon Feb 05 2024 Tao Liu <ltao@redhat.com> - 8.0.4-3
 | 
			
		||||
- Fix bt takes many minutes on some pids in some vmcore
 | 
			
		||||
 | 
			
		||||
* Tue Jan 02 2024 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-2
 | 
			
		||||
- Fix the "dis -lr" not displaying the source file names
 | 
			
		||||
  and line numbers
 | 
			
		||||
- Fix incorrect symbol translation by the 'struct blk_mq_ops'
 | 
			
		||||
* Fri Nov 17 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-1
 | 
			
		||||
 | 
			
		||||
* Thu Nov 16 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.4-1
 | 
			
		||||
- Rebase to upstream crash 8.0.4
 | 
			
		||||
 | 
			
		||||
* Thu Sep 07 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-1
 | 
			
		||||
- Rebase to upstream crash-utility 8.0.3
 | 
			
		||||
- Backport the latest patches from upstream crash-utility
 | 
			
		||||
* Thu May 04 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.3-1
 | 
			
		||||
- Rebase to upstream crash 8.0.3
 | 
			
		||||
 | 
			
		||||
* Thu Jun 15 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-8
 | 
			
		||||
- arm64: Fix again segfault in arm64_is_kernel_exception_frame()
 | 
			
		||||
- Fix invalid structure size error during crash startup on ppc64
 | 
			
		||||
* Wed Jun 07 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-7
 | 
			
		||||
- Fix segfault caused by failure of stopping CPUs
 | 
			
		||||
* Mon Feb 20 2023 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-2
 | 
			
		||||
- Fix an assertion failure in the gdb's copy_type()
 | 
			
		||||
- Fix for "bt" command printing "bogus exception frame" warning
 | 
			
		||||
 | 
			
		||||
* Mon May 08 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-6
 | 
			
		||||
- Fix for freelist pointer on PPC64le, ARM64 and S390x
 | 
			
		||||
* Thu Nov 17 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.2-1
 | 
			
		||||
- Rebase to upstream crash 8.0.2
 | 
			
		||||
 | 
			
		||||
* Mon May 08 2023 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-5
 | 
			
		||||
- Update to the latest upstream commit 47216437e79a
 | 
			
		||||
- ("Fix "net" command on kernel configured with CONFIG_IPV6=m")
 | 
			
		||||
* Fri Jun 10 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-2
 | 
			
		||||
- Fix for the "struct -o" command issue
 | 
			
		||||
- Enhance the "dev -d" and "bt" commands
 | 
			
		||||
 | 
			
		||||
* Mon Nov 21 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-4
 | 
			
		||||
- Fix for commit 2145b2bb79c5, there are different behaviors between gdb-7.6 and gdb-10.2
 | 
			
		||||
* Thu Nov 17 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-3
 | 
			
		||||
- Update to the latest commit a158590f475c from master branch
 | 
			
		||||
* Sat May 14 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.1-1
 | 
			
		||||
- Rebase to upstream crash 8.0.1
 | 
			
		||||
 | 
			
		||||
* Thu Jun 16 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-2
 | 
			
		||||
- Enhance "dev -d|-D" options to support blk-mq sbitmap
 | 
			
		||||
* Mon May 16 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.2-1
 | 
			
		||||
- Rebase to upstream crash 7.3.2
 | 
			
		||||
 | 
			
		||||
* Tue Feb 08 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-5
 | 
			
		||||
- Rebuild for osci badfuncs issue
 | 
			
		||||
 | 
			
		||||
* Mon Feb 07 2022 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-4
 | 
			
		||||
* Mon Feb 07 2022 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-5
 | 
			
		||||
- Fix segfault on aarch64 for "bt -a|-c" command
 | 
			
		||||
- Fix segfault for the "l" command of gdb
 | 
			
		||||
- Fix HZ calculation on Linux 5.14 and later
 | 
			
		||||
- Fix for "timer -r" option to display all the per-CPU clocks
 | 
			
		||||
- Fix for other issues
 | 
			
		||||
 | 
			
		||||
* Mon Dec 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-3
 | 
			
		||||
* Wed Dec 29 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-4
 | 
			
		||||
- Handle blk_mq_ctx member changes for kernels 5.16-rc1 and later
 | 
			
		||||
 | 
			
		||||
* Mon Dec 13 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-3
 | 
			
		||||
- Fix segmentation fault caused by crash extension modules
 | 
			
		||||
- Support the overflow stack exception handling on aarch64
 | 
			
		||||
 | 
			
		||||
* Tue Dec 07 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-2
 | 
			
		||||
* Mon Dec 06 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-2
 | 
			
		||||
- Enable ZSTD feature support
 | 
			
		||||
 | 
			
		||||
* Fri Nov 26 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.1-1
 | 
			
		||||
- Rebase to the latest crash-7.3.1
 | 
			
		||||
* Thu Nov 25 2021 Lianbo Jiang <lijiang@redhat.com> - 8.0.0-1
 | 
			
		||||
- Rebase to upstream 8.0.0
 | 
			
		||||
 | 
			
		||||
* Thu Nov 18 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-3
 | 
			
		||||
- Fix for "sched: Change task_struct::state"
 | 
			
		||||
- Fix for "sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y"
 | 
			
		||||
- Fix live debugging with lockdown=integrity
 | 
			
		||||
- Fix 'waitq' command for Linux 4.13 and later kernels
 | 
			
		||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 7.3.0-6
 | 
			
		||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
 | 
			
		||||
  Related: rhbz#1991688
 | 
			
		||||
 | 
			
		||||
* Thu Jul 22 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-5
 | 
			
		||||
- Fix for handling task_struct state member changes(kernels >= 5.14-rc1)
 | 
			
		||||
 | 
			
		||||
* Wed Jul 07 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-4
 | 
			
		||||
- Fix memory layout for aarch64
 | 
			
		||||
 | 
			
		||||
* Mon Jul 05 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-3
 | 
			
		||||
- Fix "kmem -n|-p" options display wrong values.
 | 
			
		||||
 | 
			
		||||
* Fri Jun 11 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-2
 | 
			
		||||
- Fix for "kmem -s|-S" option on Linux 5.7 and later kernels
 | 
			
		||||
 | 
			
		||||
* Fri May 14 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-2
 | 
			
		||||
- Update the sha512 hash in the sources file to solve the
 | 
			
		||||
  compilation issues
 | 
			
		||||
 | 
			
		||||
* Thu May 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
 | 
			
		||||
* Mon May 10 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-1
 | 
			
		||||
- Rebase to upstream 7.3.0
 | 
			
		||||
 | 
			
		||||
* Tue Dec 1 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.9-2
 | 
			
		||||
- Fix the sources file to add gdb-7.6 tarball
 | 
			
		||||
  [The line was somehow removed when using rhpkg new-sources to
 | 
			
		||||
   update the crash tarball location]
 | 
			
		||||
  Resolves: rhbz#1881854
 | 
			
		||||
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 7.2.9-7
 | 
			
		||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
 | 
			
		||||
 | 
			
		||||
* Tue Dec 1 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.9-1
 | 
			
		||||
- Rebase to upstream crash version 7.2.9
 | 
			
		||||
- Also minimize the rhel-only patches to the bare minimum.
 | 
			
		||||
  Resolves: rhbz#1881854
 | 
			
		||||
* Tue Apr 13 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-6
 | 
			
		||||
- Update to the latest upstream: commit <8dfc228b29ae>
 | 
			
		||||
 | 
			
		||||
* Thu Nov 5 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-8
 | 
			
		||||
- crash/arm64: Fix arm64 read error with 'idmap_ptrs_per_pgd' symbol with debug kernel
 | 
			
		||||
  Resolves: rhbz#1876039
 | 
			
		||||
* Mon Mar 08 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-5
 | 
			
		||||
- Fix Segmentation fault
 | 
			
		||||
- Update to the latest upstream: commit <9c0c6c1b3750>
 | 
			
		||||
 | 
			
		||||
* Mon Aug 17 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-7
 | 
			
		||||
- crash/sadump, kaslr: fix failure of calculating kaslr_offset due to an sadump format restriction
 | 
			
		||||
  Resolves: rhbz#1855527
 | 
			
		||||
* Fri Feb 05 2021 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-4
 | 
			
		||||
- Update to the latest upstream: commit <fdb41f0b6fa4>
 | 
			
		||||
 | 
			
		||||
* Fri Aug 7 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-6
 | 
			
		||||
- aarch64: Revert to reading CONFIG_ARM64_USER_VA_BITS_52 and CONFIG_ARM64_PA_BITS=52 for 52-bit VA/PA space.
 | 
			
		||||
  Resolves: rhbz#1861086
 | 
			
		||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.9-3
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Jul 27 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-5
 | 
			
		||||
- aarch64: Support reading extended 52-bit address space via crash-utility
 | 
			
		||||
  Resolves: rhbz#1861086
 | 
			
		||||
* Fri Dec 11 2020 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-2
 | 
			
		||||
- Add support for lockless ringbuffer
 | 
			
		||||
 | 
			
		||||
* Fri Jul 10 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-4
 | 
			
		||||
- Replace people.redhat.com references with github equivalents.
 | 
			
		||||
  Resolves: rhbz#1851745
 | 
			
		||||
* Wed Nov 25 2020 Lianbo Jiang <lijiang@redhat.com> - 7.2.9-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Mon Jun 22 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-3
 | 
			
		||||
- Fix for reading compressed kdump dumpfiles from systems with physical memory
 | 
			
		||||
  Resolves: rhbz#1819606
 | 
			
		||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.8-5
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Jun 8 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-2
 | 
			
		||||
- Remove wget from BuildRequires section
 | 
			
		||||
  Resolves: rhbz#1838322
 | 
			
		||||
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 7.2.8-4
 | 
			
		||||
- Use make macros
 | 
			
		||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
 | 
			
		||||
 | 
			
		||||
* Fri Jun 5 2020 Bhupesh Sharma <bhsharma@redhat.com> - 7.2.8-1
 | 
			
		||||
- Rebase to latest upstream release 7.2.8
 | 
			
		||||
  Resolves: rhbz#1838322
 | 
			
		||||
* Tue Jun 30 2020 Jeff Law <law@redhat.com> - 7.2.8-3
 | 
			
		||||
- Disable LTO
 | 
			
		||||
 | 
			
		||||
* Mon Feb  3 2020 Dave Anderson <anderson@redhat.com> - 7.2.7-3
 | 
			
		||||
- Rebase to github commit 6c1c8ac6
 | 
			
		||||
  Resolves: rhbz#1738619
 | 
			
		||||
- Fix "log -a" option
 | 
			
		||||
  Resolves: rhbz#1785537
 | 
			
		||||
- Fix for ELF kdump vmcores form s390x KASLR kernels
 | 
			
		||||
  Resolves: rhbz#1786996
 | 
			
		||||
* Fri Jan 31 2020 Dave Anderson <anderson@redhat.com> - 7.2.8-2
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Fix aarch64 build for gcc-10 -fno-common
 | 
			
		||||
 | 
			
		||||
* Mon Nov 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.7-2
 | 
			
		||||
- Rebase to latest upstream sources
 | 
			
		||||
  Resolves: rhbz#1738619
 | 
			
		||||
- Support for KASLR on s390x
 | 
			
		||||
  Resolves: rhbz# 1753172
 | 
			
		||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.7-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Jun 10 2019 Dave Anderson <anderson@redhat.com> - 7.2.6-2
 | 
			
		||||
- Fix "p" command regression
 | 
			
		||||
  Resolves: rhbz#1718417  
 | 
			
		||||
- Fix arm64 debug kernel read error message during initialization
 | 
			
		||||
  Resolves: rhbz#1718736 
 | 
			
		||||
* Mon Sep 23 2019 Dave Anderson <anderson@redhat.com> - 7.2.7-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.6-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon May  6 2019 Dave Anderson <anderson@redhat.com> - 7.2.6-1
 | 
			
		||||
- Rebase to latest upstream sources
 | 
			
		||||
  Resolves: rhbz#1686560 
 | 
			
		||||
- Utilize the VMCOREINFO PT_NOTE in /proc/kcore header
 | 
			
		||||
  Resolves: rhbz#1627528
 | 
			
		||||
- Support extraction of CONFIG_PROC_VMCORE_DEVICE_DUMP data from dumpfile header
 | 
			
		||||
  Resolves: rhbz#1702535
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Thu Feb 14 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-18
 | 
			
		||||
- Fix "files -c" and "files -p" options
 | 
			
		||||
  Resolves: rhbz#1673285
 | 
			
		||||
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 7.2.5-3
 | 
			
		||||
- Rebuild for readline 8.0
 | 
			
		||||
 | 
			
		||||
* Mon Feb 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-17
 | 
			
		||||
- Support for CONFIG_ARM64_USER_VA_BITS_52 and CONFIG_ARM64_PA_BITS=52
 | 
			
		||||
  Resolves: rhbz#1670099
 | 
			
		||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.5-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Tue Jan  8 2019 Dave Anderson <anderson@redhat.com> - 7.2.3-16
 | 
			
		||||
- Resurrect "dev -p" option.
 | 
			
		||||
- Fix "dev -[dD]" options to account for request_queue.in_flight[] removal.
 | 
			
		||||
  Resolves: rhbz#1662039
 | 
			
		||||
- Command line input fixes
 | 
			
		||||
  Resolves: rhbz#1664061
 | 
			
		||||
* Fri Jan 11 2019 Dave Anderson <anderson@redhat.com> - 7.2.5-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Thu Dec 13 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-15
 | 
			
		||||
- Increase ppc64 MAX_PHYSMEM_BITS to match 4.18.0-35.el8 kernel backport
 | 
			
		||||
  Resolves: rhbz#1658628
 | 
			
		||||
* Mon Sep 24 2018 Dave Anderson <anderson@redhat.com> - 7.2.4-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Thu Nov 29 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-14
 | 
			
		||||
- Fix for ARM64 "ps -s" memory allocation failure
 | 
			
		||||
  Resolves: rhbz#1654582
 | 
			
		||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.3-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Thu Oct 25 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-13
 | 
			
		||||
- Change "bt" warnings when exception RIP is legitimate mapped address
 | 
			
		||||
  Resolves: rhbz#1642221
 | 
			
		||||
* Fri May 18 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Mon Oct 15 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-12
 | 
			
		||||
- Address covscan issues
 | 
			
		||||
  Resolves: rhbz#1602466
 | 
			
		||||
- Fix for x86_64 5-level pagetable vmalloc range expansion
 | 
			
		||||
  Resolves: rhbz#1637125
 | 
			
		||||
* Fri Feb 23 2018 Dave Anderson <anderson@redhat.com> - 7.2.1-2
 | 
			
		||||
- Use RPM build flags for LDFLAGS
 | 
			
		||||
 | 
			
		||||
* Wed Oct  4 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-11
 | 
			
		||||
- Fix ppc64 backtrace issues
 | 
			
		||||
  Resolves: rhbz#1633525
 | 
			
		||||
* Fri Feb 16 2018 Dave Anderson <anderson@redhat.com> - 7.2.1-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Wed Sep 19 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-10
 | 
			
		||||
- Address annocheck build issues
 | 
			
		||||
  Resolves: rhbz#1624101
 | 
			
		||||
 
 | 
			
		||||
* Thu Aug  9 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-9
 | 
			
		||||
- Fix for live system (/proc/kcore) access when KALSR is in effect
 | 
			
		||||
  Resolves: rhbz#1611916
 | 
			
		||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.0-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Jul 16 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-8
 | 
			
		||||
- Rebase to github commits 9b494b70_to_eb823b79
 | 
			
		||||
  Resolves: rhbz#1563495
 | 
			
		||||
* Mon Oct  2 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Fri Jun 22 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-7
 | 
			
		||||
- Rebase to github commits 28fa7bd0 to 02efd083
 | 
			
		||||
  Resolves: rhbz#1590751
 | 
			
		||||
  Resolves: rhbz#1592746
 | 
			
		||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.9-3
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Tue Jun 12 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-6
 | 
			
		||||
- github commit 1926150e: fix ppc64/ppc6le stacksize calculation
 | 
			
		||||
 | 
			
		||||
* Fri Jun  8 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-5
 | 
			
		||||
- Remove /dev/mem readmem error message and /proc/kcore switch messages 
 | 
			
		||||
  Resolves: rhbz#1585944
 | 
			
		||||
 | 
			
		||||
* Fri Jun  1 2018 Dave Anderson <anderson@redhat.com> - 7.2.3-4
 | 
			
		||||
- Rebase to latest upstream sources
 | 
			
		||||
 | 
			
		||||
* Tue Nov 21 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-2
 | 
			
		||||
- Rebase to github commits da9bd35a to e2efacdd
 | 
			
		||||
  Resolves: rhbz#1497316
 | 
			
		||||
 | 
			
		||||
* Wed Nov  1 2017 Dave Anderson <anderson@redhat.com> - 7.2.0-1
 | 
			
		||||
- Rebase to upstream version 7.2.0
 | 
			
		||||
- Rebase to github commits da9bd35a_to_e2efacdd.patch
 | 
			
		||||
  Resolves: rhbz#1497316
 | 
			
		||||
- ppc64le: fix for "WARNING: cannot access vmalloc'd module memory"
 | 
			
		||||
  Resolves: rhbz#1485391
 | 
			
		||||
- Support for analyzing an SADUMP crash dump if KASLR is enabled
 | 
			
		||||
  Resolves: rhbz#1504467
 | 
			
		||||
 | 
			
		||||
* Wed May  3 2017 Dave Anderson <anderson@redhat.com> - 7.1.9-2
 | 
			
		||||
- Rebase to github commits 87179026 to ad3b8476
 | 
			
		||||
  Resolves: rhbz#1393534
 | 
			
		||||
- Prohibit native gdb disassemble command when KASLR
 | 
			
		||||
  Resolves: rhbz#1445649
 | 
			
		||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.9-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Apr 24 2017 Dave Anderson <anderson@redhat.com> - 7.1.9-1
 | 
			
		||||
- Rebase to upstream version 7.1.9
 | 
			
		||||
  Resolves: rhbz#1393534
 | 
			
		||||
- Fix gdb "set scope" option for KASLR kernels.
 | 
			
		||||
  Resolves: rhbz#1440725
 | 
			
		||||
- Fix for the determination of the x86_64 "phys_base" value when it is
 | 
			
		||||
  not passed in the VMCOREINFO data of ELF vmcores
 | 
			
		||||
  Resolves: rhbz#1439170
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Wed Mar  8 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-2
 | 
			
		||||
- mod [-sS] command may erroneously reassign module symbol addresses
 | 
			
		||||
  Resolves: rhbz#1430091
 | 
			
		||||
* Thu Feb 23 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Fri Feb 24 2017 Dave Anderson <anderson@redhat.com> - 7.1.8-1
 | 
			
		||||
- Rebase to upstream version 7.1.8
 | 
			
		||||
  Resolves: rhbz#1393534
 | 
			
		||||
- POWER9 - Power ISA 3.0 related support for crash utility
 | 
			
		||||
  Resolves: rhbz#1368711
 | 
			
		||||
- crash package update - ppc64/ppc64le
 | 
			
		||||
  Resolves: rhbz#1384944
 | 
			
		||||
- exception RIP: unknown or invalid address
 | 
			
		||||
  Resolves: rhbz#1350457
 | 
			
		||||
- Crash does not always parse correctly the modules symbol tables
 | 
			
		||||
  Resolves: rhbz#1360415
 | 
			
		||||
- ARM64: crash live system from: WARNING: cannot read linux_banner string
 | 
			
		||||
  Resolves: rhbz#1392007
 | 
			
		||||
- kmem: invalid structure member offset: page_count
 | 
			
		||||
  Resolves: rhbz#1392011
 | 
			
		||||
- Kernel address space randomization [KASLR] support 
 | 
			
		||||
  Resolves: rhbz#1392658
 | 
			
		||||
- invalid structure size: tnt
 | 
			
		||||
  Resolves: rhbz#1420653
 | 
			
		||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.7-3
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Wed Sep 14 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-2
 | 
			
		||||
- Fix for kernel module symbol gathering when the ordering of module
 | 
			
		||||
  symbol name strings does not match the order of the kernel_symbol
 | 
			
		||||
  structures.
 | 
			
		||||
- Resolves: rhbz#1375130
 | 
			
		||||
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 7.1.7-2
 | 
			
		||||
- Rebuild for readline 7.x
 | 
			
		||||
 | 
			
		||||
* Tue Dec  6 2016 Dave Anderson <anderson@redhat.com> - 7.1.7-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Fri Oct 14 2016 Dave Anderson <anderson@redhat.com> - 7.1.6-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Fix for RHBZ#1044119 - crash bundles gdb
 | 
			
		||||
 | 
			
		||||
* Thu May  5 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-2
 | 
			
		||||
- BZ #1333295 - FTBFS due compiler warnings in elf64-s390.c
 | 
			
		||||
 | 
			
		||||
* Thu Apr 28 2016 Dave Anderson <anderson@redhat.com> - 7.1.5-1
 | 
			
		||||
- Rebase to upstream version 7.1.5
 | 
			
		||||
  Resolves: rhbz#1292566
 | 
			
		||||
- Decode clflushopt instruction
 | 
			
		||||
  Resolves: rhbz#1262479
 | 
			
		||||
- Support AArch64 QEMU generated dumps 
 | 
			
		||||
  Resolves: rhbz#1299873
 | 
			
		||||
- crash: zero-size memory allocation (aarch64) 
 | 
			
		||||
  Resolves: rhbz#1312738
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Tue Apr  5 2016 Dave Anderson <anderson@redhat.com> - 7.1.2-4
 | 
			
		||||
- crash: fails to read excluded pages by default on sadump-related format
 | 
			
		||||
  Resolves: rhbz#1304260
 | 
			
		||||
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 7.1.4-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Mon Nov 23 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-3
 | 
			
		||||
- crash fails to read or wrongly reads some parts of memory in sadump vmcore format
 | 
			
		||||
  Resolves: rhbz#1282997
 | 
			
		||||
* Thu Dec 17 2015 Dave Anderson <anderson@redhat.com> - 7.1.4-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Thu Sep  3 2015 Dave Anderson <anderson@redhat.com> - 7.1.3-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Tue Aug  4 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-2
 | 
			
		||||
- Fix "kmem -s <address>", "bt -F[F]", and "rd -S[S]" options in kernels 
 | 
			
		||||
  configured with CONFIG_SLUB having multiple-page slabs.
 | 
			
		||||
  Resolves: rhbz#1244003
 | 
			
		||||
- Fix for SIGSEGV generated by "bt -[f|F]" in ARM64 kernels.
 | 
			
		||||
  Resolves: rhbz#1248859
 | 
			
		||||
 
 | 
			
		||||
* Mon Jul 13 2015 Dave Anderson <anderson@redhat.com> - 7.1.2-1
 | 
			
		||||
- Rebase to upstream version 7.1.2
 | 
			
		||||
  Resolves: rhbz#1207696
 | 
			
		||||
- Fix several ppc64 backtrace issues
 | 
			
		||||
  Resolves: rhbz#1235447 
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Fri Jun 05 2015 Dave Anderson <anderson@redhat.com> - 7.1.1-2
 | 
			
		||||
- ARM64 backtrace enhancements
 | 
			
		||||
  Resolves: rhbz#1227508
 | 
			
		||||
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.1.1-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Thu May 28 2015 Dave Anderson <anderson@redhat.com> - 7.1.1-1
 | 
			
		||||
- Rebase to upstream version 7.1.1
 | 
			
		||||
  Resolves: rhbz#1207696
 | 
			
		||||
- Display s390x vector registers from a kernel dump.
 | 
			
		||||
  Resolves: rhbz#1182161
 | 
			
		||||
- Fix date displayed on initial system banner and by the "sys" command on ARM64.
 | 
			
		||||
  Resolves: rhbz#1223044
 | 
			
		||||
- Fix ARM64 page size calculation on 4.1 and later kernels.
 | 
			
		||||
  Resolves: rhbz#1222645
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Tue Apr 21 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-6
 | 
			
		||||
- Calculate ARM64 virtual memory layout based upon struct page size 
 | 
			
		||||
  Resolves: rhbz#1204941
 | 
			
		||||
* Mon Mar  2 2015 Dave Anderson <anderson@redhat.com> - 7.1.0-3
 | 
			
		||||
- Support increment of Linux version from 3 to 4
 | 
			
		||||
 | 
			
		||||
* Tue Apr  7 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-5
 | 
			
		||||
- Support new sadump format that can represent more than 16 TB physical memory space
 | 
			
		||||
  Resolves: rhbz#1182383
 | 
			
		||||
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 7.1.0-2
 | 
			
		||||
- Rebuilt for Fedora 23 Change
 | 
			
		||||
  https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
 | 
			
		||||
 | 
			
		||||
* Mon Jan 26 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-4
 | 
			
		||||
  Fix ppc64 "bt" command for active tasks in compressed kdumps.
 | 
			
		||||
  Resolves: rhbz#1184401
 | 
			
		||||
* Tue Feb 10 2015 Dave Anderson <anderson@redhat.com> - 7.1.0-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Mon Jan 12 2015 Dave Anderson <anderson@redhat.com> - 7.0.9-3
 | 
			
		||||
  Fix "bt" command mislabeling errors.
 | 
			
		||||
  Resolves: rhbz#1179476
 | 
			
		||||
* Fri Nov 15 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Mon Dec 08 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-2
 | 
			
		||||
- Use registers from QEMU-generated ELF and compressed kdump headers 
 | 
			
		||||
  for active task backtraces.
 | 
			
		||||
- Resolves: rhbz#1169555
 | 
			
		||||
* Mon Sep 15 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Add ppc64le as supported architecture for crash package (BZ #1136050)
 | 
			
		||||
 | 
			
		||||
* Fri Nov 14 2014 Dave Anderson <anderson@redhat.com> - 7.0.9-1
 | 
			
		||||
- Rebase to upstream version 7.0.9.
 | 
			
		||||
- Resolves: rhbz#1110513
 | 
			
		||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.7-3
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Tue Sep 23 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-2
 | 
			
		||||
- Fix ps performance patch regression on live systems.
 | 
			
		||||
- Resolves: rhbz#1134177
 | 
			
		||||
- Minor build-related fixes for ppc64le.
 | 
			
		||||
- Resolves: rhbz#1123991
 | 
			
		||||
* Wed Jul 02 2014 Dave Anderson <anderson@redhat.com> - 7.0.7-2
 | 
			
		||||
- Fix FTBS for aarch64 (BZ #1114588)
 | 
			
		||||
 | 
			
		||||
* Fri Sep 12 2014 Dave Anderson <anderson@redhat.com> - 7.0.8-1
 | 
			
		||||
- Rebase to upstream version 7.0.8.
 | 
			
		||||
- Resolves: rhbz#1110513
 | 
			
		||||
- Fix to calculate the physical base address of dumpfiles created
 | 
			
		||||
  by a "virsh dump" of an OVMF guest.
 | 
			
		||||
- Resolves: rhbz#1080698
 | 
			
		||||
- Support for aarch64 architecture.
 | 
			
		||||
- Resolves: rhbz#1110551
 | 
			
		||||
- Fix to prevent crash from spinning endlessly on a corrupted/truncated
 | 
			
		||||
  dumpfile whose bitmap data is not wholly contained within the file.
 | 
			
		||||
- Resolves: rhbz#1114088
 | 
			
		||||
- Support for ppc64le architecture.
 | 
			
		||||
- Resolves: rhbz#1123991
 | 
			
		||||
* Wed Jun 11 2014 Dave Anderson <anderson@redhat.com> - 7.0.7-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Fix Fedora_21_Mass_Rebuild FTBFS (BZ #1106090)
 | 
			
		||||
 | 
			
		||||
* Tue Jan 28 2014 Daniel Mach <dmach@redhat.com> - 7.0.2-6
 | 
			
		||||
- Mass rebuild 2014-01-24
 | 
			
		||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.5-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Fri Jan 24 2014 Dave Anderson <anderson@redhat.com> - 7.0.2-5
 | 
			
		||||
- Fix for a missing kernel-mode exception frame dump by the x86_64 
 | 
			
		||||
  "bt" command if a page fault was generated by a bogus RIP.
 | 
			
		||||
- Resolves: rhbz#1057353
 | 
			
		||||
- Fix for the x86_64 "bt" command to prevent an unwarranted message
 | 
			
		||||
  indicating "WARNING: possibly bogus exception frame" generated
 | 
			
		||||
  from a blocked kernel thread that was in the process of exec'ing
 | 
			
		||||
  a user process via the call_usermodehelper() facility.
 | 
			
		||||
- Resolves: rhbz#1057357
 | 
			
		||||
* Fri Feb 28 2014 Dave Anderson <anderson@redhat.com> - 7.0.5-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Use system readline library
 | 
			
		||||
- Fix "crash --log vmcore" command for 3.11 and later kernels.
 | 
			
		||||
 | 
			
		||||
* Fri Jan 10 2014 Dave Anderson <anderson@redhat.com> - 7.0.2-4
 | 
			
		||||
- Fixes for "kmem -S" command for CONFIG_SLUB.
 | 
			
		||||
- Resolves: rhbz#1045591
 | 
			
		||||
- Increase S390X NR_CPUS
 | 
			
		||||
- Resolves: rhbz#1051156
 | 
			
		||||
* Tue Dec 17 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 7.0.4-2
 | 
			
		||||
- crash bundles gdb which bundles libiberty.  Add virtual Provides for
 | 
			
		||||
  libiberty tracking.  Open a bug for unbundling gdb RHBZ#1044119
 | 
			
		||||
 | 
			
		||||
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 7.0.2-3
 | 
			
		||||
- Mass rebuild 2013-12-27
 | 
			
		||||
* Mon Dec 16 2013 Dave Anderson <anderson@redhat.com> - 7.0.4-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Tue Oct 29 2013 Dave Anderson <anderson@redhat.com> - 7.0.2-2
 | 
			
		||||
- Compressed kdump 46-bit physical memory support
 | 
			
		||||
  Resolves: rhbz#1015250
 | 
			
		||||
- Fix incorrect backtrace for dumps taken with "virsh dump --memory-only"
 | 
			
		||||
  Resolves: rhbz#1020469
 | 
			
		||||
- Fix cpu number display on systems with more than 254 cpus
 | 
			
		||||
  Resolves: rhbz#1020536
 | 
			
		||||
* Tue Oct 29 2013 Dave Anderson <anderson@redhat.com> - 7.0.3-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
* Wed Sep 04 2013 Dave Anderson <anderson@redhat.com> - 7.0.2-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Fix for ppc64 embedded gdb NULL pointer translation sigsegv
 | 
			
		||||
- Fix for bt -F failure
 | 
			
		||||
- Build with lzo and snappy compression capability
 | 
			
		||||
 | 
			
		||||
* Fri Jul 26 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-4
 | 
			
		||||
- Add lzo-devel and snappy-devel to crash-devel Requires line
 | 
			
		||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.1-2
 | 
			
		||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 | 
			
		||||
 | 
			
		||||
* Tue Jul 23 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-3
 | 
			
		||||
- Build with snappy compression support
 | 
			
		||||
 | 
			
		||||
* Tue Jul  9 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-2
 | 
			
		||||
- Fix for ppc64 Linux 3.10 vmalloc/user-space virtual address translation
 | 
			
		||||
 | 
			
		||||
* Tue Jun 18 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-1
 | 
			
		||||
* Mon Jun 17 2013 Dave Anderson <anderson@redhat.com> - 7.0.1-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
- Build with LZO support
 | 
			
		||||
- Add aarch64 as an exclusive arch
 | 
			
		||||
 | 
			
		||||
* Tue Apr  9 2013 Dave Anderson <anderson@redhat.com> - 6.1.6-1
 | 
			
		||||
- Update to latest upstream release
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user