linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build
@ 2023-03-07  6:57 Naresh Kamboju
  2023-03-07 19:28 ` Chang S. Bae
  0 siblings, 1 reply; 5+ messages in thread
From: Naresh Kamboju @ 2023-03-07  6:57 UTC (permalink / raw)
  To: open list:KERNEL SELFTEST FRAMEWORK, linux-api, open list,
	lkft-triage
  Cc: Shuah Khan, Thomas Gleixner, Chang S. Bae, Len Brown,
	Borislav Petkov, Stas Sergeev, Arnd Bergmann, Anders Roxell

kselftest: sigaltstack built with clang-16 getting failed but passed with
gcc-12 build. Please find more details about test logs on clang-16 and
gcc-12 and steps to reproduce locally on your machine by using tuxrun.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Test log:
----------

Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake) (Debian clang
version 16.0.0 (++20230228093516+60692a66ced6-1~exp1~20230228093525.41),
Debian LLD 16.0.0) #1 SMP PREEMPT @1678159722
...
kselftest: Running tests in sigaltstack
TAP version 13
1..1
# selftests: sigaltstack: sas
# # [NOTE] the stack size is 21104
# TAP version 13
# 1..3
# ok 1 Initial sigaltstack state was SS_DISABLE
# Bail out! SP is not on sigaltstack
# # Planned tests != run tests (3 != 1)
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
not ok 1 selftests: sigaltstack: sas # exit=1

Links,
  qemu-x86_64:
  - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15303778/suite/kselftest-sigaltstack/test/sigaltstack_sas/details/

  qemu-arm64:
  - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15302557/suite/kselftest-sigaltstack/tests/
  - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15302557/suite/kselftest-sigaltstack/test/sigaltstack_sas/log

kselftest: sigaltstack built with gcc-12 getting pass.

Test log:
---------
Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake)
(aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
for Debian) 2.40) #1 SMP PREEMPT @1678159736
...
kselftest: Running tests in sigaltstack
TAP version 13
1..1
# selftests: sigaltstack: sas
# # [NOTE] the stack size is 50080
# TAP version 13
# 1..3
# ok 1 Initial sigaltstack state was SS_DISABLE
# # [RUN] signal USR1
# ok 2 sigaltstack is disabled in sighandler
# # [RUN] switched to user ctx
# # [RUN] signal USR2
# # [OK] Stack preserved
# ok 3 sigaltstack is still SS_AUTODISARM after signal
# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 1 selftests: sigaltstack: sas

Links,
 qemu-x86_64:
   - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15303751/suite/kselftest-sigaltstack/tests/

 qemu-arm64:
  - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15302458/suite/kselftest-sigaltstack/tests/
  - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230307/testrun/15302458/suite/kselftest-sigaltstack/test/sigaltstack_sas/log



Steps to reproduce:
--------------

# To install tuxrun on your system globally:
# sudo pip3 install -U tuxrun==0.37.2
#
# See https://tuxrun.org/ for complete documentation.

tuxrun  \
 --runtime podman  \
 --device qemu-x86_64  \
 --boot-args rw  \
 --kernel https://storage.tuxsuite.com/public/linaro/lkft/builds/2MfXLbLsvBufVn1MrsnXVZ133Bf/bzImage
 \
 --modules https://storage.tuxsuite.com/public/linaro/lkft/builds/2MfXLbLsvBufVn1MrsnXVZ133Bf/modules.tar.xz
 \
 --rootfs https://storage.tuxboot.com/debian/bookworm/amd64/rootfs.ext4.xz  \
 --parameters SKIPFILE=skipfile-lkft.yaml  \
 --parameters KSELFTEST=https://storage.tuxsuite.com/public/linaro/lkft/builds/2MfXLbLsvBufVn1MrsnXVZ133Bf/kselftest.tar.xz
 \
 --image docker.io/lavasoftware/lava-dispatcher:2023.01.0020.gc1598238f  \
 --tests kselftest-sigaltstack  \
 --timeouts boot=15


--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build
  2023-03-07  6:57 selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build Naresh Kamboju
@ 2023-03-07 19:28 ` Chang S. Bae
  2023-03-08  3:14   ` Naresh Kamboju
  0 siblings, 1 reply; 5+ messages in thread
From: Chang S. Bae @ 2023-03-07 19:28 UTC (permalink / raw)
  To: Naresh Kamboju, open list:KERNEL SELFTEST FRAMEWORK, linux-api,
	open list, lkft-triage
  Cc: Shuah Khan, Thomas Gleixner, Len Brown, Borislav Petkov,
	Stas Sergeev, Arnd Bergmann, Anders Roxell

On 3/6/2023 10:57 PM, Naresh Kamboju wrote:
> kselftest: sigaltstack built with clang-16 getting failed but passed with
> gcc-12 build. Please find more details about test logs on clang-16 and
> gcc-12 and steps to reproduce locally on your machine by using tuxrun.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> Test log:
> ----------
> 
> Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake) (Debian clang
> version 16.0.0 (++20230228093516+60692a66ced6-1~exp1~20230228093525.41),
> Debian LLD 16.0.0) #1 SMP PREEMPT @1678159722
> ...
> kselftest: Running tests in sigaltstack
> TAP version 13
> 1..1
> # selftests: sigaltstack: sas
> # # [NOTE] the stack size is 21104
> # TAP version 13
> # 1..3
> # ok 1 Initial sigaltstack state was SS_DISABLE
> # Bail out! SP is not on sigaltstack
> # # Planned tests != run tests (3 != 1)
> # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> not ok 1 selftests: sigaltstack: sas # exit=1
<snip>

> Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake)
> (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> for Debian) 2.40) #1 SMP PREEMPT @1678159736
> ...
> kselftest: Running tests in sigaltstack
> TAP version 13
> 1..1
> # selftests: sigaltstack: sas
> # # [NOTE] the stack size is 50080
> # TAP version 13
> # 1..3
> # ok 1 Initial sigaltstack state was SS_DISABLE
> # # [RUN] signal USR1
> # ok 2 sigaltstack is disabled in sighandler
> # # [RUN] switched to user ctx
> # # [RUN] signal USR2
> # # [OK] Stack preserved
> # ok 3 sigaltstack is still SS_AUTODISARM after signal
> # # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> ok 1 selftests: sigaltstack: sas

At glance, the log shows the altstack size difference between LLVM and GCC.

But, when I tried with the LLVM that I have,

     $ clang --version
     clang version 13.0.0 ...

it failed only with this compiler:

     $ rm sas;clang -o sas sas.c;./sas
     # [NOTE]        the stack size is 8192
     TAP version 13
     1..3
     ok 1 Initial sigaltstack state was SS_DISABLE
     Bail out! SP is not on sigaltstack
     # Planned tests != run tests (3 != 1)
     # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

     $ rm sas;gcc -o sas sas.c;./sas
     # [NOTE]        the stack size is 8192
     TAP version 13
     1..3
     ok 1 Initial sigaltstack state was SS_DISABLE
     # [RUN] signal USR1
     ok 2 sigaltstack is disabled in sighandler
     # [RUN] switched to user ctx
     # [RUN] signal USR2
     # [OK]  Stack preserved
     ok 3 sigaltstack is still SS_AUTODISARM after signal
     # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

The same is true with some old versions -- e.g. the one that came with 
commit 0c49ad415512 ("tools/testing/selftests/sigaltstack/sas.c: improve 
output of sigaltstack testcase"):

     $ rm sas;clang -o sas sas.c;./sas
     [OK]    Initial sigaltstack state was SS_DISABLE
     [FAIL]  SP is not on sigaltstack

     $ rm sas;gcc -o sas sas.c;./sas
     [OK]    Initial sigaltstack state was SS_DISABLE
     [RUN]   signal USR1
     [OK]    sigaltstack is disabled in sighandler
     [RUN]   switched to user ctx
     [RUN]   signal USR2
     [OK]    Stack preserved
     [OK]    sigaltstack is still SS_AUTODISARM after signal
     [OK]    Test passed

So, this test failure appears to have been there for a while. I think 
the LLVM folks need to take a look at it.

Thanks,
Chang

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build
  2023-03-07 19:28 ` Chang S. Bae
