[all-commits] [llvm/llvm-project] e7f03a: [runtimes][PAC] Harden unwinding when possible (#1...

Oliver Hunt via All-commits all-commits at lists.llvm.org
Tue Oct 14 21:00:28 PDT 2025


  Branch: refs/heads/users/ojhunt/pointer-authenticated-unwinding
  Home:   https://github.com/llvm/llvm-project
  Commit: e7f03a8770c74a630c51bf536bbe37a2ebab5820
      https://github.com/llvm/llvm-project/commit/e7f03a8770c74a630c51bf536bbe37a2ebab5820
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/builtins/gcc_personality_v0.c
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_exception.h
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/AddressSpace.hpp
    M libunwind/src/CompactUnwinder.hpp
    M libunwind/src/DwarfInstructions.hpp
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/UnwindRegistersSave.S
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  [runtimes][PAC] Harden unwinding when possible (#138571)

This hardens the unwinding logic and datastructures on systems
that support pointer authentication.
The approach taken to hardening is to harden the schemas of as many
high value fields in the myriad structs as possible, and then also
explicitly qualify local variables referencing privileged or security
critical values.
This does introduce ABI linkage between libcxx, libcxxabi, and
libunwind but those are in principle separate from the OS itself
so we've kept the schema definitions in the library specific headers
rather than ptrauth.h


  Commit: 61b763aa1412a755f9fa6c18e82ed712bb6dc0b6
      https://github.com/llvm/llvm-project/commit/61b763aa1412a755f9fa6c18e82ed712bb6dc0b6
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/AddressSpace.hpp
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Updating to include some fixes I lost in the last update

At some point I lost the changes to loadAndAuthenticateLinkRegister
I also updated schema names in libunwind to be more consistent
Finally while looking at the total diff I saw some places that
the formatting could be improved.


  Commit: 6e696ad4628adf62daea65256355fc5bbf9a89e4
      https://github.com/llvm/llvm-project/commit/6e696ad4628adf62daea65256355fc5bbf9a89e4
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Build fix due to not testing the build after apply review feedback \o/


  Commit: 27d43afe0da27b8aa043c4f2d35378ae94bc9cf8
      https://github.com/llvm/llvm-project/commit/27d43afe0da27b8aa043c4f2d35378ae94bc9cf8
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  work around a bug where clang reports a template function as unused


  Commit: 8dc31944f4c5dcc99b3e1086b0f11a4f7af18407
      https://github.com/llvm/llvm-project/commit/8dc31944f4c5dcc99b3e1086b0f11a4f7af18407
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/src/cxa_personality.cpp

  Log Message:
  -----------
  And another one


  Commit: d3ba2f8298de5249347a1b27ea2c29e99d441096
      https://github.com/llvm/llvm-project/commit/d3ba2f8298de5249347a1b27ea2c29e99d441096
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/Registers.hpp

  Log Message:
  -----------
  Add all the required reg_t and link_reg_t decls, and unify location


  Commit: c1ec8d6dd9c4b43e8101bccfe0408eab4e43e4c5
      https://github.com/llvm/llvm-project/commit/c1ec8d6dd9c4b43e8101bccfe0408eab4e43e4c5
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/src/cxa_personality.cpp

  Log Message:
  -----------
  This erroneous error is annoying


  Commit: 7a78b25fac118a473f38178f10870543dcf68aa1
      https://github.com/llvm/llvm-project/commit/7a78b25fac118a473f38178f10870543dcf68aa1
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/src/cxa_personality.cpp

  Log Message:
  -----------
  Remove header include that is unnecessary but apparently works in some places


  Commit: a5cd944e86a9493987f0f7c76c840ea8585ebdb1
      https://github.com/llvm/llvm-project/commit/a5cd944e86a9493987f0f7c76c840ea8585ebdb1
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/builtins/crtbegin.c
    M compiler-rt/lib/builtins/gcc_personality_v0.c
    M compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
    M compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
    M compiler-rt/test/asan/TestCases/zero_page_pc.cpp
    M compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp
    M compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
    M libcxx/src/include/overridable_function.h
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_exception.h
    M libcxxabi/src/cxa_personality.cpp
    M libcxxabi/src/private_typeinfo.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/DwarfInstructions.hpp
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/UnwindRegistersSave.S
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Update for feature check changes


  Commit: c2c0190b0b1bc6ad8beb3ac98748cd3a2d14b8c3
      https://github.com/llvm/llvm-project/commit/c2c0190b0b1bc6ad8beb3ac98748cd3a2d14b8c3
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/builtins/crtbegin.c
    M compiler-rt/lib/builtins/gcc_personality_v0.c
    M compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
    M compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
    M compiler-rt/test/asan/TestCases/zero_page_pc.cpp
    M compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_control_flow.cpp
    M compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
    M libcxx/src/include/overridable_function.h
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_exception.cpp
    M libcxxabi/src/cxa_personality.cpp
    M libcxxabi/src/private_typeinfo.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/UnwindRegistersSave.S
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  yet more cleaning up


  Commit: 3e59382376da1ab0aa779b37f8ee849bb363c133
      https://github.com/llvm/llvm-project/commit/3e59382376da1ab0aa779b37f8ee849bb363c133
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/builtins/gcc_personality_v0.c
    M compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp

  Log Message:
  -----------
  cleanup compiler-rt formatting


  Commit: ef030712e047cb7840578d00909159eb2446baab
      https://github.com/llvm/llvm-project/commit/ef030712e047cb7840578d00909159eb2446baab
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_exception.cpp
    M libcxxabi/src/cxa_exception.h
    M libcxxabi/src/cxa_personality.cpp

  Log Message:
  -----------
  update libcxxabi formatting


  Commit: 5b832beb1fa762f471b9ac36b3bd76ce3b728db3
      https://github.com/llvm/llvm-project/commit/5b832beb1fa762f471b9ac36b3bd76ce3b728db3
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Just make this a release mode failure


  Commit: 49a011100bd22479a337fca2cf45beaeee8e8ad0
      https://github.com/llvm/llvm-project/commit/49a011100bd22479a337fca2cf45beaeee8e8ad0
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
    M libcxxabi/src/cxa_exception.h
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/CompactUnwinder.hpp
    M libunwind/src/DwarfInstructions.hpp
    M libunwind/src/DwarfParser.hpp

  Log Message:
  -----------
  Address comments


  Commit: fc1375a44d15b70461ab317e0d989f749d7ccb8d
      https://github.com/llvm/llvm-project/commit/fc1375a44d15b70461ab317e0d989f749d7ccb8d
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/DwarfInstructions.hpp
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Sigh, actually make sure it builds, also address warnings


  Commit: 782cbdb961b889c9b1244fd710e2bc51cc501fbd
      https://github.com/llvm/llvm-project/commit/782cbdb961b889c9b1244fd710e2bc51cc501fbd
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/src/cxa_exception.h
    M libunwind/include/__libunwind_config.h
    M libunwind/src/DwarfInstructions.hpp

  Log Message:
  -----------
  Updating for feedback


  Commit: 34555e79ba8c8a946d1407d99c91b74c25f9f36a
      https://github.com/llvm/llvm-project/commit/34555e79ba8c8a946d1407d99c91b74c25f9f36a
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/src/cxa_personality.cpp

  Log Message:
  -----------
  whoops, wrong test


  Commit: d70e80219a05ecf1d07ca812a5a085c44f653555
      https://github.com/llvm/llvm-project/commit/d70e80219a05ecf1d07ca812a5a085c44f653555
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/UnwindLevel1.c

  Log Message:
  -----------
  You would not believe how long it took to find this


  Commit: 7192221c69ff2ad79131fa759889be0d251ed5b7
      https://github.com/llvm/llvm-project/commit/7192221c69ff2ad79131fa759889be0d251ed5b7
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M compiler-rt/lib/builtins/gcc_personality_v0.c
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/libunwind.h
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/UnwindLevel1.c

  Log Message:
  -----------
  Addressing some feedback

* Add note for `__ptrauth_restricted_intptr`
* Rename confusing parameter in set_landing_pad_as_ptr
* Rename __ptrauth_unwind_pacret_personality_disc to
  __ptrauth_unwind_pauthtest_personality_disc


  Commit: 0d482fae39dcadc0c4c491dc6d74bee62be63f30
      https://github.com/llvm/llvm-project/commit/0d482fae39dcadc0c4c491dc6d74bee62be63f30
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/src/UnwindLevel1.c

  Log Message:
  -----------
  cleaning up the [ab]use of unions


  Commit: 8d7e5264c32272d163e23e61ba625a405a59e6df
      https://github.com/llvm/llvm-project/commit/8d7e5264c32272d163e23e61ba625a405a59e6df
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libunwind/include/__libunwind_config.h
    M libunwind/include/libunwind.h
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/libunwind.cpp

  Log Message:
  -----------
  Addressing myriad feedback


  Commit: 0f2679a4a76bc0e6b88d407ed3c536b44b08680e
      https://github.com/llvm/llvm-project/commit/0f2679a4a76bc0e6b88d407ed3c536b44b08680e
  Author: Oliver Hunt <oliver at apple.com>
  Date:   2025-10-14 (Tue, 14 Oct 2025)

  Changed paths:
    M libcxxabi/include/__cxxabi_config.h
    M libcxxabi/src/cxa_exception.h
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/__libunwind_config.h
    M libunwind/include/libunwind.h
    M libunwind/src/CompactUnwinder.hpp
    M libunwind/src/DwarfParser.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c

  Log Message:
  -----------
  Fixing remaining issues

Stop using unions to deal with the pointer auth cast semantics,
instead perform manual re-signing. This means the templated helper
functions no longer need to be templates and so don't need to be
in a separated non-extern "C" block.

Fixing up the comments.


Compare: https://github.com/llvm/llvm-project/compare/e059e1ca7edf...0f2679a4a76b

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