Page MenuHomeFreeBSD

buf_ring: Ensure correct ordering of loads
ClosedPublic

Authored by andrew on Jul 26 2024, 8:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 1, 1:47 PM
Unknown Object (File)
Mon, Sep 30, 12:43 AM
Unknown Object (File)
Thu, Sep 19, 10:59 AM
Unknown Object (File)
Thu, Sep 19, 10:41 AM
Unknown Object (File)
Mon, Sep 9, 1:45 AM
Unknown Object (File)
Sun, Sep 8, 6:34 PM
Unknown Object (File)
Sun, Sep 8, 1:22 PM
Unknown Object (File)
Aug 19 2024, 1:19 PM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 58850
Build 55737: arc lint + arc unit