This function is always examining its own ELF headers in memory, but it was trying to use conditions between examining files or memory, and it wasn't accounting for LOAD offsets at runtime. This is especially bad if a loaded segment has additional padding that's not in the file offsets. Now we do a first scan of the program headers to figure out the runtime base address based on `PT_PHDR` and/or `PT_DYNAMIC` (else assume zero), similar to libc's `do_start`. Then each `PT_NOTE` pointer is simply the base plus the segments's `pt_vaddr`, which includes LOAD offsets. Fixes #114605
9.3 KiB
9.3 KiB