From: Kris Van Hees Date: Thu, 2 May 2013 19:24:22 +0000 (-0400) Subject: Fix to exclude stack addresses from pcstack. X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~160 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8edba985418e6f49872c575b6bc12a1ac3e6e146;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 89ad6068ed568..66a95064e44de 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--; }