mips: fix abort on integer overflow
PATCH 1/1 mips: fix abort on integer overflow
Qemu mips userspace emulation crashes with "qemu: unhandled CPU exception 0x15 - aborting" when one of the integer arithmetic instructions detects an overflow.
This patch fixes it so that it delivers SIGFPE with FPE_INTOVF instead.
--- linux-user/mips/cpu_loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
linux-user/mips/cpu_loop.c +3 -1
@@ -180,7 +180,9 @@ done_syscall: }force_sig_fault (TARGET_SIGFPE , si_code, env->active_tc.PC);break ; - +case EXCP_OVERFLOW : +do_tr_or_bp (env,BRK_OVERFLOW , false); +break ;/* The code below was inspired by the MIPS Linux kernel trap * handling code in arch/mips/kernel/traps.c. */
Quoted 18 lines · Mikulas Patocka
Qemu mips userspace emulation crashes with "qemu: unhandled CPU exception
0x15- aborting" when one of the integer arithmetic instructions detects an overflow.This patch fixes it so that it delivers SIGFPE with
FPE_INTOVFinstead.Signed-off-by Mikulas Patocka <[email protected]>--- linux-user/mips/cpu_loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Index:
qemu/linux-user/mips/cpu_loop.c
===================================================================
linux-user/mips/cpu_loop.c done_syscall: · line 185
Quoted 7 lines
linux-user/mips/cpu_loop.c +3
-1@@ -180,7 +180,9 @@ done_syscall: }force_sig_fault (TARGET_SIGFPE , si_code, env->active_tc.PC);break ; - +case EXCP_OVERFLOW : +do_tr_or_bp (env,BRK_OVERFLOW , false); +break ;
Just call force_sig_fault directly.
r~
PATCH v2 1/1 mips: fix abort on integer overflow
Quoted 4 lines · Richard Henderson
Just call
force_sig_faultdirectly.r~
OK. Here I'm resending it.
Mikulas
From: Mikulas Patocka <[email protected]>
Qemu mips userspace emulation crashes with "qemu: unhandled CPU exception 0x15 - aborting" when one of the integer arithmetic instructions detects an overflow.
This patch fixes it so that it delivers SIGFPE with FPE_INTOVF instead.
--- linux-user/mips/cpu_loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
linux-user/mips/cpu_loop.c +3 -1
@@ -180,7 +180,9 @@ done_syscall: }force_sig_fault (TARGET_SIGFPE , si_code, env->active_tc.PC);break ; - +case EXCP_OVERFLOW : +force_sig_fault (TARGET_SIGFPE ,TARGET_FPE_INTOVF , env->active_tc.PC); +break ;/* The code below was inspired by the MIPS Linux kernel trap * handling code in arch/mips/kernel/traps.c. */
Quoted 17 lines · Mikulas Patocka
Quoted 4 lines · Richard Henderson
Just call
force_sig_faultdirectly.r~
OK. Here I'm resending it.
Mikulas
From: Mikulas Patocka <[email protected]>
Quoted 8 lines
Qemu mips userspace emulation crashes with "qemu: unhandled CPU exception
0x15- aborting" when one of the integer arithmetic instructions detects an overflow.This patch fixes it so that it delivers SIGFPE with
FPE_INTOVFinstead.Signed-off-by Mikulas Patocka <[email protected]>
and queued to linux-user-next.
r~