Commit Graph

3 Commits

Author SHA1 Message Date
Stephen Brennan
b982ddc4d6 Fix bad relocations when module sh_addr is nonzero
In the previous commit, we fixed crash's logic which determines the
module load addresses in the presence of sections with nonzero sh_addr.
This allowed GDB to correctly locate public variables (i.e. GLOBAL
symbols) via the ELF symbol table (msymbols). However, LOCAL symbols
still had incorrect addresses.

The root cause for those issues is not in crash. Instead, GDB does not
expect sections with nonzero sh_addr, and so it slipped up in multiple
places:

1. In default_symfile_offsets(), GDB detects the nonzero sh_addr field
   and fails to apply the user-supplied section offsets. The result is
   that later, in symfile_relocate_debug_section(), relocations are
   applied to the DWARF info using the wrong section addresses, which
   results in invalid addresses for variables. Clearly, this has
   happened before, because crash has special-cased the "__ksymtab*"
   section names to avoid this condition. To resolve this, we simply
   drop the check for nonzero sh_addr altogether: the only ET_REL files
   we encounter should be kernel modules, so there's no real reason to
   be picky.

2. Even with that fixed, the user-supplied section addresses are
   clobbered by the addr_info_make_relative(), which subtracts out
   section offsets during its operation. To resolve this, undo the
   operation for ET_REL files where a section address was provided by
   the user (i.e. crash).

With these two fixes, both local and global variables from a module
section with nonzero sh_addr are correctly reported. Behavior is
unchanged for modules with a zero sh_addr.

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
2025-04-17 17:16:31 +08:00
Lianbo Jiang
3115791c68 gdb:disable building gdbserver in crash-utility
The gdbserver is unused in crash-utility, but it
is always built by default during crash building.
Let's disable gdbserver building to save some time.

There are several advantages, for example:
[1] speed up crash building and save time
[2] avoid some compilation issues
[3] the following cross compile and ci will benefit
    from this.

In addition, this is harmless for the old compilation
methods.

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2025-03-20 14:50:06 +08:00
Lianbo Jiang
dfb2bb55e5 Update to gdb 16.2
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2025-03-07 15:44:42 +08:00