Repository navigation
test: the fixtures that crash on purpose leave no core dump on Linux - #2293
Conversation
Three fixtures end by a signal on purpose in every run of tests/run_all.py: the driver-fault guard's "fault-outside" case (SIGSEGV, tests/test_linux_driver_fault_guard.py) and two of tests/test_recorder_sync.py's broken recorders (the ring overwritten without backpressure, SIGSEGV; the recorder thread not joined at teardown, SIGABRT). Where the kernel hands crashes to a core-dump handler such as systemd-coredump, each one was stored as a crash report and, on a desktop with a crash notifier, announced as a crashed program: three per run of the checks. Both fixtures now call prctl(PR_SET_DUMPABLE, 0) first (Linux only), beside the recorder fixture's existing SetErrorMode line, which keeps Windows from showing a dialog for the same crashes. The kernel then makes no core dump for the fixture and starts no handler; the process still ends by its signal, so the checks see what they saw before. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased onto main |
6b32a55 to
63aac31
Compare
Joey-Magnus
left a comment
There was a problem hiding this comment.
Looks good. prctl(PR_SET_DUMPABLE, 0) at the top of main is the right place for this: as the description says, execve resets the flag, so the parent can't set it, and RLIMIT_CORE doesn't help with a piped core_pattern. Both changes are behind #ifdef __linux__, so Windows is untouched, and the fixtures still end by their signal. I ran tests/test_linux_driver_fault_guard.py and tests/test_recorder_sync.py at this head on Linux and both pass. I also checked that neither fixture reads /proc/self or uses ptrace, which a non-dumpable process would lose access to. No other test in tests/ or nx2/ expects a signal exit, so these really are the only crashing fixtures.
The red CI checks don't come from this PR. On Windows the failure is tests/test_native_astc_texture_count.py (scanf deprecated under -Werror), which main fixed in #2397. The appimage job hit Launchpad connection timeouts. A rebase onto current main should clear the Windows one.
|
Thanks for checking both fixtures and the Linux-only guard. This is now merged as |
Every run of
tests/run_all.pyon a Linux desktop leaves three core dumps, and with a crash notifier three "a programcrashed" messages: three fixtures crash on purpose, and the kernel hands each crash to the core-dump handler
(systemd-coredump here).
Part of #2334.
tests/test_linux_driver_fault_guard.py'sguardfault-outside(a fault outside the guarded call must still kill the process)tests/test_recorder_sync.py'srecorder_sync_testOn one machine that ran the checks many times in one night, that made 107 crash notifications.
What changed
prctl(PR_SET_DUMPABLE, 0)at the start ofmain, on Linux only (#ifdef __linux__). Thekernel then makes no core dump for the process and starts no handler, whatever
ulimit -candcore_patternsay;the process still ends by its signal, so the checks see exactly what they saw before.
tests/recorder_sync_test.cppit sits beside the existingSetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS), which does the same job on Windows (no crash dialog).core_patternthe kernel does notapply
RLIMIT_CORE(core(5)), except the special value 1, so a limit of 0 still starts the handler; and the dumpableflag cannot be set from the parent, since
execveresets it.Tests only; nothing in the game or the builder changes.
How it was tested
Arch Linux,
ulimit -cunlimited,core_pattern=|/usr/lib/systemd/systemd-coredump ...; both tests run directly(not through
run_all.py),coredumpctl listbefore and after:guard(SIGSEGV), onebroken12/recorder_sync_test.exe(SIGSEGV) and one
broken13/recorder_sync_test.exe(SIGABRT) core dump per run of the checks (40, 32 and 32 overtwo days).
tests/test_linux_driver_fault_guard.pywith Clang 23.1.3 and GCC 16.2.1, andtests/test_recorder_sync.py(the two variants still end with exit codes -11 and -6, and are caught):
coredumpctl listshows no new entry. Thekernel still logs its usual
segfault at ...line for each fault.tests/test_recorder_sync.py(49f75dc), run with core dumps blocked from outside(a core-size limit of 1), prints the same 22 broken-variant lines, exit codes included, and the same PASS line as this
branch's run (the two outputs compared with
diff); main's guard test passes the same way.python -I -B tests/run_all.pyon main 49f75dc with this change (2026-11-11, load about 70 to 135): 362 passed, 2failed, 10 skipped; both changed tests pass. The two failures are this machine's and fail on main as well, each with a
pull request of its own:
tests/test_wayland_libdecor_hint.py(Clang 23, test: the Wayland libdecor fixture builds with Clang 23 (-Wunused-but-set-global) #2290) andtests/test_updater_asset_digest.py(only a .NET 10 SDK here).Not tested
is expected; not tried.
Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com