@ 2023-03-08  3:14   ` Naresh Kamboju
  2023-03-08 16:22     ` Andy Lutomirski
  0 siblings, 1 reply; 5+ messages in thread
From: Naresh Kamboju @ 2023-03-08  3:14 UTC (permalink / raw)
  To: Chang S. Bae, llvm
  Cc: open list:KERNEL SELFTEST FRAMEWORK, linux-api, open list,
	lkft-triage, Shuah Khan, Thomas Gleixner, Len Brown,
	Borislav Petkov, Stas Sergeev, Arnd Bergmann, Anders Roxell,
	Nathan Chancellor

+ LLVM

On Wed, 8 Mar 2023 at 00:58, Chang S. Bae <chang.seok.bae@intel.com> wrote:
>
> On 3/6/2023 10:57 PM, Naresh Kamboju wrote:
> > kselftest: sigaltstack built with clang-16 getting failed but passed with
> > gcc-12 build. Please find more details about test logs on clang-16 and
> > gcc-12 and steps to reproduce locally on your machine by using tuxrun.
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >
> > Test log:
> > ----------
> >
> > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake) (Debian clang
> > version 16.0.0 (++20230228093516+60692a66ced6-1~exp1~20230228093525.41),
> > Debian LLD 16.0.0) #1 SMP PREEMPT @1678159722
> > ...
> > kselftest: Running tests in sigaltstack
> > TAP version 13
> > 1..1
> > # selftests: sigaltstack: sas
> > # # [NOTE] the stack size is 21104
> > # TAP version 13
> > # 1..3
> > # ok 1 Initial sigaltstack state was SS_DISABLE
> > # Bail out! SP is not on sigaltstack
> > # # Planned tests != run tests (3 != 1)
> > # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> > not ok 1 selftests: sigaltstack: sas # exit=1
> <snip>
>
> > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake)
> > (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> > for Debian) 2.40) #1 SMP PREEMPT @1678159736
> > ...
> > kselftest: Running tests in sigaltstack
> > TAP version 13
> > 1..1
> > # selftests: sigaltstack: sas
> > # # [NOTE] the stack size is 50080
> > # TAP version 13
> > # 1..3
> > # ok 1 Initial sigaltstack state was SS_DISABLE
> > # # [RUN] signal USR1
> > # ok 2 sigaltstack is disabled in sighandler
> > # # [RUN] switched to user ctx
> > # # [RUN] signal USR2
> > # # [OK] Stack preserved
> > # ok 3 sigaltstack is still SS_AUTODISARM after signal
> > # # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> > ok 1 selftests: sigaltstack: sas
>
> At glance, the log shows the altstack size difference between LLVM and GCC.
>
> But, when I tried with the LLVM that I have,
>
>      $ clang --version
>      clang version 13.0.0 ...
>
> it failed only with this compiler:
>
>      $ rm sas;clang -o sas sas.c;./sas
>      # [NOTE]        the stack size is 8192
>      TAP version 13
>      1..3
>      ok 1 Initial sigaltstack state was SS_DISABLE
>      Bail out! SP is not on sigaltstack
>      # Planned tests != run tests (3 != 1)
>      # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
>
>      $ rm sas;gcc -o sas sas.c;./sas
>      # [NOTE]        the stack size is 8192
>      TAP version 13
>      1..3
>      ok 1 Initial sigaltstack state was SS_DISABLE
>      # [RUN] signal USR1
>      ok 2 sigaltstack is disabled in sighandler
>      # [RUN] switched to user ctx
>      # [RUN] signal USR2
>      # [OK]  Stack preserved
>      ok 3 sigaltstack is still SS_AUTODISARM after signal
>      # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> The same is true with some old versions -- e.g. the one that came with
> commit 0c49ad415512 ("tools/testing/selftests/sigaltstack/sas.c: improve
> output of sigaltstack testcase"):
>
>      $ rm sas;clang -o sas sas.c;./sas
>      [OK]    Initial sigaltstack state was SS_DISABLE
>      [FAIL]  SP is not on sigaltstack
>
>      $ rm sas;gcc -o sas sas.c;./sas
>      [OK]    Initial sigaltstack state was SS_DISABLE
>      [RUN]   signal USR1
>      [OK]    sigaltstack is disabled in sighandler
>      [RUN]   switched to user ctx
>      [RUN]   signal USR2
>      [OK]    Stack preserved
>      [OK]    sigaltstack is still SS_AUTODISARM after signal
>      [OK]    Test passed
>
> So, this test failure appears to have been there for a while. I think
> the LLVM folks need to take a look at it.
>
> Thanks,
> Chang

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build
  2023-03-08  3:14   ` Naresh Kamboju
@ 2023-03-08 16:22     ` Andy Lutomirski
  2023-03-08 18:49       ` Nick Desaulniers
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Lutomirski @ 2023-03-08 16:22 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Chang S. Bae, llvm, open list:KERNEL SELFTEST FRAMEWORK,
	linux-api, open list, lkft-triage, Shuah Khan, Thomas Gleixner,
	Len Brown, Borislav Petkov, Stas Sergeev, Arnd Bergmann,
	Anders Roxell, Nathan Chancellor

On Tue, Mar 7, 2023 at 7:14 PM Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
>
> + LLVM

The offending code seems to be:

#if __s390x__
        register unsigned long sp asm("%15");
#else
        register unsigned long sp asm("sp");
#endif

        if (sp < (unsigned long)sstack ||
                        sp >= (unsigned long)sstack + stack_size) {
                ksft_exit_fail_msg("SP is not on sigaltstack\n");
        }

Is that actually expected to work?  asm("sp") is a horrible hack.  I
would, maybe naively, expect a compiler to analyze this code, think
"sp is unconditionally uninitialized", and treat the comparison as
always-UB and thus generate whatever code seems convenient.

--Andy

>
> On Wed, 8 Mar 2023 at 00:58, Chang S. Bae <chang.seok.bae@intel.com> wrote:
> >
> > On 3/6/2023 10:57 PM, Naresh Kamboju wrote:
> > > kselftest: sigaltstack built with clang-16 getting failed but passed with
> > > gcc-12 build. Please find more details about test logs on clang-16 and
> > > gcc-12 and steps to reproduce locally on your machine by using tuxrun.
> > >
> > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > >
> > > Test log:
> > > ----------
> > >
> > > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake) (Debian clang
> > > version 16.0.0 (++20230228093516+60692a66ced6-1~exp1~20230228093525.41),
> > > Debian LLD 16.0.0) #1 SMP PREEMPT @1678159722
> > > ...
> > > kselftest: Running tests in sigaltstack
> > > TAP version 13
> > > 1..1
> > > # selftests: sigaltstack: sas
> > > # # [NOTE] the stack size is 21104
> > > # TAP version 13
> > > # 1..3
> > > # ok 1 Initial sigaltstack state was SS_DISABLE
> > > # Bail out! SP is not on sigaltstack
> > > # # Planned tests != run tests (3 != 1)
> > > # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > not ok 1 selftests: sigaltstack: sas # exit=1
> > <snip>
> >
> > > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake)
> > > (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> > > for Debian) 2.40) #1 SMP PREEMPT @1678159736
> > > ...
> > > kselftest: Running tests in sigaltstack
> > > TAP version 13
> > > 1..1
> > > # selftests: sigaltstack: sas
> > > # # [NOTE] the stack size is 50080
> > > # TAP version 13
> > > # 1..3
> > > # ok 1 Initial sigaltstack state was SS_DISABLE
> > > # # [RUN] signal USR1
> > > # ok 2 sigaltstack is disabled in sighandler
> > > # # [RUN] switched to user ctx
> > > # # [RUN] signal USR2
> > > # # [OK] Stack preserved
> > > # ok 3 sigaltstack is still SS_AUTODISARM after signal
> > > # # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > ok 1 selftests: sigaltstack: sas
> >
> > At glance, the log shows the altstack size difference between LLVM and GCC.
> >
> > But, when I tried with the LLVM that I have,
> >
> >      $ clang --version
> >      clang version 13.0.0 ...
> >
> > it failed only with this compiler:
> >
> >      $ rm sas;clang -o sas sas.c;./sas
> >      # [NOTE]        the stack size is 8192
> >      TAP version 13
> >      1..3
> >      ok 1 Initial sigaltstack state was SS_DISABLE
> >      Bail out! SP is not on sigaltstack
> >      # Planned tests != run tests (3 != 1)
> >      # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> >
> >      $ rm sas;gcc -o sas sas.c;./sas
> >      # [NOTE]        the stack size is 8192
> >      TAP version 13
> >      1..3
> >      ok 1 Initial sigaltstack state was SS_DISABLE
> >      # [RUN] signal USR1
> >      ok 2 sigaltstack is disabled in sighandler
> >      # [RUN] switched to user ctx
> >      # [RUN] signal USR2
> >      # [OK]  Stack preserved
> >      ok 3 sigaltstack is still SS_AUTODISARM after signal
> >      # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> >
> > The same is true with some old versions -- e.g. the one that came with
> > commit 0c49ad415512 ("tools/testing/selftests/sigaltstack/sas.c: improve
> > output of sigaltstack testcase"):
> >
> >      $ rm sas;clang -o sas sas.c;./sas
> >      [OK]    Initial sigaltstack state was SS_DISABLE
> >      [FAIL]  SP is not on sigaltstack
> >
> >      $ rm sas;gcc -o sas sas.c;./sas
> >      [OK]    Initial sigaltstack state was SS_DISABLE
> >      [RUN]   signal USR1
> >      [OK]    sigaltstack is disabled in sighandler
> >      [RUN]   switched to user ctx
> >      [RUN]   signal USR2
> >      [OK]    Stack preserved
> >      [OK]    sigaltstack is still SS_AUTODISARM after signal
> >      [OK]    Test passed
> >
> > So, this test failure appears to have been there for a while. I think
> > the LLVM folks need to take a look at it.
> >
> > Thanks,
> > Chang

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build
  2023-03-08 16:22     ` Andy Lutomirski
@ 2023-03-08 18:49       ` Nick Desaulniers
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2023-03-08 18:49 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Naresh Kamboju, Chang S. Bae, llvm,
	open list:KERNEL SELFTEST FRAMEWORK, linux-api, open list,
	lkft-triage, Shuah Khan, Thomas Gleixner, Len Brown,
	Borislav Petkov, Stas Sergeev, Arnd Bergmann, Anders Roxell,
	Nathan Chancellor, Kees Cook

On Wed, Mar 8, 2023 at 8:23 AM Andy Lutomirski <luto@kernel.org> wrote:
>
> On Tue, Mar 7, 2023 at 7:14 PM Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> >
> > + LLVM
>
> The offending code seems to be:
>
> #if __s390x__
>         register unsigned long sp asm("%15");
> #else
>         register unsigned long sp asm("sp");
> #endif
>
>         if (sp < (unsigned long)sstack ||
>                         sp >= (unsigned long)sstack + stack_size) {
>                 ksft_exit_fail_msg("SP is not on sigaltstack\n");
>         }
>
> Is that actually expected to work?  asm("sp") is a horrible hack.  I
> would, maybe naively, expect a compiler to analyze this code, think
> "sp is unconditionally uninitialized", and treat the comparison as
> always-UB and thus generate whatever code seems convenient.

Spot-on. -Wuninitialized should warn about that.
https://godbolt.org/z/do9Kqa3cG

Kees mentioned we should be using `current_stack_pointer`. I'll whip
up a patch using that.

>
> --Andy
>
> >
> > On Wed, 8 Mar 2023 at 00:58, Chang S. Bae <chang.seok.bae@intel.com> wrote:
> > >
> > > On 3/6/2023 10:57 PM, Naresh Kamboju wrote:
> > > > kselftest: sigaltstack built with clang-16 getting failed but passed with
> > > > gcc-12 build. Please find more details about test logs on clang-16 and
> > > > gcc-12 and steps to reproduce locally on your machine by using tuxrun.
> > > >
> > > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > > >
> > > > Test log:
> > > > ----------
> > > >
> > > > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake) (Debian clang
> > > > version 16.0.0 (++20230228093516+60692a66ced6-1~exp1~20230228093525.41),
> > > > Debian LLD 16.0.0) #1 SMP PREEMPT @1678159722
> > > > ...
> > > > kselftest: Running tests in sigaltstack
> > > > TAP version 13
> > > > 1..1
> > > > # selftests: sigaltstack: sas
> > > > # # [NOTE] the stack size is 21104
> > > > # TAP version 13
> > > > # 1..3
> > > > # ok 1 Initial sigaltstack state was SS_DISABLE
> > > > # Bail out! SP is not on sigaltstack
> > > > # # Planned tests != run tests (3 != 1)
> > > > # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > > not ok 1 selftests: sigaltstack: sas # exit=1
> > > <snip>
> > >
> > > > Linux version 6.3.0-rc1-next-20230307 (tuxmake@tuxmake)
> > > > (aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils
> > > > for Debian) 2.40) #1 SMP PREEMPT @1678159736
> > > > ...
> > > > kselftest: Running tests in sigaltstack
> > > > TAP version 13
> > > > 1..1
> > > > # selftests: sigaltstack: sas
> > > > # # [NOTE] the stack size is 50080
> > > > # TAP version 13
> > > > # 1..3
> > > > # ok 1 Initial sigaltstack state was SS_DISABLE
> > > > # # [RUN] signal USR1
> > > > # ok 2 sigaltstack is disabled in sighandler
> > > > # # [RUN] switched to user ctx
> > > > # # [RUN] signal USR2
> > > > # # [OK] Stack preserved
> > > > # ok 3 sigaltstack is still SS_AUTODISARM after signal
> > > > # # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> > > > ok 1 selftests: sigaltstack: sas
> > >
> > > At glance, the log shows the altstack size difference between LLVM and GCC.
> > >
> > > But, when I tried with the LLVM that I have,
> > >
> > >      $ clang --version
> > >      clang version 13.0.0 ...
> > >
> > > it failed only with this compiler:
> > >
> > >      $ rm sas;clang -o sas sas.c;./sas
> > >      # [NOTE]        the stack size is 8192
> > >      TAP version 13
> > >      1..3
> > >      ok 1 Initial sigaltstack state was SS_DISABLE
> > >      Bail out! SP is not on sigaltstack
> > >      # Planned tests != run tests (3 != 1)
> > >      # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> > >
> > >      $ rm sas;gcc -o sas sas.c;./sas
> > >      # [NOTE]        the stack size is 8192
> > >      TAP version 13
> > >      1..3
> > >      ok 1 Initial sigaltstack state was SS_DISABLE
> > >      # [RUN] signal USR1
> > >      ok 2 sigaltstack is disabled in sighandler
> > >      # [RUN] switched to user ctx
> > >      # [RUN] signal USR2
> > >      # [OK]  Stack preserved
> > >      ok 3 sigaltstack is still SS_AUTODISARM after signal
> > >      # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> > >
> > > The same is true with some old versions -- e.g. the one that came with
> > > commit 0c49ad415512 ("tools/testing/selftests/sigaltstack/sas.c: improve
> > > output of sigaltstack testcase"):
> > >
> > >      $ rm sas;clang -o sas sas.c;./sas
> > >      [OK]    Initial sigaltstack state was SS_DISABLE
> > >      [FAIL]  SP is not on sigaltstack
> > >
> > >      $ rm sas;gcc -o sas sas.c;./sas
> > >      [OK]    Initial sigaltstack state was SS_DISABLE
> > >      [RUN]   signal USR1
> > >      [OK]    sigaltstack is disabled in sighandler
> > >      [RUN]   switched to user ctx
> > >      [RUN]   signal USR2
> > >      [OK]    Stack preserved
> > >      [OK]    sigaltstack is still SS_AUTODISARM after signal
> > >      [OK]    Test passed
> > >
> > > So, this test failure appears to have been there for a while. I think
> > > the LLVM folks need to take a look at it.
> > >
> > > Thanks,
> > > Chang
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-08 18:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07  6:57 selftests: sigaltstack: sas # exit=1 - # Bail out! SP is not on sigaltstack - on clang build Naresh Kamboju
2023-03-07 19:28 ` Chang S. Bae
2023-03-08  3:14   ` Naresh Kamboju
2023-03-08 16:22     ` Andy Lutomirski
2023-03-08 18:49       ` Nick Desaulniers

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).