[all-commits] [llvm/llvm-project] 6e45fa: [PAC][AArch64] Support init/fini array signing (#9...

Daniil Kovalev via All-commits all-commits at lists.llvm.org
Mon Aug 5 22:02:35 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e45fa95be9db5318ac7037c673c9b18a48ac5b1
      https://github.com/llvm/llvm-project/commit/6e45fa95be9db5318ac7037c673c9b18a48ac5b1
  Author: Daniil Kovalev <dkovalev at accesssoftek.com>
  Date:   2024-08-06 (Tue, 06 Aug 2024)

  Changed paths:
    M clang/include/clang/Basic/Features.def
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/PointerAuthOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Headers/ptrauth.h
    M clang/test/CodeGen/aarch64-elf-pauthabi.c
    A clang/test/CodeGen/ptrauth-init-fini.c
    M clang/test/Driver/aarch64-ptrauth.c
    M clang/test/Preprocessor/ptrauth_feature.c
    M compiler-rt/lib/builtins/crtbegin.c
    M llvm/include/llvm/BinaryFormat/ELF.h
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/test/CodeGen/AArch64/note-gnu-property-elf-pauthabi.ll
    A llvm/test/CodeGen/AArch64/ptrauth-init-fini.ll
    M llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-feature-pauth.s
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [PAC][AArch64] Support init/fini array signing (#96478)

If both `-fptrauth-init-fini` and `-fptrauth-calls` are passed, sign
function pointers in `llvm.global_ctors` and `llvm.global_dtors` with
constant discriminator 0xD9D4
(`ptrauth_string_discriminator("init_fini")`). Additionally, if
`-fptrauth-init-fini-address-discrimination` is passed, address
discrimination is used for signing (otherwise, just constant
discriminator is used).

For address discrimination, we use it's special form since uses of
`llvm.global_{c|d}tors` are disallowed (see
`Verifier::visitGlobalVariable`) and we can't emit `getelementptr`
expressions referencing these special arrays. A signed ctor/dtor pointer
with special address discrimination applied looks like the following:

```
ptr ptrauth (ptr @foo, i32 0, i64 55764, ptr inttoptr (i64 1 to ptr))
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list