Re: [PATCH] parisc: Avoid kernel panic triggered by invalid kprobe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16.07.19 21:31, Sven Schnelle wrote:
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@xxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 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?

Yes.
Can be reproduced with the testcase in this bug report:
https://bugs.gentoo.org/481768

Acked-by: Sven Schnelle <svens@xxxxxxxxxxxxxx>

Thanks!
Helge







[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux