Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F97502402
D19932.id56270.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
889 B
Referenced Files
None
Subscribers
None
D19932.id56270.diff
View Options
Index: sys/sys/buf_ring.h
===================================================================
--- sys/sys/buf_ring.h
+++ sys/sys/buf_ring.h
@@ -319,6 +319,20 @@
if (br->br_cons_head == br->br_prod_tail)
return (NULL);
+#if defined(__arm__) || defined(__aarch64__)
+ /*
+ * The barrier is required there on ARM and ARM64 to ensure, that
+ * br->br_ring[br->br_cons_head] will not be fetched before the above
+ * condition is checked.
+ * Without the barrier, it is possible, that buffer will be fetched
+ * before the enqueue will put mbuf into br, then, in the meantime, the
+ * enqueue will update the array and the br_prod_tail, and the
+ * conditional check will be true, so we will return previously fetched
+ * (and invalid) buffer.
+ */
+ atomic_thread_fence_acq();
+#endif
+
#ifdef DEBUG_BUFRING
/*
* Single consumer, i.e. cons_head will not move while we are
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 30, 6:45 PM (2 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13197346
Default Alt Text
D19932.id56270.diff (889 B)
Attached To
Mode
D19932: Add barrier in buf ring peek function to prevent race in ARM and ARM64
Attached
Detach File
Event Timeline
Log In to Comment