]> git.ipfire.org Git - thirdparty/systemd.git/commit
tests: ASSERT_SIGNAL: Ensure sanitisers do not mask expected signals
authorChris Down <chris@chrisdown.name>
Wed, 19 Nov 2025 13:45:40 +0000 (21:45 +0800)
committerChris Down <chris@chrisdown.name>
Wed, 19 Nov 2025 18:40:07 +0000 (02:40 +0800)
commitd759ed527c7c75cffcc9b72dd7b3fcf0854bec2f
tree63b1ca7bf87c622155872043831d15363f650904
parent39adecfcd84250f7e382c220ec7bcb2b0faa5193
tests: ASSERT_SIGNAL: Ensure sanitisers do not mask expected signals

ASAN installs signal handlers to catch crashes like SIGSEGV or SIGILL.
When these signals are raised, ASAN traps them, prints an error report,
and then typically terminates the process with a different signal (often
SIGABRT) or a non-zero exit code.

This interferes with ASSERT_SIGNAL when checking for specific crash
signals (for example, checking that a function raises SIGSEGV). In such
a case, the test harness sees the ASAN termination signal rather than
the expected signal, causing the test to fail.

Fix this by resetting the signal handler to SIG_DFL in the child process
immediately before executing the test expression. This ensures the
kernel kills the process directly with the expected signal, bypassing
ASAN's interceptors.
src/shared/tests.h