svn commit: r282866 - head/usr.sbin/pmcstat

Stanislav Sedov stas at FreeBSD.org
Wed May 13 18:52:19 UTC 2015


Author: stas
Date: Wed May 13 18:52:18 2015
New Revision: 282866
URL: https://svnweb.freebsd.org/changeset/base/282866

Log:
  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
  Reviewed by:	jhb, rpaulo
  MFC after:	2 weeks

Modified:
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c	Wed May 13 17:38:07 2015	(r282865)
+++ head/usr.sbin/pmcstat/pmcstat_log.c	Wed May 13 18:52:18 2015	(r282866)
@@ -716,7 +716,8 @@ pmcstat_image_get_elf_params(struct pmcs
 				        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;
 			}


More information about the svn-src-all mailing list