[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BANLkTi=ifFfe-TO1PLf4aXYn0SJTxQ=0Nw@mail.gmail.com>
Date: Mon, 18 Apr 2011 14:02:52 -0700
From: Sonny Rao <sonnyrao@...omium.org>
To: Will Deacon <will.deacon@....com>
Cc: Jamie Iles <jamie@...ieiles.com>, olofj@...omium.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Russell King <linux@....linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix infinite loop in ARM user perf_event backtrace code
On Mon, Apr 18, 2011 at 10:42 AM, Will Deacon <will.deacon@....com> wrote:
> 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@...omium.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
>
Ok, sent it to patches@....linux.org.uk
hope that'll be sufficient
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists