From f955266cf7c086ddcd51013fe31e3c142cfe8821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 5 Sep 2026 13:38:04 +0200 Subject: [PATCH] std.debug.Dwarf.Unwind.VM: handle aarch64 pac-ret opcodes (by ignoring them) SelfUnwinder already unconditionally strips pointer authentication codes, so for the self-unwinding case, we just need to make sure that these opcodes don't cause unwinding to fail due to error.UnimplementedUserOpcode. --- lib/std/debug/Dwarf/Unwind/VirtualMachine.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/std/debug/Dwarf/Unwind/VirtualMachine.zig b/lib/std/debug/Dwarf/Unwind/VirtualMachine.zig index 8f84550d6c4479e3ce9e765e7a87fc549fb64989..70cd56b86b83ea603dcf26d68282ca3e12eba056 100644 --- a/lib/std/debug/Dwarf/Unwind/VirtualMachine.zig +++ b/lib/std/debug/Dwarf/Unwind/VirtualMachine.zig @@ -460,7 +460,14 @@ pub const Instruction = union(enum) { .def_cfa_expression => .{ .def_cfa_expr = try reader.takeLeb128(usize) }, _ => switch (@backingInt(inst.low.extended)) { - 0x1C...0x3F => return error.UnimplementedUserOpcode, + // For the moment, we just ignore these so that they don't cause unwinding to + // fail; `SelfUnwinder` already unconditionally strips pointer authentication + // codes. If this code is ever extended to be useful for remote/offline + // unwinding, we will have to actually model the RA sign state properly. + 0x2C => .nop, // DW_CFA_AARCH64_negate_ra_state_with_pc + 0x2D => .nop, // DW_CFA_AARCH64_negate_ra_state + + 0x1C...0x2B, 0x2E...0x3F => return error.UnimplementedUserOpcode, else => return error.InvalidOpcode, }, }, -- 2.54.0