freebsd-src/lib/libpmc
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
..
pmu-events pmc(3): Correct some typos in event descriptions 2022-09-04 12:52:38 +02:00
libpmc.c pmc: Initialise and check the pm_flags field for CONFIGURELOG 2023-05-31 00:15:24 +01:00
libpmc_json.cc pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
libpmc_pmu_util.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libpmcinternal.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
Makefile libpmc: Use LIB_CXX instead of explicit LDADD to link a C++ library. 2023-03-23 09:31:58 -07:00
Makefile.depend Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Makefile.inc Fix warnings with lib/libpmc 2019-04-14 00:06:49 +00:00
pmc.3 pmc: Keep a list sorted. 2023-04-05 20:09:28 +01:00
pmc.atom.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.atomsilvermont.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.cmn-600.3 Add the Arm CoreLink CMN-600 Coherent Mesh Network Controller PMU driver man page. 2022-07-10 12:26:55 +03:00
pmc.core.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.core2.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.corei7.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.corei7uc.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.dmc-620.3 Add pmc.dmc-620(3) man page. 2022-07-26 11:17:50 +03:00
pmc.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pmc.haswell.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.haswelluc.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.haswellxeon.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.iaf.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.ivybridge.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.ivybridgexeon.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.k7.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.k8.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.sandybridge.3 pmc.sandybridge(3): Fix a few EVENT_ vs Event inconsistencies 2022-10-11 00:50:58 +01:00
pmc.sandybridgeuc.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.sandybridgexeon.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.soft.3 pmc: intr pmc.soft(3) update 2021-09-23 06:13:58 +02:00
pmc.tsc.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.ucf.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.westmere.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc.westmereuc.3 pmc(3): remove Pentium-related man pages and references 2021-08-10 17:19:58 -03:00
pmc_allocate.3 pmc_allocate(3): document the count argument 2021-04-21 17:35:03 -03:00
pmc_attach.3
pmc_capabilities.3
pmc_configure_logfile.3
pmc_disable.3
pmc_event_names_of_class.3
pmc_get_driver_stats.3
pmc_get_msr.3
pmc_init.3
pmc_name_of_capability.3
pmc_read.3
pmc_set.3
pmc_start.3
pmcformat.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
pmclog.3 pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the 2018-05-26 19:29:19 +00:00
pmclog.c pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
pmclog.h pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00