summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2009-12-03 14:59:42 +0000
committerjkoshy <jkoshy@FreeBSD.org>2009-12-03 14:59:42 +0000
commit6108ecda041083f400d4d332c9d05617b4ceefe4 (patch)
tree533c8a4bfe70a022fc40d3d75b0a9109a3d5f34c /sys/dev/hwpmc
parent688d739fd8bbd23383901f2cd0613915abd2b19d (diff)
downloadFreeBSD-src-6108ecda041083f400d4d332c9d05617b4ceefe4.zip
FreeBSD-src-6108ecda041083f400d4d332c9d05617b4ceefe4.tar.gz
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
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r--sys/dev/hwpmc/hwpmc_x86.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c
index 6df47d3..8c98983 100644
--- a/sys/dev/hwpmc/hwpmc_x86.c
+++ b/sys/dev/hwpmc/hwpmc_x86.c
@@ -176,7 +176,8 @@ pmc_save_kernel_callchain(uintptr_t *cc, int nframes, struct trapframe *tf)
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, int nframes, struct trapframe *tf)
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;
OpenPOWER on IntegriCloud