freebsd-src/lib
Jessica Clarke 21f7397a61 libpmc: Handle PMCALLOCATE log with PMC code on PMU event system
On an arm64 system that reports as a Cortex A72 r0p3, running

  pmcstat -P CPU_CYCLES command

works, but

  pmcstat -P cpu-cycles command

does not. This is because the former uses the PMU event from the JSON
source, resulting in pl_event in the log event being a small index
(here, 5) into the generated events table, whilst the latter does not
match any of the JSON events and falls back on PMC's own tables, mapping
it to the PMC event 0x14111, i.e. PMC_EV_ARMV8_EVENT_11H. Then, when
libpmc gets the PMCALLOCATE event, it tries to use the event as an index
into the JSON-derived table, but doing so only makes sense for the
former, whilst for the latter it will go way out of bounds and either
read junk (which may trigger the != NULL assertion) or segfault. As far
as I can tell we don't have anything lying around to tell us which of
the two cases we're in, but we can exploit the fact that the first
0x1000 PMC event codes are reserved, and that none of our PMU events
tables reach that number of entries yet.

PR:		268857
Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D39592
2023-06-07 15:24:29 +01:00
..
atf Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
clang Stop stripping 'sf' suffixes from architecture names. 2023-04-12 11:11:02 -07:00
csu spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
flua spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
geom gpart(8): Improve manual page syntax 2023-06-01 20:43:04 -06:00
googletest googletest: remove unused auto_ptr warning suppression 2022-11-30 19:34:52 -05:00
lib9p Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
lib80211
libalias Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libarchive libarchive: Request the OpenSSL 1.1 API 2023-05-25 15:08:05 -04:00
libauditd Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libbe spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libbearssl Fix DIRDEPS_BUILD for libgcc_eh 2023-04-14 16:56:30 -07:00
libbegemot libbegemot: Disable -Wuse-after-free. 2022-10-03 16:10:43 -07:00
libblacklist
libblocksruntime
libbluetooth spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libbsddialog Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libbsdstat spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libbsm
libbsnmp
libbz2
libc open(2): fix typo 2023-05-30 12:18:25 +03:00
libc++ Merge llvm-project release/15.x llvmorg-15.0.2-10-gf3c5289e7846 2023-02-08 20:05:09 +01:00
libc++experimental Merge llvm-project main llvmorg-15-init-15358-g53dc0f10787 2023-02-08 20:02:26 +01:00
libc_nonshared spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libcalendar spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libcam gpart(8): Improve manual page syntax 2023-06-01 20:43:04 -06:00
libcapsicum
libcasper spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libcbor libcbor: update to 0.10.2 2023-04-21 16:10:03 -04:00
libclang_rt Stop stripping 'sf' suffixes from architecture names. 2023-04-12 11:11:02 -07:00
libcom_err
libcompat
libcompiler_rt Remove a few more references to riscv64sf. 2023-04-20 11:00:46 -07:00
libcrypt spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libcuse cuse(3): Make some clarifications in the manual page. 2022-07-20 10:41:11 +02:00
libcxxrt
libdevctl libdevctl: Add devctl_getpath 2022-03-01 08:06:41 -07:00
libdevdctl libdevdctl: update deprecated deprecation warning comment 2022-12-04 10:17:37 -05:00
libdevinfo spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libdevstat
libdl Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libdpv Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libdwarf Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libedit Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libefivar efivar: Really look for labels for the provider with right efimedia 2023-02-16 08:54:39 -07:00
libelf
libelftc pkgbase: Create a FreeBSD-elftoolchain package 2023-02-08 08:49:12 +01:00
libevent1
libexecinfo
libexpat Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libfetch libfetch: specify OpenSSL 1.1 APIs 2023-05-25 13:15:45 -04:00
libfido2 libfido2: specify OpenSSL 1.1 API 2023-05-09 09:46:09 -04:00
libfigpar
libgcc_eh Fix DIRDEPS_BUILD for libgcc_eh 2023-04-14 16:56:30 -07:00
libgcc_s libcompiler_rt/libgcc_s: Remove MIPS build glue. 2023-03-29 15:05:42 -07:00
libgeom spdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD 2023-05-12 10:44:04 -06:00
libgpio
libgssapi spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libiconv_modules Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libifconfig libifconfig: fix carp key configuration 2023-04-30 20:11:54 +02:00
libipsec libipsec: ansify 2023-04-03 22:48:48 +03:00
libipt
libiscsiutil spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libjail spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libkiconv spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libkvm spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libldns ldns: Silence -Wstrict-prototypes warnings. 2023-05-25 07:11:38 -07:00
liblua lua: Update to 5.4.4 2023-02-08 10:33:26 -07:00
liblutok Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>. 2022-12-04 16:25:21 -08:00
liblzma MFV: xz 5.4.3. 2023-05-12 15:49:34 -07:00
libmagic file: upgrade to 5.43. 2022-09-24 19:16:39 -07:00
libmd libmd: ansify 2023-03-16 19:02:56 +00:00
libmemstat spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libmilter libmilter: Silence -Wdeprecated-non-prototype warnings. 2023-04-19 10:52:51 -07:00
libmixer Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libmp spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libmt mt(3): Fix a typo in the manual page 2022-04-06 18:41:08 +02:00
libnetbsd spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
libnetgraph ng_atmllc: remove 2023-03-09 18:04:21 +00:00
libnetmap spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libnv spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libomp Merge llvm-project main llvmorg-15-init-15358-g53dc0f10787 2023-02-08 20:02:26 +01:00
libopenbsd
libopencsd Include Embedded Trace Extensions (ETE) source code to the OpenCSD build. 2023-03-27 17:10:26 +01:00
libpam pam_tacplus: Mention nss_tacplus in the manual page. 2023-05-22 10:14:52 +00:00
libpathconv Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libpcap libpcap: Update PACKAGE_VERSION definition to 1.10.4 2023-05-29 15:41:01 -03:00
libpe
libpfctl pfctl: Add missing state parameters in DIOCGETSTATESV2 2023-05-30 14:28:57 +02:00
libpjdlog spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libpmc libpmc: Handle PMCALLOCATE log with PMC code on PMU event system 2023-06-07 15:24:29 +01:00
libpmcstat pmc: Rework PROCEXEC event to support PIEs 2023-05-31 00:20:36 +01:00
libproc spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libprocstat spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libradius libradius: specify OpenSSL 1.1 APIs 2023-05-25 13:15:45 -04:00
libregex spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
librpcsec_gss spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
librpcsvc
librss librss: Remove rss_socket_set_rss_bucket() 2023-02-28 15:57:11 -05:00
librt spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
librtld_db spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libsbuf
libsdp spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libsecureboot libsecureboot ensure correct BUILD_UTC 2023-05-23 09:02:00 -07:00
libsm sendmail: Silence -Wdeprecated-non-prototype warnings. 2023-04-18 11:19:48 -07:00
libsmb Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libsmdb libsmdb: Silence -Wstrict-prototype warnings. 2023-04-24 08:53:49 -07:00
libsmutil Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libsqlite3
libssp Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libssp_nonshared Fix DIRDEPS_BUILD for libgcc_eh 2023-04-14 16:56:30 -07:00
libstats Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
libstdbuf spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libstdthreads spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libsysdecode libsysdecode: Decode linux_clone syscall flags 2023-05-26 19:32:20 +03:00
libtacplus taclib: 0 (not set) is a valid auth type in authorization requests. 2023-05-22 10:01:04 +00:00
libtelnet libtelnet: specify OpenSSL 1.1 APIs 2023-05-24 14:31:14 -04:00
libthr libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child 2023-05-22 16:46:42 +03:00
libthread_db spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libucl
libufs spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libugidfw spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libulog spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libunbound libunbound: Request the OpenSSL 1.1 API 2023-05-31 10:05:07 -04:00
libusb spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libusbhid spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD 2023-05-12 10:44:04 -06:00
libutil cpuset(3): Add unit tests 2023-06-01 23:27:45 +02:00
libveriexec libveriexec: add function to check a label based on a path 2023-04-17 11:47:33 -04:00
libvgl
libvmmapi vmm: Avoid embedding cpuset_t ioctl ABIs 2023-05-23 21:15:59 -04:00
libwrap pkgbase: Put libwrap in FreeBSD-tcpd package 2022-10-26 19:46:32 +02:00
libxo Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
liby spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libypclnt spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
libz zlib: Silence -Wstrict-prototype warnings. 2023-04-24 08:53:49 -07:00
libzstd cppcheck: explicitly exclude kernel code from userspace checks 2022-05-10 10:20:55 -07:00
msun spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ncurses Fix building host tools for host 2023-04-20 10:05:43 -07:00
nss_tacplus Add nss_tacplus, a TACACS+ NSS module. 2023-05-22 10:14:52 +00:00
ofed libirdma: Drop clang-specific -ferror-limit. 2022-10-03 16:10:42 -07:00
tests
Makefile Add nss_tacplus, a TACACS+ NSS module. 2023-05-22 10:14:52 +00:00
Makefile.inc