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:
- 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.)
- Open the function
main
- See in the disassembly panel, on address
0x001012e6, that Ghidra didn't disassemble further than the ud2 instruction.
- 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

Capture of disassembly using objdump, showing the complete disassembly. You can see that the optcodes are good.

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
Describe the bug
When opening a binary on Ghidra which contains the
ud2instruction (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:
main0x001012e6, that Ghidra didn't disassemble further than theud2instruction.objdump -d -M intel <binary>orgdbwithdisassemble 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
Capture of disassembly using
objdump, showing the complete disassembly. You can see that the optcodes are good.Attachments
The HackTheBox binary with which I first encountered the issue :
binary-ud2-issue.zip
Environment (please complete the following information):