History log of /src/tests/lib/libc/setjmp/
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base perseant-exfatfs-base-20240630 perseant-exfatfs-base
1.3 19-Feb-2024 riastradh

longjmp(3): Add test for PR lib/57946.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
1.2 21-Apr-2011 martin

branches: 1.2.46; 1.2.54;
Add a variation of the setjmp tests that link to libpthread and verify
pthread_self() stays consistent.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
1.1 27-Dec-2010 pgoyette

Move the various setjmp tests from regress to atf


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.13 28-Apr-2025 martin

PR 59370: compat 1.3 setjmp has been fixed


1.12 28-Apr-2025 riastradh

tests/lib/libc/setjmp: Mark compat 1.3 setjmp busted on sparc64.

PR port-sparc64/59370: compat 1.3 setjmp is busted


1.11 25-Apr-2025 riastradh

t_setjmp, t_sigstack: Mark compat13 setjmp tests xfail on arm.

(Does it even make sense to have compat_setjmp on arm? Didn't we
break ABI compatibility with the oabi->eabi transition, long after
1.3?)

PR port-arm/59351: compat_setjmp is busted


1.10 24-Apr-2025 riastradh

mips/compat_longjmp: Make sure compat13 setjmp returns nonzero.

PR port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1


1.9 24-Apr-2025 riastradh

mips/compat_sigsetjmp: Add missing RESTORE_GP64.

Otherwise, compat13 sigsetjmp clobbers the caller's gp when it
returns (the first time around, anyway), which leads to a lovely
display of fireworks.

PR port-mips/59343: compat_sigsetjmp.S: missing RESTORE_GP64


1.8 24-Apr-2025 riastradh

mips/compat_setjmp: .set reorder doesn't have delay slots.

PR port-mips/59342: compat_setjmp.S is confused about delay slots


1.7 24-Apr-2025 riastradh

t_setjmp, t_sigstack: Test compat13 setjmp/sigsetjmp too.

PR port-mips/59342: compat_setjmp.S is confused about delay slots
PR port-mips/59343: compat_sigsetjmp.S: missing RESTORE_GP64


1.6 24-Apr-2025 riastradh

t_setjmp: Tidy up.

- KNF.
- Nix trailing whitespace.
- Use RL from h_macros.h.
- Use enum and case.

No functional change intended.

Preparation for extending these tests to the compat13 functions,
prompted by:

PR port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1
PR port-mips/59342: compat_setjmp.S is confused about delay slots
PR port-mips/59343: compat_sigsetjmp.S: missing RESTORE_GP64


1.5 22-Apr-2025 riastradh

mips: Fix _longjmp(..., 0) so _setjmp returns 1 as intended.

_setjmp (like setjmp and sigsetjmp) is only permitted to return 0 the
first time around.

PR port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1


1.4 22-Apr-2025 riastradh

t_setjmp: Mark _longjmp_zero xfail on mips.

PR port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
1.3 21-Mar-2021 christos

branches: 1.3.8;
PR/56066: Jessica Clarke: Add tests for calling {_,}longjmp with a zero value.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
1.2 14-Jan-2017 christos

PR/51874: Ngie Cooper: Add __unused to signal handlers


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
1.1 27-Dec-2010 pgoyette

branches: 1.1.28;
Move the various setjmp tests from regress to atf


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.25 12-May-2025 christos

fix the clang build.


1.24 28-Apr-2025 martin

PR 59370: compat 1.3 setjmp has been fixed


1.23 28-Apr-2025 riastradh

tests/lib/libc/setjmp: Mark compat 1.3 setjmp busted on sparc64.

PR port-sparc64/59370: compat 1.3 setjmp is busted


1.22 28-Apr-2025 riastradh

t_sigstack: Don't do atf_tc_expect_fail then atf_tc_expect_signal.

atf interprets this sequence, with no intervening atf_tc_fail, to
mean the xfail failed to fail so it fails. (Got that?) That is, it
is interpreted somewhat like

atf_tc_expect_fail(...);
... there is supposed to be a failure here ...
atf_tc_expect_pass();
... remaining checks are expected to pass ...

where a lack of failures between the xfail and the xpass means the
expectation was not met.

But in this case, there are two compounding bugs:

1. the compat 1.3 setjmp has botched its registers, as uwe@
discovered, so it is expected to crash on SIGSEGV (PR 59351); and

2. the compat 1.3 longjmp restores the stack poiter and signal mask
in the wrong order, so it is expected to fail the test (PR 57946).

Since the crash in setjmp triggers before the failure after longjmp,
only do atf_tc_expect_signal; once that is fixed we can re-enable the
atf_tc_expect_fail for longjmp.

PR lib/57946: longjmp fails to restore stack first before restoring
signal mask on most architectures

PR port-arm/59351: compat_setjmp is busted


1.21 25-Apr-2025 riastradh

t_setjmp, t_sigstack: Mark compat13 setjmp tests xfail on arm.

(Does it even make sense to have compat_setjmp on arm? Didn't we
break ABI compatibility with the oabi->eabi transition, long after
1.3?)

PR port-arm/59351: compat_setjmp is busted


1.20 24-Apr-2025 riastradh

tests/lib/libc/setjmp/t_sigstack: Update xfails.

Designations based on actual test run for i386 and code inspection
for arm and sh3 (and code inspection for all the other architectures
not listed because I expect the tests to pass on them -- they mostly
use sigreturn which will DTRT).

Move the ia64 xfail to just setjmp/sigsetjmp -- no compat13 on ia64.

Nix the long comment now that just about everything has been fixed.

PR lib/57946: longjmp fails to restore stack first before restoring
signal mask on most architectures


1.19 24-Apr-2025 riastradh

sparc, sparc64 longjmp: Use _UC_SIGMASK to restore signal mask.

This way, restoring the signal mask and restoring the stack pointer
happen atomically with respect to signal handler calls, whereas using
sigprocmask would restore the signal mask _before_ the stack pointer,
breaking sigaltstack.

The motivation for using sigprocmask first and then setcontext later,
rather than _UC_SIGMASK in setcontext, was to get SA-based libpthead
sigprocmask interposition. But that's long gone and unlikely to come
back.

PR lib/57946: longjmp fails to restore stack first before restoring
signal mask on most architectures


1.18 24-Apr-2025 riastradh

mips longjmp: Use _UC_SIGMASK to restore signal mask.

This way, restoring the signal mask and restoring the stack pointer
happen atomically with respect to signal handler calls, whereas using
sigprocmask would restore the signal mask _before_ the stack pointer,
breaking sigaltstack.

The motivation for using sigprocmask first and then setcontext later,
rather than _UC_SIGMASK in setcontext, was to get SA-based libpthead
sigprocmask interposition. But that's long gone and unlikely to come
back.

PR lib/57946: longjmp fails to restore stack first before restoring
signal mask on most architectures


1.17 24-Apr-2025 riastradh

mips/compat_longjmp: Make sure compat13 setjmp returns nonzero.

PR port-mips/59285: _longjmp(..., 0) makes setjmp return 0, not 1


1.16 24-Apr-2025 riastradh

mips/compat_sigsetjmp: Add missing RESTORE_GP64.

Otherwise, compat13 sigsetjmp clobbers the caller's gp when it
returns (the first time around, anyway), which leads to a lovely
display of fireworks.

PR port-mips/59343: compat_sigsetjmp.S: missing RESTORE_GP64


1.15 24-Apr-2025 riastradh

mips/compat_setjmp: .set reorder doesn't have delay slots.

PR port-mips/59342: compat_setjmp.S is confused about delay slots


1.14 24-Apr-2025 riastradh

t_setjmp, t_sigstack: Test compat13 setjmp/sigsetjmp too.

PR port-mips/59342: compat_setjmp.S is confused about delay slots
PR port-mips/59343: compat_sigsetjmp.S: missing RESTORE_GP64


1.13 13-Apr-2025 riastradh

hppa longjmp: Use _UC_SIGMASK to restore signal mask.

This way, restoring the signal mask and restoring the stack pointer
happen atomically with respect to signal handler calls, whereas using
sigprocmask would restore the signal mask _before_ the stack pointer,
breaking sigaltstack.

The motivation for using sigprocmask first and then setcontext later,
rather than _UC_SIGMASK in setcontext, was to get SA-based libpthead
sigprocmask interposition. But that's long gone and unlikely to come
back.

Tested under qemu with:

atf-run /usr/tests/lib/libc/setjmp | atf-report
atf-run /usr/tests/lib/libpthread/t_siglongjmp | atf-report

PR lib/57946: longjmp fails to restore stack first before restoring
signal mask on most architectures


1.12 17-Jul-2024 uwe

branches: 1.12.2; 1.12.4;
sh3: siglongjmp - restore register context first (PR lib/57946)


Revision tags: perseant-exfatfs-base-20240630 perseant-exfatfs-base
1.11 06-May-2024 riastradh

branches: 1.11.2;
tests/lib/libc/setjmp/t_sigstack: Add missing comment for 1.10.

PR lib/57946


1.10 06-May-2024 skrll

arm has been fixed


1.9 04-Apr-2024 riastradh

i386 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp

PR lib/57946


1.8 04-Apr-2024 riastradh

amd64 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp

PR lib/57946


1.7 19-Feb-2024 riastradh

longjmp(3) t_sigstack: Fix fencepost error.

Extremely unlikely to cause trouble, but let's just turn that into
`never' to keep it easier for readers.

PR lib/57946


1.6 19-Feb-2024 riastradh

longjmp(3) t_sigstack: Use a sigaltstack per handler entry.

longjmp evidently doesn't reset the state of whether the process is
executing on the alternate signal stack. So when we re-enter the
signal handler, the alternate stack appears to be still in use, and
the system chooses the original stack for the second call to the
signal handler -- which trips our assertion asking to verify that the
signal handler is always using an alternate stack.

Not strictly necessary for the signal handler to use an alternate
stack on re-entry, but this makes it clearer that the signal handler
itself is always using the alternate stack so we can verify that the
interrupted code is _not_ in the signal handler.

With this change, the test now passes on aarch64.

PR lib/57946


1.5 19-Feb-2024 riastradh

longjmp(3) t_sigstack: Note aarch64 seems to DTRT.

But only by code inspection; it appears to have another problem: on
re-entry, the signal handler is called on the normal stack, not on
the alternate signal stack.

PR lib/57946


1.4 19-Feb-2024 riastradh

longjmp(3) t_sigstack: Print which entry failed.

PR lib/57946


1.3 19-Feb-2024 riastradh

longjmp(3): Test signal mask vs stack restore with siglongjmp too.

PR lib/57946


1.2 19-Feb-2024 riastradh

longjmp(3): Paranoia: more error checking in PR lib/57946 test.


1.1 19-Feb-2024 riastradh

longjmp(3): Add test for PR lib/57946.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
1.2 14-Jan-2017 christos

PR/51874: Ngie Cooper: Add __unused to signal handlers


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
1.1 21-Apr-2011 martin

branches: 1.1.26;
Add a variation of the setjmp tests that link to libpthread and verify
pthread_self() stays consistent.