[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:57:29 PST 2024
https://github.com/bernhardu created https://github.com/llvm/llvm-project/pull/119794
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?)
>From f38dd005a97a8d1f8a96d13c180c58ec31976f56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu at mailbox.org>
Date: Wed, 4 Dec 2024 15:45:58 +0100
Subject: [PATCH] [win/asan] GetInstructionSize: Fix `8D A4 24 ...` to return
rel_offset=3.
---
compiler-rt/lib/interception/interception_win.cpp | 2 ++
compiler-rt/lib/interception/tests/interception_win_test.cpp | 1 +
2 files changed, 3 insertions(+)
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"},
More information about the llvm-commits
mailing list