Skip to content

ud2 x86 instruction is breaking disassembly process #4113

Description

@mh4ckt3mh4ckt1c4s

Describe the bug
When opening a binary on Ghidra which contains the ud2 instruction (undefined instruction), the disassembly doesn't go further than this instruction. Ghidra just show an incomplete disassembly and the C code from the decompiler is incomplete too. However, the optcodes are good.

To Reproduce
Steps to reproduce the behavior:

  1. Open a binary containing this instruction (I found the bug with the binary from this reverse challenge on HackTheBox (I solved it), the binary is attached below. (I also tested with a custom binary I created, and I encountered the same issue.)
  2. Open the function main
  3. See in the disassembly panel, on address 0x001012e6, that Ghidra didn't disassemble further than the ud2 instruction.
  4. You can compare with the "real" assembly by using objdump -d -M intel <binary> or gdb with disassemble main (both worked for me).

Expected behavior
Ghidra disassemble the binary correctly, displaying all the instructions, and the decompiler is able to read the instructions and give a complete output.

Screenshots
Capture of failed disassembly by Ghidra
image
Capture of disassembly using objdump, showing the complete disassembly. You can see that the optcodes are good.
image

Attachments
The HackTheBox binary with which I first encountered the issue :
binary-ud2-issue.zip

Environment (please complete the following information):

  • OS: Linux Archlinux, kernel version 5.16.16-arch1-1 x86_64
  • Java Version: 11.0.15
  • Ghidra Version: 10.1.2
  • Ghidra Origin: Archlinux AUR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions