1. Jun 13, 2024
  2. Jun 04, 2024
  3. May 31, 2024
    • Akira Hatanaka's avatar
      0e85001f
    • Ahmed Bougacha's avatar
      [clang] Define ptrauth_sign_constant builtin. · 1a23a99f
      Ahmed Bougacha authored
      
      
      This is constant-expression equivalent to __builtin_ptrauth_sign,
      allowing its usage in global initializers, but requiring constant
      pointers and discriminators.
      
      Co-Authored-By: default avatarJohn McCall <rjmccall@apple.com>
      1a23a99f
    • Ahmed Bougacha's avatar
      [clang] Define ptrauth_string_discriminator builtin. · 61be7a92
      Ahmed Bougacha authored
      
      
      This exposes the ABI-stable hash function that allows computing a 16-bit
      discriminator from a constant string.
      
      This allows manually matching the implicit string discriminators
      computed in the ABI (e.g., from mangled names for vtable pointer/entry
      signing), as well as enabling the use of interesting discriminators when
      manually annotating specific pointers with the __ptrauth qualifier.
      
      Co-Authored-By: default avatarJohn McCall <rjmccall@apple.com>
      61be7a92
    • Ahmed Bougacha's avatar
      [Support] Add SipHash-based 16/64-bit ptrauth stable hash. · 42cb73fe
      Ahmed Bougacha authored
      Based on the SipHash reference implementation:
        https://github.com/veorq/SipHash
      
      
      which has very graciously been licensed under our llvm license
      (Apache-2.0 WITH LLVM-exception) by Jean-Philippe Aumasson.
      
      This lightly modifies it to fit into libSupport, and wraps it for the
      two main interfaces we're interested in (16/64-bit).
      
      This intentionally doesn't expose a raw interface beyond that to
      encourage others to carefully consider their use.
      
      The exact algorithm is the little-endian interpretation of the
      non-doubled (i.e. 64-bit) result of applying a SipHash-2-4 using
      a specific key value which can be found in the source.
      
      By "stable" we mean that the result of this hash algorithm will the same
      across different compiler versions and target platforms.
      
      The 16-bit variant is used extensively for the AArch64 ptrauth ABI,
      because AArch64 can efficiently load a 16-bit immediate into the high
      bits of a register without disturbing the remainder of the value, which
      serves as a nice blend operation.
      
      16 bits is also sufficiently compact to not inflate a loader relocation.
      We disallow zero to guarantee a different discriminator from the places
      in the ABI that use a constant zero.
      
      Co-Authored-By: default avatarJohn McCall <rjmccall@apple.com>
      42cb73fe
    • Ahmed Bougacha's avatar
      [clang] Add arm64e ABI-defined key assignments to ptrauth.h. · fc8f76b4
      Ahmed Bougacha authored
      These are currently gated by __APPLE__; we can figure out a way to
      define these on ELF targets as well, and maybe have them be defined
      by clang itself, depending on ABI modes.
      fc8f76b4
  4. May 29, 2024