Hi Shivang,
Sorry for the late. LGTM, so ack.
Thanks,
Tao Liu
On Mon, Jul 21, 2025 at 8:18 PM Shivang Upadhyay <shivangu(a)linux.ibm.com> wrote:
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(a)redhat.com>
Cc: Lianbo Jiang <lijiang(a)redhat.com>
Cc: Sourabh Jain <sourabhjain(a)linux.ibm.com>
Signed-off-by: shivang.upadhyay <shivangu(a)linux.ibm.com>
---
gdb-16.2.patch | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gdb-16.2.patch b/gdb-16.2.patch
index 151e4e2..7b79cdf 100644
--- a/gdb-16.2.patch
+++ b/gdb-16.2.patch
@@ -1952,3 +1952,19 @@ exit 0
}
/* Remember the bfd indexes for the .text, .data, .bss and
+--- gdb-16.2/gdb/solib-svr4.c.orig
++++ gdb-16.2/gdb/solib-svr4.c
+@@ -742,11 +742,13 @@ elf_locate_base (void)
+ 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. */
--
2.50.0