linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Anton Blanchard <anton@samba.org>,
	benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: powerpc: Print instruction when logging unhandled exceptions
Date: Thu,  2 Oct 2014 17:14:46 +1000 (EST)	[thread overview]
Message-ID: <20141002071446.66E37140183@ozlabs.org> (raw)
In-Reply-To: <1411621545-19310-1-git-send-email-anton@samba.org>

On Thu, 2014-25-09 at 05:05:45 UTC, Anton Blanchard wrote:
> It is often useful to see the instruction that caused an unhandled
> exception.
> 
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 0dc43f9..27e30c8 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -252,9 +252,18 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
>  	}
>  
>  	if (show_unhandled_signals && unhandled_signal(current, signr)) {
> +		u32 __user *nia = (u32 __user *)regs->nip;
> +		u32 insn = 0;
> +
> +		pagefault_disable();
> +		if (!access_ok(VERIFY_READ, nia, sizeof(*nia)) ||
> +		    __get_user_inatomic(insn, nia))
> +			insn = 0xffffffffUL;
> +		pagefault_enable();

Can you add a comment explaining that interesting construct?

Looks like we do something similar in the perf callchain code, though without
the access_ok() check?

cheers

      reply	other threads:[~2014-10-02  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25  5:05 [PATCH] powerpc: Print instruction when logging unhandled exceptions Anton Blanchard
2014-10-02  7:14 ` Michael Ellerman [this message]

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=20141002071446.66E37140183@ozlabs.org \
    --to=mpe@ellerman.id.au \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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).