[compiler-rt] [win/asan] GetInstructionSize: Fix `41 81 7c ...` to return 9. (PR #117828)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 16:58:46 PST 2024
https://github.com/bernhardu created https://github.com/llvm/llvm-project/pull/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)
```
>From ed1fc050dec26d7b60e09dd40b03be0d6224aa88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu at mailbox.org>
Date: Wed, 27 Nov 2024 01:19:38 +0100
Subject: [PATCH] [win/asan] GetInstructionSize: Fix `41 81 7c ...` to return
9.
---
compiler-rt/lib/interception/interception_win.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 8767d8e79881c2..db9f922ba8b96b 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -808,7 +808,6 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0x798141: // 41 81 79 XX YY YY YY YY : cmp DWORD PTR [r9+YY], XX XX XX XX
case 0x7a8141: // 41 81 7a XX YY YY YY YY : cmp DWORD PTR [r10+YY], XX XX XX XX
case 0x7b8141: // 41 81 7b XX YY YY YY YY : cmp DWORD PTR [r11+YY], XX XX XX XX
- case 0x7c8141: // 41 81 7c XX YY YY YY YY : cmp DWORD PTR [r12+YY], XX XX XX XX
case 0x7d8141: // 41 81 7d XX YY YY YY YY : cmp DWORD PTR [r13+YY], XX XX XX XX
case 0x7e8141: // 41 81 7e XX YY YY YY YY : cmp DWORD PTR [r14+YY], XX XX XX XX
case 0x7f8141: // 41 81 7f YY XX XX XX XX : cmp DWORD PTR [r15+YY], XX XX XX XX
@@ -835,6 +834,10 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0x2444c7: // C7 44 24 XX YY YY YY YY
// mov dword ptr [rsp + XX], YYYYYYYY
return 8;
+
+ case 0x7c8141: // 41 81 7c ZZ YY XX XX XX XX
+ // cmp DWORD PTR [reg+reg*n+YY], XX XX XX XX
+ return 9;
}
switch (*(u32*)(address)) {
More information about the llvm-commits
mailing list