![]() |
|
Message-ID: <r7kks3juz7tgdwuo3qbjhrxundcllbux7yf7uruowu356kwoz5@s6qbkl3obuia> Date: Thu, 20 Mar 2025 12:07:11 +0100 From: Ignacy Gawędzki <ignacy.gawedzki@...en-communications.fr> To: musl@...ts.openwall.com Subject: [PATCH 0/1] Re: Stack unwinding issues with GDB on ARM. Hi again, Digging a little deeper, I came across the AWK scripts tools/add-cfi.*.awk used to automatically add CFI directives to assembly code for Intel archs (both i386 and x86_64). So instead of riddling the sources with CFI directives, I attempted to write such scripts for arm and aarch64. While doing so, I stumbled on a few issues with the existing versions for i386 and x86_64. Most notably, the CFA offsets can be off after forward in-function jumps, if the stack is manipulated between the location of the jump instruction and the location jumped into. So I adapted the existing scripts to keep track of the current CFA offset at the location of the jump, in order to restore it at the location jumped into. As for forward in-function calls, I hardened them in a similar way, to support several of them if that ever happens. I reworked the processing of stack manipulation instructions, adding support for more of them along the way. I also reworked the way trashing of register values is processed, but I did not attempt to process every possible instruction, as there are way too many of them. As for the arm and aarch64 versions, they work in a very similar way, with the notable difference that I tried to process every possible way to trash a register value, which is more reasonable given the limited number of them on there architectures. Ignacy Gawędzki (1): tools: Rework adding of CFI annotations. tools/add-cfi.aarch64.awk | 287 +++++++++++++++++++++++++++++ tools/add-cfi.arm.awk | 367 ++++++++++++++++++++++++++++++++++++++ tools/add-cfi.common.awk | 36 +++- tools/add-cfi.i386.awk | 331 +++++++++++++++++++++++----------- tools/add-cfi.x86_64.awk | 292 ++++++++++++++++++++---------- 5 files changed, 1100 insertions(+), 213 deletions(-) create mode 100644 tools/add-cfi.aarch64.awk create mode 100644 tools/add-cfi.arm.awk -- 2.45.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.