[PATCH 0/4] riscv: correct the do_trap_break()

From: Vincent Chen
Date: Sun Sep 22 2019 - 20:45:46 EST



The following three situations may occur in the current implementation of
do_trap_break().
1. When the CONFIG_GENERIC_BUG is disabled, if a kernel thread is trapped
by BUG(), the whole system will be in the loop that infinitely handles
the break exception instead of entering the die function.
2. 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.
3. Handling the unexpected ebreak instructions is to send a SIGTRAP
to the trapped thread. However, if a kernel executes an unexpected
ebreak, it may cause the kernel thread to be stuck in the ebreak
instruction.

This patch set will solve the above problems by adjusting the
implementations of the do_trap_break().


Vincent Chen (4):
riscv: avoid kernel hangs when trapped in BUG()
rsicv: avoid sending a SIGTRAP to a user thread trapped in WARN()
riscv: Correct the handling of unexpected ebreak in do_trap_break()
riscv: remove the switch statement in do_trap_break()

arch/riscv/kernel/traps.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

--
2.7.4