Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 2009 20:49:49 +0000 (UTC)
From:      Fabien Thomas <fabient@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r200236 - stable/8/sys/dev/hwpmc
Message-ID:  <200912072049.nB7KnnUY065700@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fabient
Date: Mon Dec  7 20:49:49 2009
New Revision: 200236
URL: http://svn.freebsd.org/changeset/base/200236

Log:
  MFC 200060:
  Use a better check for a valid kernel stack address when capturing
  kernel call chains.

Modified:
  stable/8/sys/dev/hwpmc/hwpmc_x86.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- stable/8/sys/dev/hwpmc/hwpmc_x86.c	Mon Dec  7 20:47:33 2009	(r200235)
+++ stable/8/sys/dev/hwpmc/hwpmc_x86.c	Mon Dec  7 20:49:49 2009	(r200236)
@@ -176,7 +176,8 @@ pmc_save_kernel_callchain(uintptr_t *cc,
 	stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE;
 
 	if (PMC_IN_TRAP_HANDLER(pc) ||
-	    !PMC_IN_KERNEL(pc) || !PMC_IN_KERNEL(r) ||
+	    !PMC_IN_KERNEL(pc) ||
+	    !PMC_IN_KERNEL_STACK(r, stackstart, stackend) ||
 	    !PMC_IN_KERNEL_STACK(sp, stackstart, stackend) ||
 	    !PMC_IN_KERNEL_STACK(fp, stackstart, stackend))
 		return (1);
@@ -221,7 +222,7 @@ pmc_save_kernel_callchain(uintptr_t *cc,
 
 		r = fp + sizeof(uintptr_t);
 		if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend) ||
-		    !PMC_IN_KERNEL(r))
+		    !PMC_IN_KERNEL_STACK(r, stackstart, stackend))
 			break;
 		pc = *(uintptr_t *) r;
 		fp = *(uintptr_t *) fp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912072049.nB7KnnUY065700>