Skip to content

Commit

Permalink
sparc64: Like x86 we should check current->mm during perf backtrace g…
Browse files Browse the repository at this point in the history
…eneration.

[ Upstream commit 08280e6 ]

If the MM is not active, only report the top-level PC.  Do not try to
access the address space.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
David S. Miller authored and Greg Kroah-Hartman committed Oct 28, 2012
1 parent 01afdbe commit 846514f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arch/sparc/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
{
unsigned long ufp;

perf_callchain_store(entry, regs->tpc);

ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
do {
struct sparc_stackf *usf, sf;
Expand All @@ -1450,8 +1448,6 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
{
unsigned long ufp;

perf_callchain_store(entry, regs->tpc);

ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
do {
struct sparc_stackf32 *usf, sf;
Expand All @@ -1470,6 +1466,11 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
void
perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
{
perf_callchain_store(entry, regs->tpc);

if (!current->mm)
return;

flushw_user();
if (test_thread_flag(TIF_32BIT))
perf_callchain_user_32(entry, regs);
Expand Down

0 comments on commit 846514f

Please sign in to comment.