[PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting

Ilya Leoshkevich posted 2 patches 2 years, 10 months ago
Test checkpatch failed
Failed in applying to current master (apply log)
linux-user/s390x/cpu_loop.c     |   5 +
tests/tcg/s390x/Makefile.target |   1 +
tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
3 files changed, 171 insertions(+)
create mode 100644 tests/tcg/s390x/signal.c
[PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Ilya Leoshkevich 2 years, 10 months ago
qemu-s390x puts a wrong value into SIGILL's siginfo_t's psw.addr: it
should be a pointer to the instruction following the illegal
instruction, but at the moment it is a pointer to the illegal
instruction itself. This breaks OpenJDK, which relies on this value.
A similar problem exists for SIGFPE and SIGTRAP.

Patch 1 fixes the issue, patch 2 adds a test.

v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06592.html
v1 -> v2: Use a better buglink (Cornelia), simplify the inline asm
          magic in the test and add an explanation (David).

v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06649.html
v2 -> v3: Fix SIGSEGV handling (found when trying to run valgrind under
          qemu-user).

v3: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg00299.html
v3 -> v4: Fix compiling the test on Ubuntu 20.04 (Jonathan).

v4: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05848.html
v4 -> v5: Greatly simplify the fix (Ulrich).

Note: the compare-and-trap SIGFPE issue is being fixed separately.
https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05690.html

Ilya Leoshkevich (2):
  target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
  tests/tcg/s390x: Test SIGILL and SIGSEGV handling

 linux-user/s390x/cpu_loop.c     |   5 +
 tests/tcg/s390x/Makefile.target |   1 +
 tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
 3 files changed, 171 insertions(+)
 create mode 100644 tests/tcg/s390x/signal.c

-- 
2.31.1


Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Cornelia Huck 2 years, 10 months ago
On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:

> qemu-s390x puts a wrong value into SIGILL's siginfo_t's psw.addr: it
> should be a pointer to the instruction following the illegal
> instruction, but at the moment it is a pointer to the illegal
> instruction itself. This breaks OpenJDK, which relies on this value.
> A similar problem exists for SIGFPE and SIGTRAP.
>
> Patch 1 fixes the issue, patch 2 adds a test.
>
> v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06592.html
> v1 -> v2: Use a better buglink (Cornelia), simplify the inline asm
>           magic in the test and add an explanation (David).
>
> v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06649.html
> v2 -> v3: Fix SIGSEGV handling (found when trying to run valgrind under
>           qemu-user).
>
> v3: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg00299.html
> v3 -> v4: Fix compiling the test on Ubuntu 20.04 (Jonathan).
>
> v4: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05848.html
> v4 -> v5: Greatly simplify the fix (Ulrich).
>
> Note: the compare-and-trap SIGFPE issue is being fixed separately.
> https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05690.html
>
> Ilya Leoshkevich (2):
>   target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
>   tests/tcg/s390x: Test SIGILL and SIGSEGV handling
>
>  linux-user/s390x/cpu_loop.c     |   5 +
>  tests/tcg/s390x/Makefile.target |   1 +
>  tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
>  3 files changed, 171 insertions(+)
>  create mode 100644 tests/tcg/s390x/signal.c

What's the status of this and
<20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? linux-user
is not really my turf, but it would be sad if this fell through the
cracks.


Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Laurent Vivier 2 years, 10 months ago
Le 02/07/2021 à 12:34, Cornelia Huck a écrit :
> On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> 
>> qemu-s390x puts a wrong value into SIGILL's siginfo_t's psw.addr: it
>> should be a pointer to the instruction following the illegal
>> instruction, but at the moment it is a pointer to the illegal
>> instruction itself. This breaks OpenJDK, which relies on this value.
>> A similar problem exists for SIGFPE and SIGTRAP.
>>
>> Patch 1 fixes the issue, patch 2 adds a test.
>>
>> v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06592.html
>> v1 -> v2: Use a better buglink (Cornelia), simplify the inline asm
>>           magic in the test and add an explanation (David).
>>
>> v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06649.html
>> v2 -> v3: Fix SIGSEGV handling (found when trying to run valgrind under
>>           qemu-user).
>>
>> v3: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg00299.html
>> v3 -> v4: Fix compiling the test on Ubuntu 20.04 (Jonathan).
>>
>> v4: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05848.html
>> v4 -> v5: Greatly simplify the fix (Ulrich).
>>
>> Note: the compare-and-trap SIGFPE issue is being fixed separately.
>> https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05690.html
>>
>> Ilya Leoshkevich (2):
>>   target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
>>   tests/tcg/s390x: Test SIGILL and SIGSEGV handling
>>
>>  linux-user/s390x/cpu_loop.c     |   5 +
>>  tests/tcg/s390x/Makefile.target |   1 +
>>  tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
>>  3 files changed, 171 insertions(+)
>>  create mode 100644 tests/tcg/s390x/signal.c
> 
> What's the status of this and
> <20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? linux-user
> is not really my turf, but it would be sad if this fell through the
> cracks.
> 

If from the S390x point of view they are correct, I can collect them via linux-user.

Thanks,
Laurent

Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Ulrich Weigand 2 years, 10 months ago
On Fri, Jul 02, 2021 at 02:01:47PM +0200, Laurent Vivier wrote:
> Le 02/07/2021 à 12:34, Cornelia Huck a écrit :
> > On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> > 
> >> qemu-s390x puts a wrong value into SIGILL's siginfo_t's psw.addr: it
> >> should be a pointer to the instruction following the illegal
> >> instruction, but at the moment it is a pointer to the illegal
> >> instruction itself. This breaks OpenJDK, which relies on this value.
> >> A similar problem exists for SIGFPE and SIGTRAP.
> >>
> >> Patch 1 fixes the issue, patch 2 adds a test.
> >>
> >> v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06592.html
> >> v1 -> v2: Use a better buglink (Cornelia), simplify the inline asm
> >>           magic in the test and add an explanation (David).
> >>
> >> v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06649.html
> >> v2 -> v3: Fix SIGSEGV handling (found when trying to run valgrind under
> >>           qemu-user).
> >>
> >> v3: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg00299.html
> >> v3 -> v4: Fix compiling the test on Ubuntu 20.04 (Jonathan).
> >>
> >> v4: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05848.html
> >> v4 -> v5: Greatly simplify the fix (Ulrich).
> >>
> >> Note: the compare-and-trap SIGFPE issue is being fixed separately.
> >> https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05690.html
> >>
> >> Ilya Leoshkevich (2):
> >>   target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
> >>   tests/tcg/s390x: Test SIGILL and SIGSEGV handling
> >>
> >>  linux-user/s390x/cpu_loop.c     |   5 +
> >>  tests/tcg/s390x/Makefile.target |   1 +
> >>  tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
> >>  3 files changed, 171 insertions(+)
> >>  create mode 100644 tests/tcg/s390x/signal.c
> > 
> > What's the status of this and
> > <20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? linux-user
> > is not really my turf, but it would be sad if this fell through the
> > cracks.
> > 
> 
> If from the S390x point of view they are correct, I can collect them via linux-user.

It's certainly correct that SIGILL, SIGFPE and SIGTRAP are delivered with psw.addr
pointing *after* the faulting instruction, that forms in effect part of the kernel
ABI on s390x.  We're planning to document this in the next revision of the ABI
document, see here: https://github.com/IBM/s390x-abi/issues/2

I can also confirm that this patch fixes the problems I was seeing when running
the s390x wasmtime JIT under qemu.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Cornelia Huck 2 years, 9 months ago
On Fri, Jul 02 2021, Laurent Vivier <laurent@vivier.eu> wrote:

> Le 02/07/2021 à 12:34, Cornelia Huck a écrit :
>> On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>> 
>>> qemu-s390x puts a wrong value into SIGILL's siginfo_t's psw.addr: it
>>> should be a pointer to the instruction following the illegal
>>> instruction, but at the moment it is a pointer to the illegal
>>> instruction itself. This breaks OpenJDK, which relies on this value.
>>> A similar problem exists for SIGFPE and SIGTRAP.
>>>
>>> Patch 1 fixes the issue, patch 2 adds a test.
>>>
>>> v1: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06592.html
>>> v1 -> v2: Use a better buglink (Cornelia), simplify the inline asm
>>>           magic in the test and add an explanation (David).
>>>
>>> v2: https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg06649.html
>>> v2 -> v3: Fix SIGSEGV handling (found when trying to run valgrind under
>>>           qemu-user).
>>>
>>> v3: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg00299.html
>>> v3 -> v4: Fix compiling the test on Ubuntu 20.04 (Jonathan).
>>>
>>> v4: https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05848.html
>>> v4 -> v5: Greatly simplify the fix (Ulrich).
>>>
>>> Note: the compare-and-trap SIGFPE issue is being fixed separately.
>>> https://lists.nongnu.org/archive/html/qemu-devel/2021-06/msg05690.html
>>>
>>> Ilya Leoshkevich (2):
>>>   target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
>>>   tests/tcg/s390x: Test SIGILL and SIGSEGV handling
>>>
>>>  linux-user/s390x/cpu_loop.c     |   5 +
>>>  tests/tcg/s390x/Makefile.target |   1 +
>>>  tests/tcg/s390x/signal.c        | 165 ++++++++++++++++++++++++++++++++
>>>  3 files changed, 171 insertions(+)
>>>  create mode 100644 tests/tcg/s390x/signal.c
>> 
>> What's the status of this and
>> <20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? linux-user
>> is not really my turf, but it would be sad if this fell through the
>> cracks.
>> 
>
> If from the S390x point of view they are correct, I can collect them via linux-user.

Thanks!

Acked-by: Cornelia Huck <cohuck@redhat.com>


Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by jonathan.albrecht 2 years, 9 months ago
On 2021-07-02 8:01 am, Laurent Vivier wrote:
> Le 02/07/2021 à 12:34, Cornelia Huck a écrit :
>> On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>> 
>> 
>> What's the status of this and
>> <20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? 
>> linux-user
>> is not really my turf, but it would be sad if this fell through the
>> cracks.
>> 
> 
> If from the S390x point of view they are correct, I can collect them
> via linux-user.
> 

IIUC, the latest versions of these two series should be ready now:

https://lore.kernel.org/qemu-devel/20210705210434.45824-1-iii@linux.ibm.com/
https://lore.kernel.org/qemu-devel/20210709160459.4962-1-jonathan.albrecht@linux.vnet.ibm.com/

Can they still get into 6.1?

Thanks,

Jon

Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by Ilya Leoshkevich 2 years, 9 months ago
On Mon, 2021-07-12 at 10:59 -0400, jonathan.albrecht wrote:
> On 2021-07-02 8:01 am, Laurent Vivier wrote:
> > Le 02/07/2021 à 12:34, Cornelia Huck a écrit :
> > > On Wed, Jun 23 2021, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> > > 
> > > 
> > > What's the status of this and
> > > <20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com>? 
> > > linux-user
> > > is not really my turf, but it would be sad if this fell through the
> > > cracks.
> > > 
> > 
> > If from the S390x point of view they are correct, I can collect them
> > via linux-user.
> > 
> 
> IIUC, the latest versions of these two series should be ready now:
> 
> https://lore.kernel.org/qemu-devel/20210705210434.45824-1-iii@linux.ibm.com/
> https://lore.kernel.org/qemu-devel/20210709160459.4962-1-jonathan.albrecht@linux.vnet.ibm.com/
> 
> Can they still get into 6.1?
> 
> Thanks,
> 
> Jon

The test patch from my v6 series hasn't been reviewed yet:

https://lore.kernel.org/qemu-devel/20210705210434.45824-3-iii@linux.ibm.com/

Could anyone have a look, please?

Best regards,
Ilya


Re: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting
Posted by no-reply@patchew.org 2 years, 10 months ago
Patchew URL: https://patchew.org/QEMU/20210623023250.3667563-1-iii@linux.ibm.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210623023250.3667563-1-iii@linux.ibm.com
Subject: [PATCH v5 0/2] target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com -> patchew/20210621141452.2045-1-jonathan.albrecht@linux.vnet.ibm.com
 * [new tag]         patchew/20210623023250.3667563-1-iii@linux.ibm.com -> patchew/20210623023250.3667563-1-iii@linux.ibm.com
Switched to a new branch 'test'
56bc4f3 tests/tcg/s390x: Test SIGILL and SIGSEGV handling
b6b6d39 target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting

=== OUTPUT BEGIN ===
1/2 Checking commit b6b6d3978456 (target/s390x: Fix SIGILL/SIGFPE/SIGTRAP psw.addr reporting)
2/2 Checking commit 56bc4f3bb893 (tests/tcg/s390x: Test SIGILL and SIGSEGV handling)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#26: 
new file mode 100644

ERROR: externs should be avoided in .c files
#44: FILE: tests/tcg/s390x/signal.c:14:
+void illegal_op(void);

ERROR: externs should be avoided in .c files
#45: FILE: tests/tcg/s390x/signal.c:15:
+void after_illegal_op(void);

ERROR: externs should be avoided in .c files
#51: FILE: tests/tcg/s390x/signal.c:21:
+void stg(void *dst, unsigned long src);

ERROR: externs should be avoided in .c files
#56: FILE: tests/tcg/s390x/signal.c:26:
+void mvc_8(void *dst, void *src);

total: 4 errors, 1 warnings, 169 lines checked

Patch 2/2 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210623023250.3667563-1-iii@linux.ibm.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com