diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-05-01 15:11:07 +0200 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-05-20 08:17:04 +0200 |
| commit | e05bd477e73b9a5d533c4865022602dc60cec1ab (patch) | |
| tree | 4aac5536b47b9a165ec4e988422964d01f22ad87 /irmd.conf.in | |
| parent | 81ea9a137b87fb8264d439a944cc077aced71602 (diff) | |
| download | ouroboros-e05bd477e73b9a5d533c4865022602dc60cec1ab.tar.gz ouroboros-e05bd477e73b9a5d533c4865022602dc60cec1ab.zip | |
lib: Drain rbuff before close
ssm_rbuff_close used to unmap the SHM page immediately, leaving any
in-flight peer-process thread that was inside pthread_mutex_lock or
pthread_cond_wait on the SHM-resident sync primitives reading freed
memory. Adds an n_users counter, bumped on entry and dropped on exit
of every function that touches the mutex / cond vars (write, write_b,
read, read_b, fini), and have ssm_rbuff_close poll-spin until the
counter drains before tearing down.
ssm_rbuff_read now re-checks IS_EMPTY after taking the mutex, plugging
a TOCTOU where two readers could both pass a lock-free fast path and
the loser would read a stale TAIL.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'irmd.conf.in')
0 files changed, 0 insertions, 0 deletions
