Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178045254
D62104.1795839829.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D62104.1795839829.diff
View Options
diff --git a/lib/libpmcstat/libpmcstat_process.c b/lib/libpmcstat/libpmcstat_process.c
--- a/lib/libpmcstat/libpmcstat_process.c
+++ b/lib/libpmcstat/libpmcstat_process.c
@@ -93,10 +93,12 @@
* where the dynamic linker was mapped to for this process,
* Subsequent executable objects that are mapped in by the
* dynamic linker will be tracked by log events of type
- * PMCLOG_TYPE_MAP_IN.
+ * PMCLOG_TYPE_MAP_IN. An object without a PT_INTERP header,
+ * such as the runtime loader run directly, has no loader to
+ * map in.
*/
- if (image->pi_isdynamic) {
+ if (image->pi_isdynamic && image->pi_dynlinkerpath != NULL) {
/*
* The runtime loader gets loaded just after the maximum
diff --git a/tests/sys/pmc/Makefile b/tests/sys/pmc/Makefile
--- a/tests/sys/pmc/Makefile
+++ b/tests/sys/pmc/Makefile
@@ -22,6 +22,7 @@
ATF_TESTS_C+= pmc_rapl_test
ATF_TESTS_C+= pmc_rdpmc_test
+ATF_TESTS_SH+= pmcstat_rtld_test
ATF_TESTS_SH+= pmcstat_tsc_test
TESTS_SUBDIRS+= amd
@@ -36,6 +37,7 @@
TEST_METADATA.pmc_rdpmc_test+= is_exclusive="true"
TEST_METADATA.pmc_ss_test+= is_exclusive="true"
TEST_METADATA.pmc_unload_test+= is_exclusive="true"
+TEST_METADATA.pmcstat_rtld_test+= required_kmods="hwpmc"
TEST_METADATA.pmcstat_tsc_test+= required_kmods="hwpmc"
LIBADD+= pmc
diff --git a/tests/sys/pmc/pmcstat_rtld_test.sh b/tests/sys/pmc/pmcstat_rtld_test.sh
new file mode 100644
--- /dev/null
+++ b/tests/sys/pmc/pmcstat_rtld_test.sh
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2026 Advanced Micro Devices, Inc.
+#
+# Author: Osvaldo Janeri Filho <ojanerif@amd.com>
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+atf_test_case rtld_exec
+rtld_exec_head()
+{
+ atf_set "descr" "pmcstat -R reads a log of an image with no PT_INTERP"
+ atf_set "require.user" "root"
+ atf_set "require.progs" "pmcstat"
+ atf_set "timeout" "120"
+}
+rtld_exec_body()
+{
+ # ld-elf.so.1 run directly is a dynamic object with no interpreter.
+ if ! pmcstat -P PAGE_FAULT.ALL -O rtld.log /libexec/ld-elf.so.1 \
+ /bin/ls / > /dev/null 2> pmcstat.err; then
+ cat pmcstat.err >&2
+ atf_skip "cannot allocate a process-mode PAGE_FAULT.ALL PMC"
+ fi
+ [ -s rtld.log ] || atf_fail "pmcstat produced an empty log"
+ atf_check -o ignore -e ignore pmcstat -R rtld.log -G /dev/null
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case rtld_exec
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 28, 4:23 AM (8 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42054030
Default Alt Text
D62104.1795839829.diff (2 KB)
Attached To
Mode
D62104: libpmcstat: handle an exec of an object with no PT_INTERP
Attached
Detach File
Event Timeline