Page MenuHomeFreeBSD

buf_ring: Ensure correct ordering of loads
ClosedPublic

Authored by andrew on Jul 26 2024, 8:56 AM.
Tags
None
Referenced Files
F102141906: D46155.id141424.diff
Fri, Nov 8, 3:32 AM
Unknown Object (File)
Tue, Nov 5, 3:43 PM
Unknown Object (File)
Thu, Oct 24, 12:02 AM
Unknown Object (File)
Wed, Oct 23, 3:59 AM
Unknown Object (File)
Tue, Oct 22, 9:27 AM
Unknown Object (File)
Mon, Oct 21, 7:52 PM
Unknown Object (File)
Oct 6 2024, 9:28 PM
Unknown Object (File)
Oct 5 2024, 8:45 AM
Subscribers

Details

Summary

When enqueueing on an architecture with a weak memory model ensure
loading br->br_prod_head and br->br_cons_tail are ordered correctly.

If br_cons_tail is loaded first then other threads may perform a
dequeue and enqueue before br_prod_head is loaded. This will mean the
tail is one less than it should be and the code under the
prod_next == cons_tail check could incorrectly be skipped.

buf_ring_dequeue_mc has the same issue with br->br_prod_tail and
br->br_cons_head so needs the same fix.

Reported by: Ali Saidi <alisaidi@amazon.com>
Co-developed by: Ali Saidi <alisaidi@amazon.com>
Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable