[compiler-rt] [win/asan] GetInstructionSize: Fix `8D A4 24 ...` to return rel_offset=3. (PR #119794)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 16:58:08 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (bernhardu)
<details>
<summary>Changes</summary>
This just adds the displacement for this instruction.
And add the test line.
CC: @<!-- -->zmodem
CC: @<!-- -->alvinhochun (I hope this is ok, as you commented also in PR 113085 regarding rel_offset?)
---
Full diff: https://github.com/llvm/llvm-project/pull/119794.diff
2 Files Affected:
- (modified) compiler-rt/lib/interception/interception_win.cpp (+2)
- (modified) compiler-rt/lib/interception/tests/interception_win_test.cpp (+1)
``````````diff
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index a5897274521e92..89f75e8fd2a7b9 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -646,6 +646,8 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
switch (0x00FFFFFF & *(u32 *)address) {
case 0x24A48D: // 8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]
+ if (rel_offset)
+ *rel_offset = 3;
return 7;
}
diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cpp b/compiler-rt/lib/interception/tests/interception_win_test.cpp
index 04d9a6766f65ad..96765016203542 100644
--- a/compiler-rt/lib/interception/tests/interception_win_test.cpp
+++ b/compiler-rt/lib/interception/tests/interception_win_test.cpp
@@ -858,6 +858,7 @@ const struct InstructionSizeData {
{ 5, {0x68, 0x71, 0x72, 0x73, 0x74}, 0, "68 XX XX XX XX : push imm32"},
{ 5, {0xb8, 0x71, 0x72, 0x73, 0x74}, 0, "b8 XX XX XX XX : mov eax, XX XX XX XX"},
{ 5, {0xB9, 0x71, 0x72, 0x73, 0x74}, 0, "b9 XX XX XX XX : mov ecx, XX XX XX XX"},
+ { 7, {0x8D, 0xA4, 0x24, 0x73, 0x74, 0x75, 0x76}, 3, "8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]"},
#if SANITIZER_WINDOWS_x64
// sorted list
{ 2, {0x40, 0x50}, 0, "40 50 : push rax"},
``````````
</details>
https://github.com/llvm/llvm-project/pull/119794
More information about the llvm-commits
mailing list