pipewire/spa/plugins
Arun Raghavan f11ab0da3e spa: loop: Mark cancellation fields as volatile
Cancellation handlers use setjmp/longjmp, for which the C99
specification has the following note:

> 17.3.2.1 (3)
> All accessible objects have values, and all other components of the
> abstract machine) have state, as of the time the longjmp function was
> called, except that the values of objects of automatic storage
> duration that are local to the function containing the invocation of
> the corresponding setjmp macro that do not have volatile-qualified
> type and have been changed between the setjmp invocation and longjmp
> call are indeterminate.

While everything works fine with GCC, with Clang we see that the
cancellation handler doesn't seem to have an effect (loop-test fails
when it notices that its spa_source's priv and mask have not been
cleaned up).

The underlying cause is that the compiler can assume data.ep_count is
only used in loop_iterate_cancel(), and so can be cached in a register.
When we access that field in the cancellation handler, it was never
actually written to the memory on the stack, so the read in
cancellation_handler() does not see the current value.

We fix this by marking all fields on the stack that we expect to be
modified in loop_iterate_cancel() as volatile, forcing the memory to be
updated and correctly available to the cancellation handler.
2026-03-12 09:24:53 +00:00
..
aec spa: aec: webrtc: Expose echo canceller mobile_mode 2025-07-09 13:02:18 -04:00
alsa spa/plugins: include <stdlib.h> for alloca() on non-linux 2026-03-12 09:21:40 +00:00
audioconvert audioconver: reformat the graph description for properties 2026-02-26 10:59:57 +01:00
audiomixer audiomixer: only add the input port to mix_list 2026-03-11 12:36:39 +01:00
audiotestsrc audiotestsrc: Operate as follower too 2025-12-16 13:15:00 +01:00
avb modules: support audio.layout where we can 2025-10-30 12:29:31 +01:00
bluez5 bluez5: cleanup get_codec_profile() 2026-03-09 21:35:22 +02:00
control control: unit test for event sort 2025-09-17 13:42:12 +02:00
ffmpeg spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
filter-graph filter-graph: emit control change after loading 2026-03-11 12:39:46 +01:00
jack *: don't include standard C headers inside of extern "C" 2025-05-30 09:48:28 +01:00
libcamera spa: libcamera: source: SPA_PARAM_Props is write-only 2026-03-09 21:19:38 +00:00
support spa: loop: Mark cancellation fields as volatile 2026-03-12 09:24:53 +00:00
test spa: make the wave, pattern and ditherType Int 2025-06-13 10:06:09 +02:00
v4l2 v4l2: use 0x as the prefix for hex values 2026-03-09 13:50:38 +01:00
videoconvert spa: add Capability and PeerCapability 2025-11-21 10:08:46 +01:00
videotestsrc loop: spa_loop_invoke -> spa_loop_locked where possible 2025-05-30 11:59:35 +02:00
volume treewide: access the position information using helpers 2025-10-21 13:06:25 +02:00
vulkan spa/plugins: include <stdlib.h> for alloca() on non-linux 2026-03-12 09:21:40 +00:00
meson.build spa/plugins: revert "Disable alsa plugin on !Linux platforms." 2026-03-12 09:20:05 +00:00