Skip to content

Commit

Permalink
linux-user/mips: fix abort on integer overflow
Browse files Browse the repository at this point in the history
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.

Cc: qemu-stable@nongnu.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Message-Id: <3ef979a8-3ee1-eb2d-71f7-d788ff88dd11@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 6fad9b4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
Mikulas Patocka authored and Michael Tokarev committed Oct 21, 2023
1 parent f5358bc commit ea3c95a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion linux-user/mips/cpu_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ void cpu_loop(CPUMIPSState *env)
}
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.
*/
Expand Down

0 comments on commit ea3c95a

Please sign in to comment.