capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.18k stars 1.53k forks source link

[x64, regression] Incorrect displacement in disassembly of "vmovq qword ptr [r10 + rbp*4 + 0x100], xmm21" #1771

Open gergo- opened 3 years ago

gergo- commented 3 years ago

On the next branch we have:

$ cstool/cstool x64 "62 c1 fd 08 7e 6c aa 20"
 0  62 c1 fd 08 7e 6c aa 20                          vmovq  qword ptr [r10 + rbp*4 + 0x200], xmm21

while on master it is:

 0  62 c1 fd 08 7e 6c aa 20                          vmovq  qword ptr [r10 + rbp*4 + 0x100], xmm21

The displacement used to be 0x100, which I believe is correct, but on next it's disassembled as 0x200. GCC and binutils for comparison:

$ cat test.s && gcc -c test.s && objdump -d test.o
    .intel_syntax noprefix
    vmovq   qword ptr [r10 + rbp*4 + 0x100], xmm21

test.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:   62 c1 fd 08 7e 6c aa    vmovq  %xmm21,0x100(%r10,%rbp,4)
   7:   20 

Bisecting on the next branch points to 5a99624074d56f8eea26699496f0e8dc41cbf3fb as the responsible commit.

dougxc commented 1 year ago

Is there a possible patch for this issue we could help test?

mur47x111 commented 1 year ago

We proposed a fix in upstream https://github.com/llvm/llvm-project/issues/62412