pipewire/spa
Barnabás Pőcze 16f63a3c8f Revert "loop: remove destroy list"
This reverts commit c474846c42.
In addition, `s->loop` is also checked before dispatching a source.

The destroy list is needed in the presence of threads. The
issue is that a source may be destroyed between `epoll_wait()`
returning and thread loop lock being acquired. If this
source is active, then a use-after-free will be triggered
when the thread loop acquires the lock and starts dispatching
the sources.

  thread 1                       thread 2
 ----------                     ----------
                                loop_iterate
                                  spa_loop_control_hook_before
                                    // release lock

 pw_thread_loop_lock

                                  spa_system_pollfd_wait
                                    // assume it returns with source A

 pw_loop_destroy_source(..., A)
  // frees storage of A

 pw_thread_loop_unlock
                                  spa_loop_control_hook_after
                                    // acquire the lock

                                  for (...) {
                                    struct spa_source *s = ep[i].data;
                                    s->rmask = ep[i].events;
                                      // use-after-free if `s` refers to
                                      // the previously freed `A`

Fixes #2147
2022-02-18 20:31:14 +01:00
..
examples treewide: meson.build: use dependency variable for SPA 2021-12-28 18:34:06 +01:00
include spa: improve the AEC interface 2022-02-16 16:18:18 +01:00
plugins Revert "loop: remove destroy list" 2022-02-18 20:31:14 +01:00
tests Fix build on recent FreeBSD 13-STABLE 2022-01-26 14:37:19 +03:00
tools json: spa_json_get_string() writes up to len chars or fail 2022-01-04 10:42:32 +01:00
meson.build treewide: meson.build: use feature.allowed() 2022-02-04 00:15:59 +01:00