[all-commits] [llvm/llvm-project] 213c90: [win/asan] GetInstructionSize: Fix `41 81 7c ...` ...
bernhardu via All-commits
all-commits at lists.llvm.org
Mon Dec 9 09:15:17 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 213c90d3c1f1517eb7a75ecf834f1faf90c288a8
https://github.com/llvm/llvm-project/commit/213c90d3c1f1517eb7a75ecf834f1faf90c288a8
Author: bernhardu <bernhardu at mailbox.org>
Date: 2024-12-09 (Mon, 09 Dec 2024)
Changed paths:
M compiler-rt/lib/interception/interception_win.cpp
M compiler-rt/lib/interception/tests/interception_win_test.cpp
Log Message:
-----------
[win/asan] GetInstructionSize: Fix `41 81 7c ...` to return 9. (#117828)
Trying to populate the recently added test for GetInstructionSize I
stumbled over this.
gdb and bddisasm have the opinion this instruction is 9 bytes.
Also lldb shows this:
```
(lldb) disassemble --bytes --start-address 0x0000555555556004 --end-address 0x0000555555556024
0x555555556004: 41 81 7b 73 74 75 76 77 cmpl $0x77767574, 0x73(%r11) ; imm = 0x77767574
0x55555555600c: 41 81 7c 73 74 75 76 77 78 cmpl $0x78777675, 0x74(%r11,%rsi,2) ; imm = 0x78777675
0x555555556015: 41 81 7d 73 74 75 76 77 cmpl $0x77767574, 0x73(%r13) ; imm = 0x77767574
0x55555555601d: 00 00 addb %al, (%rax)
```
There is also a handy tool in llvm to directly feed in the byte sequence
- `41 81 7c` also uses 9 bytes here:
```
$ echo -n -e "0x41, 0x81, 0x7b, 0x73, 0x74, 0x75, 0x76, 0x77, 0x90" | ./llvm/build/bin/llvm-mc --disassemble --show-encoding
.text
cmpl $2004252020, 115(%r11) # encoding: [0x41,0x81,0x7b,0x73,0x74,0x75,0x76,0x77]
# imm = 0x77767574
nop # encoding: [0x90]
$ echo -n -e "0x41, 0x81, 0x7c, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x90" | ./llvm/build/bin/llvm-mc --disassemble --show-encoding
.text
cmpl $2021095029, 116(%r11,%rsi,2) # encoding: [0x41,0x81,0x7c,0x73,0x74,0x75,0x76,0x77,0x78]
# imm = 0x78777675
nop # encoding: [0x90]
```
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list