[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:40:03 PST 2026
jfbastien wrote:
@ojhunt I split the patch in two: #240294 only fixes the crash and documents current behavior with FIXMEs, no functional change. This PR is the behavior change. Cleaned up along the way, and the integer work is out.
> I'm not convinced that this is the correct structural approach, I feel there is too much duplication of code.
>
> My preference would be for us to have an initial path that does the basics: load+store+equality
>
> The changes for that should be negligible, and not required an particularly complex changes to cmpxchange: the new value simply gets signed to the target schema prior to being passed to the existing xchg logic.
So I'm not sure I've succeeded at this, LMK what you think.
> I'd like tests to ensure that no-op schema change does not re-authenticate unnecessarily - I'm actually curious what currently happens with an atomic function pointer.
#240294 should now show this.
> I'm using "authenticated integer" below, as "signed integer" is cursed.
>
> I do not like the addition of hasPointerAuthInteger - it seems plausible there's a dumb oversight in the existing "has pointer auth" check on the context that fails to record authenticated integers. If so that should be fixed, we shouldn't have an ad hoc implementation here - and if it is necessary to know there are authenticated integers specifically the astcontext pointer auth caches should record that directly.
>
> As a separate point to this, I'm not sure we want to invest significant support that encourages authenticated integers -- there are real questions about how much we really want people to use them as if normal integers vs simply opaque pointer aliases that C and C++ developers seem woefully obsessed with.
OK so I can split this patch in two if you think it would be better, and do some follow ups. I think with #240294 and this one it's a bit clear what we can decide to allow / disallow.
> A large number of the tests appear to simply be authenticated integer semantic tests implying the AI used here made improvements to the authenticated integer implementation that should be separated.
>
> Also clean up the LLM comments.
I left the ones that helped me understand stuff, but LMK if it's still too obvious.
https://github.com/llvm/llvm-project/pull/240090
More information about the cfe-commits
mailing list