summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat/pmcstat_log.c
diff options
context:
space:
mode:
authorhiren <hiren@FreeBSD.org>2015-06-02 08:03:28 +0000
committerhiren <hiren@FreeBSD.org>2015-06-02 08:03:28 +0000
commit651b599a096c2690c4602c70939df679e88c882a (patch)
tree396f4a90237041ac5d50b3c22723611dd36e7700 /usr.sbin/pmcstat/pmcstat_log.c
parent3c9fd219636d39ff34d957bf7cb13945826529b8 (diff)
downloadFreeBSD-src-651b599a096c2690c4602c70939df679e88c882a.zip
FreeBSD-src-651b599a096c2690c4602c70939df679e88c882a.tar.gz
MFC: r282866
Fix pmcstat symbol resolution for userland processes. When examining existing processes pmcstat fails to correctly determine the locations of executable sections of the process due to a miscalculated virtual load address. This does not affect the newly launched processes as the same value passed as a "start address" to the pmcstat_image_link() thus nullifying the effect of it. The issue manifests itself in processes not being reported in the pmcstat(8) output and "dubious frames" being reported. Fix it for now by ignoring all the sections except the executable one. This won't fix the issue for objects with multiple executable sections but helps in majority of real world usecases. The real solution would be to modify the MAP-IN event to include the appropriate load address so pmcstat(8) won't have to manually parse object files to try to determine it. PR: 198147, 198148 Submitted by: stas
Diffstat (limited to 'usr.sbin/pmcstat/pmcstat_log.c')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index 40de320..f7a107d 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -716,7 +716,8 @@ pmcstat_image_get_elf_params(struct pmcstat_image *image)
ph.p_offset);
break;
case PT_LOAD:
- if ((ph.p_offset & (-ph.p_align)) == 0)
+ if ((ph.p_flags & PF_X) != 0 &&
+ (ph.p_offset & (-ph.p_align)) == 0)
image->pi_vaddr = ph.p_vaddr & (-ph.p_align);
break;
}
OpenPOWER on IntegriCloud