From 8edba985418e6f49872c575b6bc12a1ac3e6e146 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 2 May 2013 15:24:22 -0400 Subject: [PATCH] Fix to exclude stack addresses from pcstack. Because the stack is considered executable memory, addresses on the stack that point back into the stack were considered potential return address addresses, and therefore they were (incorrectly) included in the pcstack output. Signed-off-by: Kris Van Hees --- dtrace/dtrace_isa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 89ad6068ed56..66a95064e44d 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -374,6 +374,7 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, struct task_struct *p = current; unsigned long *sp = (unsigned long *)p->thread.usersp; unsigned long *bos = (unsigned long *)p->mm->start_stack; + struct vm_area_struct *stack_vma = find_vma(p->mm, p->thread.usersp); *pcstack++ = (uint64_t)p->pid; pcstack_limit--; @@ -381,7 +382,9 @@ void dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, while (sp <= bos && pcstack_limit) { unsigned long addr = *sp; - if (is_code_addr(addr)) { + if (addr >= stack_vma->vm_start && addr < stack_vma->vm_end) { + /* stack address - may need it for the fpstack. */ + } else if (is_code_addr(addr)) { *pcstack++ = addr; pcstack_limit--; } -- 2.50.1