freebsd-src/lib/libpmcstat
Jessica Clarke 94426d21bf pmc: Rework PROCEXEC event to support PIEs
Currently the PROCEXEC event only reports a single address, entryaddr,
which is the entry point of the interpreter in the typical dynamic case,
and used solely to calculate the base address of the interpreter. For
PDEs this is fine, since the base address is known from the program
headers, but for PIEs the base address varies at run time based on where
the kernel chooses to load it, and so pmcstat has no way of knowing the
real address ranges for the executable. This was less of an issue in the
past since PIEs were rare, but now they're on by default on 64-bit
architectures it's more of a problem.

To solve this, pass through what was picked for et_dyn_addr by the
kernel, and use that as the offset for the executable's start address
just as is done for everything in the kernel. Since we're changing this
interface, sanitise the way we determine the interpreter's base address
by passing it through directly rather than indirectly via the entry
point and having to subtract off whatever the ELF header's e_entry is
(and anything that wants the entry point in future can still add that
back on as needed; this merely changes the interface to directly provide
the underlying variables involved).

This will be followed up by a bump to the pmc major version.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D39595
2023-05-31 00:20:36 +01:00
..
libpmcstat.h pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
libpmcstat_event.c
libpmcstat_image.c pmc: Provide full path to modules from kernel linker 2023-05-31 00:15:34 +01:00
libpmcstat_logging.c pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
libpmcstat_process.c pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
libpmcstat_string.c
libpmcstat_symbol.c
Makefile pmc: Add include path for libpmcstat as it is an internallib 2020-03-25 01:32:16 +00:00
Makefile.depend