* [PATCH v2] linux-user/hppa: Fix segfaults on page zero
@ 2022-07-18 16:40 Helge Deller
2022-07-18 16:50 ` Peter Maydell
2022-07-18 19:06 ` Laurent Vivier
0 siblings, 2 replies; 3+ messages in thread
From: Helge Deller @ 2022-07-18 16:40 UTC (permalink / raw)
To: Laurent Vivier, Richard Henderson, qemu-devel,
Philippe Mathieu-Daudé
This program:
int main(void) { asm("bv %r0(%r0)"); return 0; }
produces on real hppa hardware the expected segfault:
SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x3} ---
killed by SIGSEGV +++
Segmentation fault
But when run on linux-user you get instead internal qemu errors:
ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
Bail out! ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
Bail out! ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
Fix it by adding the missing case for the EXCP_IMP trap in
cpu_loop() and raise a segfault.
Signed-off-by: Helge Deller <deller@gmx.de>
---
Changes:
v2: Dropped the "+++" in the commit message - it confused b4 and git-am.
no functional changes.
---
diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c
index a576d1a249..8f374aeef6 100644
--- a/linux-user/hppa/cpu_loop.c
+++ b/linux-user/hppa/cpu_loop.c
@@ -143,6 +143,9 @@ void cpu_loop(CPUHPPAState *env)
env->iaoq_f = env->gr[31];
env->iaoq_b = env->gr[31] + 4;
break;
+ case EXCP_IMP:
+ force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, env->iaoq_f);
+ break;
case EXCP_ILL:
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->iaoq_f);
break;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] linux-user/hppa: Fix segfaults on page zero
2022-07-18 16:40 [PATCH v2] linux-user/hppa: Fix segfaults on page zero Helge Deller
@ 2022-07-18 16:50 ` Peter Maydell
2022-07-18 19:06 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-07-18 16:50 UTC (permalink / raw)
To: Helge Deller
Cc: Laurent Vivier, Richard Henderson, qemu-devel,
Philippe Mathieu-Daudé
On Mon, 18 Jul 2022 at 17:44, Helge Deller <deller@gmx.de> wrote:
>
> This program:
>
> int main(void) { asm("bv %r0(%r0)"); return 0; }
>
> produces on real hppa hardware the expected segfault:
>
> SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x3} ---
> killed by SIGSEGV +++
> Segmentation fault
>
> But when run on linux-user you get instead internal qemu errors:
>
> ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
> Bail out! ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
> ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
> Bail out! ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
>
> Fix it by adding the missing case for the EXCP_IMP trap in
> cpu_loop() and raise a segfault.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
> Changes:
>
> v2: Dropped the "+++" in the commit message - it confused b4 and git-am.
> no functional changes.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] linux-user/hppa: Fix segfaults on page zero
2022-07-18 16:40 [PATCH v2] linux-user/hppa: Fix segfaults on page zero Helge Deller
2022-07-18 16:50 ` Peter Maydell
@ 2022-07-18 19:06 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-07-18 19:06 UTC (permalink / raw)
To: Helge Deller, Richard Henderson, qemu-devel,
Philippe Mathieu-Daudé
Le 18/07/2022 à 18:40, Helge Deller a écrit :
> This program:
>
> int main(void) { asm("bv %r0(%r0)"); return 0; }
>
> produces on real hppa hardware the expected segfault:
>
> SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x3} ---
> killed by SIGSEGV +++
> Segmentation fault
>
> But when run on linux-user you get instead internal qemu errors:
>
> ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
> Bail out! ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
> ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
> Bail out! ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
>
> Fix it by adding the missing case for the EXCP_IMP trap in
> cpu_loop() and raise a segfault.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
> Changes:
>
> v2: Dropped the "+++" in the commit message - it confused b4 and git-am.
> no functional changes.
>
> ---
> diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c
> index a576d1a249..8f374aeef6 100644
> --- a/linux-user/hppa/cpu_loop.c
> +++ b/linux-user/hppa/cpu_loop.c
> @@ -143,6 +143,9 @@ void cpu_loop(CPUHPPAState *env)
> env->iaoq_f = env->gr[31];
> env->iaoq_b = env->gr[31] + 4;
> break;
> + case EXCP_IMP:
> + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, env->iaoq_f);
> + break;
> case EXCP_ILL:
> force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->iaoq_f);
> break;
>
>
>
Applied to my linux-user-for-7.1 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-18 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-18 16:40 [PATCH v2] linux-user/hppa: Fix segfaults on page zero Helge Deller
2022-07-18 16:50 ` Peter Maydell
2022-07-18 19:06 ` Laurent Vivier
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).