]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fix to exclude stack addresses from pcstack.
authorKris Van Hees <kris.van.hees@oracle.com>
Thu, 2 May 2013 19:24:22 +0000 (15:24 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 2 May 2013 19:24:22 +0000 (15:24 -0400)
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 <kris.van.hees@oracle.com>
dtrace/dtrace_isa.c

index 89ad6068ed5681ff6009e2b4f0306f212970f2c2..66a95064e44def556590b9d3d2bed7b6feec1f3e 100644 (file)
@@ -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--;
                }