Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2009 14:59:42 +0000 (UTC)
From:      Joseph Koshy <jkoshy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200060 - head/sys/dev/hwpmc
Message-ID:  <200912031459.nB3ExgeU017318@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkoshy
Date: Thu Dec  3 14:59:42 2009
New Revision: 200060
URL: http://svn.freebsd.org/changeset/base/200060

Log:
  Use a better check for a valid kernel stack address when capturing
  kernel call chains.
  
  Submitted by:	Mark Unangst <mju at panasas.com>
  Tested by:	fabient

Modified:
  head/sys/dev/hwpmc/hwpmc_x86.c

Modified: head/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_x86.c	Thu Dec  3 14:22:15 2009	(r200059)
+++ head/sys/dev/hwpmc/hwpmc_x86.c	Thu Dec  3 14:59:42 2009	(r200060)
@@ -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?200912031459.nB3ExgeU017318>