riscv: avoid sending a SIGTRAP to a user thread trapped in WARN()
authorVincent Chen <vincent.chen@sifive.com>
Mon, 23 Sep 2019 00:45:15 +0000 (08:45 +0800)
committerPaul Walmsley <paul.walmsley@sifive.com>
Mon, 7 Oct 2019 19:59:40 +0000 (12:59 -0700)
On RISC-V, when the kernel runs code on behalf of a user thread, and the
kernel executes a WARN() or WARN_ON(), the user thread will be sent
a bogus SIGTRAP.  Fix the RISC-V kernel code to not send a SIGTRAP when
a WARN()/WARN_ON() is executed.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[paul.walmsley@sifive.com: fixed subject]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
arch/riscv/kernel/traps.c

index 055a937aca70a770b4147df54efecfa2d621c0c4..82f42a55451ebc444c0c4f3535c3aa5c86134e44 100644 (file)
@@ -134,7 +134,7 @@ asmlinkage void do_trap_break(struct pt_regs *regs)
                        break;
                case BUG_TRAP_TYPE_WARN:
                        regs->sepc += get_break_insn_length(regs->sepc);
-                       break;
+                       return;
                case BUG_TRAP_TYPE_BUG:
 #endif /* CONFIG_GENERIC_BUG */
                default: