Home | History | Annotate | Download | only in gen
History log of /src/tests/lib/libc/gen/t_siginfo.c
RevisionDateAuthorComments
 1.55  04-Sep-2024  rin t_siginfo:adraln: Brush up skip message for x86

Note that:

1. No data address is reported back for alignment check exception, as per
Intel SDM (June 2024).

2. Kernel sets faulting PC to si_addr.

3. 2. is compliant to siginfo(2), at least:

> For SIGILL, SIGFPE, SIGBUS and SIGSEGV ... si_addr contains
> the address of the faulting instruction or data and ...

4. IEEE Std 1003.1-2024 does not require si_addr for SIGBUS. For SIGILL
and SIGSEGV, e.g., it is required (SHALL) to store faulting PC and
data address, respectively, on the other hand.
 1.54  04-Sep-2024  rin t_siginfo:sigbus_adraln: Skip rather than expect_fail on x86

This is an architecture-defined behavior, not a failure.
 1.53  29-Jun-2024  rin branches: 1.53.2;
t_siginfo: sigbus_adraln: Skip for vax

According to "VAX Architecture Handbook", misaligned access does
not trap, although it has performance penalty.
 1.52  20-May-2024  riastradh t_siginfo: More volatile to prevent optimization.
 1.51  14-May-2024  riastradh t_siginfo: Use volatile to prevent optimization.
 1.50  14-May-2024  riastradh t_siginfo: No SIGFPE on RISC-V.
 1.49  04-Aug-2023  rin t_siginfo:sigfpe_int: Adjust for GCC12

Do not use constant 1 as numerator to raise integer division by zero.
GCC >= 12 optimizes (1 / i) into (abs(i) == 1 ? i : 0), even for -O0.
 1.48  07-May-2023  skrll RISC-V support that works on QEMU with a single hart.

Thanks for Simon Burge for plic(4).
 1.47  07-May-2022  rin branches: 1.47.2;
Skip sigfpe_int also for sh3; integer division by zero is not trapped.
 1.46  10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.45  13-Jan-2021  skrll skip sigbus_adraln on MIPS
 1.44  11-Jan-2021  skrll PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"

It's GXemul that has the bug! Unfortunately, there's no way (currently) to
detect if we're running under GXemul emulation, so disable for all mips
for now. Hopefully, GXemul will get fixed soon.
 1.43  10-Jan-2021  skrll PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"

disable the sigbus_adraln test on qemu for now
 1.42  13-Oct-2020  rin For aarch64eb, no SIGBUS signal for unaligned accesses.
Convert to preprocessor directives.
 1.41  24-Aug-2020  gson Expect a failure to trap unaligned acesses only when running under
qemu's TCG CPU emulation, not when running under hardware virtualization
such as qemu -accel nvmm.
 1.40  20-Jun-2020  rin Skip sigbus_adraln for powerpc.

SIGBUS for unaligned accesses is not mandatory for powerpc;
most processors (not all, e.g., 403) can deal with that.
 1.39  22-Feb-2020  kamil Disable the t_siginfo test under MKSANITIZER / MKLIBCSANITIZER

Signal crash events are incompatible with sanitizers.
 1.38  21-Feb-2020  kamil Mark division by 0 as expected in sigfpe_int

Disable ubsan instrumentation on the operation.
 1.37  11-Feb-2020  riastradh aarch64 doesn't trap integer division by zero either.
 1.36  25-Apr-2019  kamil Fix typo in 'exceptions'
 1.35  30-Jan-2019  martin Clean up terminology: modern arm CPUs do properly implement IEEE 754
floating point exceptions - but some (actually all currently know ones)
do not implement sending traps when these exceptions are raised.

Pointed out by Peter Maydell.
 1.34  26-Jan-2019  martin aarch64 does not trap on unaligned acces
 1.33  23-Jan-2019  martin There are aarch64 Cortex cpus that do not trap on some floating point
exceptions - so apply the arm handling for aarch64 as well.
 1.32  17-Jan-2018  maya branches: 1.32.2; 1.32.4;
Improve portability of headers and sort them.

From Ngie Cooper in PR bin/51833
 1.31  05-Mar-2017  chs reenable sigfpe_flt on powerpc now that FPU exceptions work.
 1.30  22-Dec-2015  christos branches: 1.30.2; 1.30.4;
Add __TEST_FENV
 1.29  17-Feb-2015  isaki m68k (except sun2) never issue SIGBUS on unaligned accesses.
PR lib/49653. Thanks martin@.
 1.28  13-Feb-2015  martin Fix strange editor mishap and start block comment on its own line.
 1.27  29-Dec-2014  martin Include <ieeefp.h> even for the <fenv.h> case since we use fpsetmask()
to detect ARM Cortex NEON fpus.
 1.26  19-Nov-2014  martin Skip the SIGFPE test on arm when the FPU does not provide exception handling.
 1.25  19-Nov-2014  martin Use machdep.unaligned_sigbus to skip the unaligned access test on arm
as well.
 1.24  04-Nov-2014  justin PR misc/49356 remove unnecessary references to atf-c/config.h

The function included via this header is not used and is removed in
later versions of atf, so let us avoid it.
 1.23  09-Feb-2014  jmmv Use compiler builtins instead of atf_arch and atf_machine.

The atf_arch and atf_machine configuration variables were removed from
atf-0.19 without me realizing that some tests were querying them directly.

Instead of reintroducing those variables, just rely on compiler builtins
as many other tests already do.

Should fix PR bin/48582.
 1.22  26-Jan-2014  matt Support using fenv instead of fpsetmask if HAVE_FENV is defined.
 1.21  25-Jan-2014  skrll Use English spelling of alignment.
 1.20  12-Apr-2013  christos use one qemu test
 1.19  12-Apr-2013  christos easier way to find if we are on qemu.
 1.18  13-Jun-2012  njoly branches: 1.18.2;
