cisco-open / llvm-crash-analyzer

llvm crash analysis
Apache License 2.0
40 stars 17 forks source link

[Decompiler] Ensure crash-start instruction is decompiled #18

Closed niktesic closed 1 year ago

niktesic commented 1 year ago

This patch fixes two problems with incomplete decompilation.

  1. Wrong instruction size determination when prefixes are present Solution: Backport of D95682 which fixed PR48901

  2. Call instruction (like tail call) jumps into next successive portion of code with NOP for padding (example below)

    0x7fea74739fd1 <f1+49>:    mov    (%rbx),%rdi
    0x7fea74739fd4 <f1+52>:    callq  0x7fea74739fe0 <f2>
    0x7fea74739fd9:      nopl   0x0(%rax)
    0x7fea74739fe0 <f2>:    push   %rbp
    0x7fea74739fe1 <f2+1>:  mov    %rsp,%rbp

    Solution: In such cases, add NOP after the CALL and mark it as crash-start if the address matches.

    Note: Please, do not squash these commits, since having separate backport commits would be beneficial for a future rebase of the project.