pod: fix some data races in body code

The body code didn't use atomic loads, so it had undefined behavior if
the body was concurrently modified.  Use atomic loads to fix this.
Since the memory order is __ATOMIC_RELAXED this has no runtime overhead.
Also add barriers around a strncpy call and cast to volatile before
checking for a NUL terminator, though NUL-terminated strings in shared
memory are unuseable.  There are some places where bytewise atomic
memcpy(), which doesn't currently exist, is needed.  Instead, try to
fake it by using two barriers around memcpy().
This commit is contained in:
Demi Marie Obenour 2025-08-02 22:24:16 -04:00
parent c9c7552fed
commit bac3d31283
3 changed files with 45 additions and 17 deletions

View file

@ -4,7 +4,7 @@ project('pipewire', ['c' ],
meson_version : '>= 0.61.1',
default_options : [ 'warning_level=3',
'c_std=gnu11',
'cpp_std=c++17',
'cpp_std=c++20',
'b_pie=true',
#'b_sanitize=address,undefined',
'buildtype=debugoptimized' ])