[llvm] [BOLT][rewrite] warn about functions without CFG before binary analyses. (PR #197294)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 03:30:53 PDT 2026


================
@@ -3888,8 +3888,24 @@ void RewriteInstance::runBinaryAnalyses() {
   NamedRegionTimer T("runBinaryAnalyses", "run binary analysis passes",
                      TimerGroupName, TimerGroupDesc, opts::TimeRewrite);
   BinaryFunctionPassManager Manager(*BC);
-  // FIXME: add a pass that warns about which functions do not have CFG,
-  // and therefore, analysis is most likely to be less accurate.
+
+  // Warn about functions without a reconstructed CFG: binary analyses degrade
+  // in accuracy on those and may produce false negatives.
----------------
atrosinenko wrote:

Probably better not to mention "false negatives" specifically. For example, LLVM may have to emit multi-instruction checker sequences under some conditions for PAuth code to be safe. These sequences are of the form

```
        ; x0 was authenticated, but the CPU may not implement FEAT_FPAC
        ; <check if x0 is a valid address>
        ; <branch to .Lon_success if the check passes>
        brk     0xc472 ; or a few other error codes
.Lon_success:
        ; Now x0 is known to be authenticated *successfully*.
```

Presently, PAuth gadget scanner only detects such sequences if CFG is available ([example](https://github.com/llvm/llvm-project/blob/ec60d62118bf17328b4d63c67eb981f9c8347d56/bolt/test/binary-analysis/AArch64/gs-pauth-signing-oracles.s#L53)), meaning it would pessimistically ignore this safety measure if CFG is missing. Thus, false positives are possible, too.

https://github.com/llvm/llvm-project/pull/197294


More information about the llvm-commits mailing list