tests: Skip SIGBUS test on FreeBSD

Currently, 'softsig-helper -buserror' causes a SIGBUS on most
platforms, but can result in SIGSEGV on FreeBSD by default (at least
on 11.3-RELEASE). Skip the test on FreeBSD, until we can provide a
more reliable way to generate SIGBUS.

Note that when the sysctl machdep.prot_fault_translation is set to 1,
'softsig-helper -buserror' generates a SIGBUS instead of SIGSEGV,
suggesting that generating a SIGBUS here is the old 'compat' behavior.
When machdep.prot_fault_translation is 0 (the default), the code path
in the FreeBSD kernel that dictates whether to send a SIGBUS or
SIGSEGV in this situation depends on some autodetection heuristics,
and so may produce different results depending on FreeBSD releases or
even compiler settings (due to detection of ABI based on some ELF
notes in the relevant binary).

For some details on this sysctl, see
<https://www.freebsd.org/news/status/report-2019-07-2019-09.html#Signals-delivered-on-unhandled-Page-Faults>
or the FreeBSD source code. In 11.3-RELEASE, the decision to issue a
SIGBUS or SIGSEGV can be found around sys/amd64/amd64/trap.c:355.

Change-Id: Ib75b43cc12302532ee87a3744fc364424f2a3ca6
Reviewed-on: https://gerrit.openafs.org/14145
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2020-04-12 22:28:29 -05:00 committed by Benjamin Kaduk
parent 61993cf45a
commit df5480057c

View File

@ -98,6 +98,7 @@ is($? & 0x7f, SIGSEGV, "Helper exited on SEGV signal.");
SKIP: {
my $sigbus = eval "SIGBUS";
skip("Skipping buserror test; SIGBUS constant is not defined.", 1) unless $sigbus;
skip("Skipping buserror test; test unreliable on FreeBSD.", 1) if ($^O eq 'freebsd');
my ($fh, $path) = mkstemp("/tmp/softsig-t_XXXXXX");
$pid = open(HELPER, "-|", $softsig_helper, "-buserror", $path)