qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Laurent Vivier <laurent@vivier.eu>,
	Cornelia Huck <cohuck@redhat.com>
Cc: "jonathan . albrecht" <jonathan.albrecht@linux.vnet.ibm.com>,
	Ulrich Weigand <ulrich.weigand@de.ibm.com>,
	qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, Andreas Krebbel <krebbel@linux.ibm.com>
Subject: Re: [PATCH v6 1/2] target/s390x: Fix SIGILL and SIGFPE psw.addr reporting
Date: Tue, 6 Jul 2021 11:30:58 +0200	[thread overview]
Message-ID: <43367f9f-596b-6c2e-9e9a-fb25bca9e57d@redhat.com> (raw)
In-Reply-To: <20210705210434.45824-2-iii@linux.ibm.com>

On 05.07.21 23:04, Ilya Leoshkevich wrote:
> For SIGILL, SIGFPE and SIGTRAP the PSW must point after the
> instruction, and at the instruction for other signals. Currently under
> qemu-user for SIGFILL and SIGFPE it points at the instruction.
> 
> Fix by advancing psw.addr for these signals.
> 
> Buglink: https://gitlab.com/qemu-project/qemu/-/issues/319
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Co-developed-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
> ---
>   linux-user/s390x/cpu_loop.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c
> index 30568139df..6e7dfb290a 100644
> --- a/linux-user/s390x/cpu_loop.c
> +++ b/linux-user/s390x/cpu_loop.c
> @@ -64,7 +64,13 @@ void cpu_loop(CPUS390XState *env)
>           case EXCP_DEBUG:
>               sig = TARGET_SIGTRAP;
>               n = TARGET_TRAP_BRKPT;
> -            goto do_signal_pc;
> +            /*
> +             * For SIGTRAP the PSW must point after the instruction, which it
> +             * already does thanks to s390x_tr_tb_stop(). si_addr doesn't need
> +             * to be filled.
> +             */
> +            addr = 0;
> +            goto do_signal;
>           case EXCP_PGM:
>               n = env->int_pgm_code;
>               switch (n) {
> @@ -133,6 +139,10 @@ void cpu_loop(CPUS390XState *env)
>   
>           do_signal_pc:
>               addr = env->psw.addr;
> +            /*
> +             * For SIGILL and SIGFPE the PSW must point after the instruction.
> +             */
> +            env->psw.addr += env->int_pgm_ilen;
>           do_signal:
>               info.si_signo = sig;
>               info.si_errno = 0;
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2021-07-06  9:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 21:04 [PATCH v6 0/2] target/s390x: Fix SIGILL and SIGFPE psw.addr reporting Ilya Leoshkevich
2021-07-05 21:04 ` [PATCH v6 1/2] " Ilya Leoshkevich
2021-07-06  9:30   ` David Hildenbrand [this message]
2021-07-05 21:04 ` [PATCH v6 2/2] tests/tcg/s390x: Test SIGILL and SIGSEGV handling Ilya Leoshkevich
2021-07-20 13:30   ` jonathan.albrecht
2021-07-26 16:23   ` Ilya Leoshkevich
2021-08-03 14:33   ` Thomas Huth
2021-08-03  8:13 ` [PATCH v6 0/2] target/s390x: Fix SIGILL and SIGFPE psw.addr reporting Cornelia Huck
2021-08-03 10:16   ` Laurent Vivier

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=43367f9f-596b-6c2e-9e9a-fb25bca9e57d@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jonathan.albrecht@linux.vnet.ibm.com \
    --cc=krebbel@linux.ibm.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=ulrich.weigand@de.ibm.com \
    /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).