qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: "Helge Deller" <deller@gmx.de>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v2] linux-user/hppa: Fix segfaults on page zero
Date: Mon, 18 Jul 2022 21:06:46 +0200	[thread overview]
Message-ID: <24c90475-e653-c5d2-0372-a74b2d9f2d21@vivier.eu> (raw)
In-Reply-To: <YtWNC56seiV6VenA@p100>

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



      parent reply	other threads:[~2022-07-18 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=24c90475-e653-c5d2-0372-a74b2d9f2d21@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=deller@gmx.de \
    --cc=f4bug@amsat.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).