[Bug 288000] dtrace: fix symbol address resolving

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 06 Jul 2025 12:18:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288000

--- Comment #3 from Jiacong Fang <zldrobit@gmail.com> ---
In /boot/kernel/zfs.ko, the .eh_frame section of type X86_64_UNWIND with
SHF_ALLOC flag occupies memory as follows (gdb /boot/kernel/zfs.ko --ex 'info
file'):
Reading symbols from /boot/kernel/zfs.ko...
Reading symbols from /usr/lib/debug//boot/kernel/zfs.ko.debug...
Symbols from "/boot/kernel/zfs.ko".
Local exec file:
        `/boot/kernel/zfs.ko', file type elf64-x86-64-freebsd.
        Entry point: 0x0
        0x0000000000000000 - 0x000000000027f000 is .text
        0x000000000027f000 - 0x0000000000316000 is .rodata
        0x0000000000316000 - 0x00000000003162d0 is .eh_frame
        0x0000000000316300 - 0x000000000033bc28 is .data
        0x000000000033bd00 - 0x00000000003e632c is .bss
---------------cut----------------------

Dtrace assume sections of type X86_64_UNWIND aren't loaded, thus it cannot
resolve correct addresses for symbols of the .bss section:


In /boot/kernel/ossl.ko, the symbol `OPENSSL_ia32cap_P` is at the start of the
.bss section and the output of `elfdump -s /boot/kernel/ossl.ko | grep -B1 -A4
OPENSSL_ia32cap_P` is as follows:
entry: 161
        st_name: OPENSSL_ia32cap_P
        st_value: 0
        st_size: 16
        st_info: STT_OBJECT STB_LOCAL
        st_shndx: 17
In this case, dtrace resolves the address of `OPENSSL_ia32cap_P` without adding
up the section offset (dmp->dm_reloc_offset), so the resulting address is zero.

-- 
You are receiving this mail because:
You are the assignee for the bug.