https://gitlab.synchro.net/main/sbbs/-/commit/147332188dc74f55116a86d7
Modified Files:
src/ssh/TODO.md deucessh-algorithms.h deucessh.h ssh-trans.c ssh-trans.h ssh.c src/ssh/test/CMakeLists.txt test_alloc.c test_selftest.c test_transport.c
Log Message:
Fix 5 data races: atomic rekey counters, atomic algo pointers, set_ctx gate (items 32, 53, 57, 60, 61)
Item 53: split bytes_since_rekey into tx/rx halves; make tx counters
atomic (atomic_uint_fast32_t / atomic_uint_fast64_t) so rekey_needed()
reads them lock-free from the recv thread without acquiring tx_mtx
(which send_packet holds across I/O). rx counters remain non-atomic
under rx_mtx.
Item 57: make all 10 *_selected pointer fields _Atomic in dssh_transport_state_s so algorithm query functions perform implicit
atomic loads, eliminating UB during rekey.
Item 60: dssh_key_algo_set_ctx() now refuses with DSSH_ERROR_TOOLATE
after first dssh_session_init() (same gconf.used gate as registration).
Items 61, 32: documented dssh_dh_gex_set_provider() and callback
setters as must-call-before-start with thrd_create happens-before
guarantee explanation.
Co-Authored-By: Claude Opus 4.6 (1M context) <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net