From: Mikulas Patocka <mpatocka@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
qemu-devel@nongnu.org
Subject: [PATCH v2] mips: fix abort on integer overflow
Date: Thu, 28 Sep 2023 21:55:20 +0200 (CEST) [thread overview]
Message-ID: <3ef979a8-3ee1-eb2d-71f7-d788ff88dd11@redhat.com> (raw)
In-Reply-To: <6148083e-ba07-798c-4cc3-6cf29236c53c@linaro.org>
On Thu, 28 Sep 2023, Richard Henderson wrote:
> Just call force_sig_fault directly.
>
>
> r~
OK. Here I'm resending it.
Mikulas
From: Mikulas Patocka <mpatocka@redhat.com>
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.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: qemu-stable@nongnu.org
---
linux-user/mips/cpu_loop.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: qemu/linux-user/mips/cpu_loop.c
===================================================================
--- qemu.orig/linux-user/mips/cpu_loop.c
+++ qemu/linux-user/mips/cpu_loop.c
@@ -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.
*/
next prev parent reply other threads:[~2023-09-28 19:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 11:16 [PATCH] mips: fix abort on integer overflow Mikulas Patocka
2023-09-28 19:37 ` Richard Henderson
2023-09-28 19:55 ` Mikulas Patocka [this message]
2023-10-03 20:28 ` [PATCH v2] " Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ef979a8-3ee1-eb2d-71f7-d788ff88dd11@redhat.com \
--to=mpatocka@redhat.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).