Skip sigbus_adraln testcase on alpha unless global
machdep.unaligned_sigbus sysctl is enabled.
 1.17  23-Apr-2012  martin Revert previous, si_addr is expected to be the faulting *data* address
(mmm, consistent standards).
Add a few tweaks to prevent the compiler's optimizer outsmarting the test.
 1.16  22-Apr-2012  martin Do not compare si_addr (address of faulting instruction) against the
unaligned data address causing the fault - this will always fail.
If anybody knows a portable way to get the data address involved in the
fault, please fix the test case as originally intended.
 1.15  20-Apr-2012  jym ATF test for SIGBUS => BUS_ADRALN (invalid address alignment).

That one is tedious to test under x86: alignment exceptions are
not reported by this architecture unless you ask for them explicitely (by
setting the PSL_AC bit). The brokenness does not end there: %cr2 should
contain the address where the unaligned access occured, alas, it does not.

I am not aware of other architectures where this could happen. Still, my
knowledge is limited; if there is one, feel free to send me a mail and I
will update the test accordingly.

Adding insult to injury, this test can fail in various funny ways with VMs:
- under x86 QEMU, no trap() happens. As ring 3 code stays almost untouched by
QEMU VMM, I suppose the exception can only be triggered when the host
itself is capable of catching unaligned accesses.
- under Virtual Box with HVM support, i386 works fine, but amd64 fails with a
SIGILL (Illegal instruction) that happens right before entering the
signal handler. No idea why, and trying to debug it with gdb freezes the VM
(including ddb breaks).

Anyway, tested with:
- i386: P4 host, anita, Virtual Box HVM (Mac OS X)
- amd64: anita, Virtual Box HVM (Mac OS X)

XXX I would appreciate if someone could test it under a real amd64 host with
an up-to-date kernel, so I can reasonably assume that the culprit is
Virtual Box and not our amd64 port (my test machine being off line
I cannot do it myself). Results from other arches would be a plus too.

Initial issue reported by Nicolas Joly on port-amd64. Thanks!
 1.14  18-Mar-2012  jruoho To be on the safe side, use the category/number notation when referring to
PRs (otherwise third-party sed-scripts might miss the references). Also
remove white-space.
 1.13  17-Mar-2012  christos annotate the PR that failed, and has been fixed.
 1.12  01-Oct-2011  christos branches: 1.12.2;
use _FLOAT_IEEE754 instead of vax.
 1.11  24-May-2011  joerg Use volatile for explicit 0 dereference
 1.10  02-Mar-2011  riz Skip the sigfpe_flt and sigfpe_int tests on powerpc; powerpc does
not fault on divide-by-zero. As discussed on tech-userlevel.
 1.9  01-Mar-2011  pooka Attempt further qemu heuristics to avoid failures due to non-working FPU
 1.8  03-Jan-2011  pgoyette branches: 1.8.2;
Don't run FP Exception tests under qemu - they don't work.

While here, properly skip certain tests on vax architecture. (It is
not legal to have a test-program with zero test cases, so each test
case needs to check-and-skip.)
 1.7  02-Jan-2011  pgoyette If we survive the check for wrong signal code, reset our expectation to
"pass" before checking the signal errno.
 1.6  02-Jan-2011  pgoyette Fix $NetBSD$ keyword
 1.5  31-Dec-2010  mlelstv return from an SIGFPE handler is not defined when the hardware
caused the exception. Use sigsetjmp/siglongjmp to resume the
test function instead.
 1.4  27-Dec-2010  njoly Do use integer arithmetics to generate FPE_INTDIV in sigfpe_int testcase.

Ok pgoyette.
 1.3  26-Dec-2010  pgoyette Re-enable printing of MD data, with appropriate casts.
 1.2  26-Dec-2010  pgoyette For now, don't try to print out machine-dependant stuff. When I figure
out what the right format strings are, I'll re-enable it.
 1.1  25-Dec-2010  pgoyette Move the siginfo tests from regress to atf. While here, add a new test
for PR/43655.

XXX The sigchild_dump test currently fails when execute under atf-run.
XXX It does not fail when executed directly from the shell, so there's
XXX something in atf that prevents the child process from dumping.
 1.8.2.1  05-Mar-2011  bouyer Sync with HEAD
 1.12.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.2.3  30-Oct-2012  yamt sync with head
 1.12.2.2  23-May-2012  yamt sync with head.
 1.12.2.1  17-Apr-2012  yamt sync with head
 1.18.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.2.1  23-Jun-2013  tls resync from head
 1.30.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.30.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.32.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.32.4.1  10-Jun-2019  christos Sync with HEAD
 1.32.2.1  26-Jan-2019  pgoyette Sync with HEAD
 1.47.2.1  13-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #856):

tests/lib/libc/gen/t_siginfo.c: revision 1.54
tests/lib/libc/gen/t_siginfo.c: revision 1.55

t_siginfo:sigbus_adraln: Skip rather than expect_fail on x86

This is an architecture-defined behavior, not a failure.
t_siginfo:adraln: Brush up skip message for x86

Note that:
1. No data address is reported back for alignment check exception, as per
Intel SDM (June 2024).
2. Kernel sets faulting PC to si_addr.
3. 2. is compliant to siginfo(2), at least:
For SIGILL, SIGFPE, SIGBUS and SIGSEGV ... si_addr contains
the address of the faulting instruction or data and ...
4. IEEE Std 1003.1-2024 does not require si_addr for SIGBUS. For SIGILL
and SIGSEGV, e.g., it is required (SHALL) to store faulting PC and
data address, respectively, on the other hand.
 1.53.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed