[PATCH 5/7] unwinder: show_stack, check also ret_addr_p's contents

From: Jiri Slaby
Date: Fri May 05 2017 - 08:22:10 EST


The DWARF unwinder stores the return address in an internal structure.
This is returned to the generic unwinder. So do not check only
ret_addr_p against the current stack pointer, but also if the address is
the return address.

This makes the unwinder to really think the addresses are reliable.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
arch/x86/kernel/dumpstack.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index dbce3cca94cb..963c6b60887f 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -123,7 +123,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
continue;
}

- if (stack == ret_addr_p)
+ if (stack == ret_addr_p ||
+ (ret_addr_p && addr == *ret_addr_p))
reliable = 1;

/*
--
2.12.2