Skip to content

Commit 9955ac4

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: don't kill the kernel on a bad esr from el0
Rather than completely killing the kernel if we receive an esr value we can't deal with in the el0 handlers, send the process a SIGILL and log the esr value in the hope that we can debug it. If we receive a bad esr from el1, we'll die() as before. Signed-off-by: Mark Rutland <[email protected]> Signed-off-by: Catalin Marinas <[email protected]> Cc: [email protected]
1 parent 381cc2b commit 9955ac4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

arch/arm64/kernel/traps.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,20 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
311311
*/
312312
asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
313313
{
314+
siginfo_t info;
315+
void __user *pc = (void __user *)instruction_pointer(regs);
314316
console_verbose();
315317

316318
pr_crit("Bad mode in %s handler detected, code 0x%08x\n",
317319
handler[reason], esr);
320+
__show_regs(regs);
321+
322+
info.si_signo = SIGILL;
323+
info.si_errno = 0;
324+
info.si_code = ILL_ILLOPC;
325+
info.si_addr = pc;
318326

319-
die("Oops - bad mode", regs, 0);
320-
local_irq_disable();
321-
panic("bad mode");
327+
arm64_notify_die("Oops - bad mode", regs, &info, 0);
322328
}
323329

324330
void __pte_error(const char *file, int line, unsigned long val)

0 commit comments

Comments
 (0)