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>
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--;
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--;
}