]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix data race in RCU pointer exchange operations
authorOndřej Surý <ondrej@sury.org>
Thu, 19 Mar 2026 06:30:24 +0000 (07:30 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 19 Mar 2026 07:10:22 +0000 (08:10 +0100)
commit9457f4f8c5259d4ece0eb47225075d5e885701ba
tree2227e2b2da2ba1440317878453762eded51cedcd
parentfdb5eca9a9c2c002834fc891f67a30b60a5cb501
Fix data race in RCU pointer exchange operations

The liburcu rcu_cmpxchg_pointer() uses CMM_RELAXED ordering on the CAS
failure path.  When a thread loses the CAS and gets another thread's
pointer back, reading fields through that pointer is a data race on
weakly-ordered architectures (ARM, POWER) because the failing load has
no acquire semantics.

Override rcu_cmpxchg_pointer() and rcu_xchg_pointer() to use standard
__atomic builtins with __ATOMIC_ACQ_REL (success) and __ATOMIC_ACQUIRE
(failure) ordering.  This fixes the race on all architectures and is
natively visible to ThreadSanitizer.
lib/isc/include/isc/urcu.h