From: Will Deacon <will.deacon@arm.com>
To: Sonny Rao <sonnyrao@chromium.org>
Cc: Jamie Iles <jamie@jamieiles.com>,
olofj@chromium.org, Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix infinite loop in ARM user perf_event backtrace code
Date: Mon, 18 Apr 2011 18:42:24 +0100 [thread overview]
Message-ID: <1303148544.13157.1.camel@e102144-lin.cambridge.arm.com> (raw)
In-Reply-To: <1302924445-18557-1-git-send-email-sonnyrao@chromium.org>
Hi Sonny,
On Sat, 2011-04-16 at 04:27 +0100, Sonny Rao wrote:
> The ARM user backtrace code can get into an infinite loop if it
> runs into an invalid stack frame which points back to itself.
> This situation has been observed in practice. Fix it by capping
> the number of entries in the backtrace. This is also what other
> architectures do in their backtrace code.
>
> Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
> ---
> arch/arm/kernel/perf_event.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> index 69cfee0..1e61d60 100644
> --- a/arch/arm/kernel/perf_event.c
> +++ b/arch/arm/kernel/perf_event.c
> @@ -746,7 +746,8 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
>
> tail = (struct frame_tail __user *)regs->ARM_fp - 1;
>
> - while (tail && !((unsigned long)tail & 0x3))
> + while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
> + tail && !((unsigned long)tail & 0x3))
> tail = user_backtrace(tail, entry);
> }
Ok. Please can you put this into Russell's patch system?
Will
next prev parent reply other threads:[~2011-04-18 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-16 3:27 [PATCH] Fix infinite loop in ARM user perf_event backtrace code Sonny Rao
2011-04-18 10:42 ` Jamie Iles
2011-04-18 17:42 ` Will Deacon [this message]
2011-04-18 21:02 ` Sonny Rao
2011-04-18 18:31 ` Olof Johansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303148544.13157.1.camel@e102144-lin.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=jamie@jamieiles.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mingo@elte.hu \
--cc=olofj@chromium.org \
--cc=paulus@samba.org \
--cc=sonnyrao@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).