All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: Re: [PATCH] parisc: Avoid kernel panic triggered by invalid kprobe
Date: Tue, 16 Jul 2019 21:31:10 +0200	[thread overview]
Message-ID: <20190716193110.GB12537@t470p.stackframe.org> (raw)
In-Reply-To: <20190716191626.GA6959@ls3530.fritz.box>

Hi Helge,

On Tue, Jul 16, 2019 at 09:16:26PM +0200, Helge Deller wrote:
> When running gdb I was able to trigger this kernel panic:
> [OOps]

> Avoid this panic by checking the return value of kprobe_running() and
> skip kprobe if none is currently active.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> Cc: <stable@vger.kernel.org> # v5.2
> 
> diff --git a/arch/parisc/kernel/kprobes.c b/arch/parisc/kernel/kprobes.c
> index d58960b33bda..0385a8fd74aa 100644
> --- a/arch/parisc/kernel/kprobes.c
> +++ b/arch/parisc/kernel/kprobes.c
> @@ -133,6 +133,9 @@ int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs)
>  	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
>  	struct kprobe *p = kprobe_running();
> 
> +	if (!p)
> +		return 0;
> +
>  	if (regs->iaoq[0] != (unsigned long)p->ainsn.insn+4)
>  		return 0;
> 

Looks ok to me. I assume this happened during single-stepping?

Acked-by: Sven Schnelle <svens@stackframe.org>

  reply	other threads:[~2019-07-16 19:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 19:16 [PATCH] parisc: Avoid kernel panic triggered by invalid kprobe Helge Deller
2019-07-16 19:31 ` Sven Schnelle [this message]
2019-07-16 19:50   ` Helge Deller

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=20190716193110.GB12537@t470p.stackframe.org \
    --to=svens@stackframe.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.