pipewire/spa/plugins/support
Wim Taymans f93b3b23a3 loop: fix use after free case
Because we can now destroy sources (and free the source structure) by
simply holding the lock, there is a window where we might access the
freed source.

When we in iterate release the lock and go into the epoll, another
thread might acquire the lock and delete the fd from epoll. This might
happen right after epoll detected activity on the fd. When iterate
manages to acquire the lock again, it will process to dispatch the
active fd and deref the ep.data pointer, which is now pointing to freed
memory.

Fix this by incrementing a removed_count whenever we remove a source.
Check the counter if it was the same as before the epoll otherwise we
can't assume all sources are alive still. Return in that case as if
there were no fds to poll. The caller should reenter the iterate at some
point and we will return all the fds with activity, minus the one that
got destroyed. We need to give control to the caller because part of the
removal could be to stop the loop iteration all together.
2025-06-30 12:44:15 +02:00
..
cpu-arm.c treewide: use SPDX tags to specify copyright information 2023-02-16 10:54:48 +00:00
cpu-riscv.c spa/support: implement RISCV V CPU detection 2024-09-18 10:40:48 +00:00
cpu-x86.c treewide: use SPDX tags to specify copyright information 2023-02-16 10:54:48 +00:00
cpu.c spa: support: use feature macro from config.h 2024-09-18 22:29:11 +02:00
dbus.c spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
evl-plugin.c spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
evl-system.c spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
journal.c journal: prepend code location to messages at debug log levels 2024-04-28 16:02:28 +03:00
logger.c logger: support logging local timestamps and other timestamp logs 2025-01-13 13:48:22 +00:00
loop.c loop: fix use after free case 2025-06-30 12:44:15 +02:00
meson.build meson: Search for and link to stdthreads 2024-09-23 08:09:45 +00:00
node-driver.c spa: some more invoke -> locked calls 2025-05-29 10:17:16 +02:00
null-audio-sink.c spa: some more invoke -> locked calls 2025-05-29 10:17:16 +02:00
plugin.c spa: export log topic enumerations 2024-01-04 10:02:55 +00:00
system.c pipewire-alsa: Propagate errors from eventfd(). 2024-02-19 14:16:26 +00:00