-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[win/asan] GetInstructionSize: Add test for 8D A4 24 ...
.
#119794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: None (bernhardu) ChangesThis just adds the displacement for this instruction. CC: @zmodem Full diff: https://github.com/llvm/llvm-project/pull/119794.diff 2 Files Affected:
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"},
|
If I haven't misunderstood, the point of
Also, considering that on x86 (not x86_64) there is no PC-relative addressing (outside of near jump/call), setting |
+1 I don't think this should set rel_offset. |
f38dd00
to
60b672a
Compare
8D A4 24 ...
to return rel_offset=3.8D A4 24 ...
.
Thank you for the explanations, that part was obviously not completely clear to me. I pushed a new version of this patch to just include this test line with rel_offset=0, Just for the background I am trying to get the tests as correct as I can by using (Unfortunately I was not able to get something similar out of llvm/tablegen. Linking the llvm disassembler into the interception might be out of reach, but wouldn't it be possible to link it into the Interception-x86_64-Test.exe? This would make it possible to verify the test list "on the fly".) |
A happy new year to you all. This is now only a comment modification and an added test, are there other issues left? |
No, I think it's good to go in. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/198/builds/1048 Here is the relevant piece of the build log for the reference
|
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?)