llvm / llvm/llvm-project

[BOLT][PAC] PAuth DWARF rewriting does not work with synchronous unwind tables

Open
#165,215 1 comment 0 reactions 1 assignee Claimed by @bgergely0 View on GitHub
BOLT
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

With clang the `-fno-asynchronous-unwind-tables` flag select synchronous mode for unwinding.

In this mode, the unwind information is not "complete" for all instructions, only for calls.

The `sign-return-address-cfi-negate-ra-state.ll` unittests in LLVM has a [function with async unwind tables](https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/AArch64/sign-return-address-cfi-negate-ra-state.ll#L59-L90), and one with [synchronous unwind tables](https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/AArch64/sign-return-address-cfi-negate-ra-state.ll#L137-L163). In the synchronous case, the `autiasp` (`hint 29`) does not have the `.cfi_negate_ra_state` CFI.

In BOLT, we expect all pac* and aut* variants that operate on the LR to have the appropriate unwind information (the `negate-ra-state` CFI), otherwise the function is ignored (not optimized).

Example: when applying BOLT to llama.cpp, this is seen in the logs: `Ignored 1633 functions (99.03%) because of CFI inconsistencies`. The huge % of ignored functions makes BOLT useless in such cases.

---

Expected behaviour:
- at minimum, the requirement of asynchronous unwind tables should be documented, and reported to users if we encounter a given % of such issues during optimization
- ideally, we should also enable optimizing such functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.