[clang] [clang][PAC] Sign and authenticate atomics on __ptrauth types (PR #240090)

JF Bastien via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 00:42:02 PST 2026


================
@@ -375,6 +375,78 @@ bool AtomicInfo::emitMemSetZeroIfNecessary() const {
   return true;
 }
 
+/// Compare-exchange on `__ptrauth`-qualified storage. The caller's expected
+/// value is never signed: that would mint a signature for a caller-chosen
+/// value, a signing oracle wherever the compiler spills it. The comparand is
+/// the object's own signed representation, authenticated and compared as a
+/// plain value. Leaves the builder in \p StoreExpectedBB and returns the plain
+/// value to write back there, with the block that reaches \p ContinueBB on
+/// success.
----------------
jfbastien wrote:

Thank @rjmccall, your approach is way cleaner! My earlier noodling had either awkward ergonomics or a signing oracle.
As mentioned in the other comment, I think this and #240294 make it easier to discuss what's here now, and what we want to have. I can split this one further if you'd want.

https://github.com/llvm/llvm-project/pull/240090


More information about the cfe-commits mailing list