Re: [PATCH] perf, x86: Disable sanity check

From: Frederic Weisbecker
Date: Thu Apr 19 2012 - 01:22:18 EST


On Wed, Apr 18, 2012 at 04:24:09PM -0700, Arun Sharma wrote:
> Without this patch, applications with two different stack
> regions (eg: native stack vs JIT stack) get truncated
> callchains even when RBP chaining is present. GDB shows proper
> stack traces and the frame pointer chaining is intact.
>
> This patch disables the (fp < RSP) check, hoping that other checks
> in the code save the day for us. In our limited testing, this
> didn't seem to break anything.
>
> In the long term, we could potentially have userspace advise
> the kernel on the range of valid stack addresses, so we don't
> spend a lot of time unwinding from bogus addresses.

So rbp is part of the JIT stack but not rsp?
Do you have a practical example of that? I must confess I don't know
much about JIT stack.

Thanks.

>
> Signed-off-by: Arun Sharma <asharma@xxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> CC: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Mike Galbraith <efault@xxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Stephane Eranian <eranian@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung.kim@xxxxxxx>
> Cc: Tom Zanussi <tzanussi@xxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-perf-users@xxxxxxxxxxxxxxx
>
> ---
> arch/x86/kernel/cpu/perf_event.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 07f46ba..87d9abd 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -1596,9 +1596,6 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
> if (bytes != sizeof(frame))
> break;
>
> - if ((unsigned long)fp < regs->sp)
> - break;
> -
> perf_callchain_store(entry, frame.return_address);
> fp = frame.next_frame;
> }
> --
> 1.7.8.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/