diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-02-01 10:56:15 -1000 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-02-21 08:44:13 -1000 |
commit | 21a474c41d18eb56186e2022e8e081c2b6011bd3 (patch) | |
tree | 8387b4abe102549bd518491e1ba636eb92499bf2 /linux-user/sparc | |
parent | 2627e4524ea6c6ba14f9d6b298e08c9d4d3cc4fe (diff) |
linux-user/sparc: Raise SIGILL for all unhandled software traps
The linux kernel's trap tables vector all unassigned trap
numbers to BAD_TRAP, which then raises SIGILL.
Tested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/sparc')
-rw-r--r-- | linux-user/sparc/cpu_loop.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 434c90a55f..c120c42278 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -248,6 +248,14 @@ void cpu_loop (CPUSPARCState *env) cpu_exec_step_atomic(cs); break; default: + /* + * Most software trap numbers vector to BAD_TRAP. + * Handle anything not explicitly matched above. + */ + if (trapnr >= TT_TRAP && trapnr <= TT_TRAP + 0x7f) { + force_sig_fault(TARGET_SIGILL, ILL_ILLTRP, env->pc); + break; + } fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr); cpu_dump_state(cs, stderr, 0); exit(EXIT_FAILURE); |