[email protected], le mar. 03 mars 2026 04:08:15 +0000, a ecrit: > #### P-2: Non-atomic plain reads in lock fast paths (LOW on x86) > > **Files**: `mach/lowlevellock.h:78`, `hurd/hurdlock.c:136` > > `__lll_lock` reads `*__iptr != 0` with a plain load before the CAS. This is a > C11 data race (undefined behavior) but benign on x86 where aligned loads are > atomic and TSO provides sufficient ordering. The CAS catches any > inconsistency.
This looks rather handwaving to me. Yes, the *__iptr read does not bring any consistency, but that's fine: it's meant to not even try to take the lock when a quick unsafe check seems to say that it's not free. It's when we actually make the atomic_exchange_acquire to both try to take the lock and register ourself as waiting on failure, that we take the acquisition consistency. Samuel
