From 2c69f93e59c6b2efac5bae9f7891dbe1e0094fdd Mon Sep 17 00:00:00 2001 From: Shivang Upadhyay 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 Cc: Lianbo Jiang Cc: Sourabh Jain Signed-off-by: shivang.upadhyay Signed-off-by: Lianbo Jiang --- 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