https://gitlab.synchro.net/main/sbbs/-/commit/233f20f35c09bb106d715bc4
Modified Files:
src/ssh/TODO.md src/ssh/test/test_selftest.c
Log Message:
Fix selftest race: cleanup while server echo thread still sending
Two bugs caused segfaults in dssh_self_rsa under ctest -j16:
1. Server thread handle (thrd_t st) was a stack local lost when an
ASSERT failed mid-test, so dssh_test_after_each cleanup could not
join it -- the server thread kept running while the session was freed.
2. g_active_ctx pointed to a stack-local selftest_ctx whose frame was
popped on test return. Cleanup's deeper function calls (terminate,
join, session_cleanup) grew the stack into the old frame, corrupting
the ctx data and causing a NULL deref in dssh_session_stop.
Fix: add server_thread/server_thread_active fields to selftest_ctx;
add selftest_start_thread() helper; restructure selftest_cleanup() to
snapshot all ctx fields into a local copy before any function calls,
then terminate both sessions, join the server thread, and finally
cleanup sessions. All 27 test functions updated.
Also adds TODO items 104-105 for two distinct test failures observed
under -j16 that need separate investigation.
Co-Authored-By: Claude Opus 4.6 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)