eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
449 stars 22 forks source link

Insufficient memory reordering protection in `spsc::Queue::push` and `spsc::Queue::pop` #119

Closed elBoberido closed 4 months ago

elBoberido commented 4 months ago

Required information

Operating system: all

Rust version: all

Cargo version: all

iceoryx2 version: main branch

Observed result or behaviour:

The data access is not sufficiently protected against a reordering with read_position. While there is a AqcRel fence, the fence has no counterpart to synchronize with. This can be fixed by replacing the fence with a store on read_position with Ordering::Release in pop and a load with Ordering::Acquire in push.

Expected result or behaviour:

The data array is protected against reordering.

Conditions where it occurred / Performed steps:

It can happen whenever the CPU reorders the instructions.