You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BOLT] Gadget scanner: improve handling of unreachable basic blocks (#136183)
Instead of refusing to analyze an instruction completely when it is
unreachable according to the CFG reconstructed by BOLT, use pessimistic
assumption of register state when possible. Nevertheless, unreachable
basic blocks found in optimized code likely means imprecise CFG
reconstruction, thus report a warning once per function.
Copy file name to clipboardExpand all lines: bolt/test/binary-analysis/AArch64/gs-pacret-autiasp.s
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -215,7 +215,7 @@ f_callclobbered_calleesaved:
215
215
.globl f_unreachable_instruction
216
216
.type f_unreachable_instruction,@function
217
217
f_unreachable_instruction:
218
-
// CHECK-LABEL: GS-PAUTH: Warning: unreachable instruction found in function f_unreachable_instruction, basic block {{[0-9a-zA-Z.]+}},ataddress
218
+
// CHECK-LABEL: GS-PAUTH: Warning: possibly imprecise CFG, the analysis quality may be degraded in this function. According to BOLT,unreachable code is found in function f_unreachable_instruction, basic block {{[0-9a-zA-Z.]+}},ataddress
219
219
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: add x0, x1, x2
220
220
// CHECK-NOT: instructions thatwrite to the affected registers after any authentication are:
// Basic blocks without any predecessors were observed in real-world optimized
1434
+
// code.Atleast sometimes they were actually reachable via jump table, which
1435
+
// was not detected, but the function was processed as if its CFG was
1436
+
// reconstructed successfully.
1437
+
//
1438
+
// As a more predictable model example, let's use really unreachable code
1439
+
// for testing.
1440
+
1441
+
.globl bad_unreachable_call
1442
+
.type bad_unreachable_call,@function
1443
+
bad_unreachable_call:
1444
+
// CHECK-LABEL: GS-PAUTH: Warning: possibly imprecise CFG, the analysis quality may be degraded in this function. According to BOLT, unreachable code is found in function bad_unreachable_call, basic block {{[^,]+}},ataddress
1445
+
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: blr x0
1446
+
// CHECK-NOT: instructions thatwrite to the affected registers after any authentication are:
1447
+
// CHECK-LABEL: GS-PAUTH: non-protected call found in function bad_unreachable_call, basic block {{[^,]+}},ataddress
1448
+
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: blr x0
1449
+
// CHECK-NEXT: The 0 instructions thatwrite to the affected registers after any authentication are:
// CHECK-LABEL: GS-PAUTH: Warning: possibly imprecise CFG, the analysis quality may be degraded in this function. According to BOLT, unreachable code is found in function good_unreachable_call, basic block {{[^,]+}},ataddress
1469
+
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: autia x0, x1
1470
+
// CHECK-NOT: instructions thatwrite to the affected registers after any authentication are:
// CHECK-LABEL: GS-PAUTH: Warning: possibly imprecise CFG, the analysis quality may be degraded in this function. According to BOLT, unreachable code is found in function unreachable_loop_of_bbs, basic block {{[^,]+}},ataddress
1494
+
// CHECK-NEXT: The instruction is {{[0-9a-f]+}}: blr x0
0 commit comments