diff options
author | Joseph Koshy <jkoshy@FreeBSD.org> | 2009-12-03 14:59:42 +0000 |
---|---|---|
committer | Joseph Koshy <jkoshy@FreeBSD.org> | 2009-12-03 14:59:42 +0000 |
commit | c66e06a2f6f8895a9ca1ed469ca3a0126f6858d3 (patch) | |
tree | 533c8a4bfe70a022fc40d3d75b0a9109a3d5f34c | |
parent | 4f60c0b97d6f383963da3f7d263438e95c0aafd3 (diff) |
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
Notes
Notes:
svn path=/head/; revision=200060
-rw-r--r-- | sys/dev/hwpmc/hwpmc_x86.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index 6df47d32feca..8c98983b571d 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; |