Skip to content

[win/asan] GetInstructionSize: Support some more 2 byte instructions. #120235

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

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler-rt/lib/interception/interception_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,17 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0xFF8B: // 8B FF : mov edi, edi
case 0xEC8B: // 8B EC : mov ebp, esp
case 0xc889: // 89 C8 : mov eax, ecx
case 0xD189: // 89 D1 : mov ecx, edx
case 0xE589: // 89 E5 : mov ebp, esp
case 0xC18B: // 8B C1 : mov eax, ecx
case 0xC031: // 31 C0 : xor eax, eax
case 0xC931: // 31 C9 : xor ecx, ecx
case 0xD231: // 31 D2 : xor edx, edx
case 0xC033: // 33 C0 : xor eax, eax
case 0xC933: // 33 C9 : xor ecx, ecx
case 0xD233: // 33 D2 : xor edx, edx
case 0xDB84: // 84 DB : test bl,bl
case 0xC084: // 84 C0 : test al,al
case 0xC984: // 84 C9 : test cl,cl
case 0xD284: // 84 D2 : test dl,dl
return 2;
Expand Down
5 changes: 5 additions & 0 deletions compiler-rt/lib/interception/tests/interception_win_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,14 +839,19 @@ const struct InstructionSizeData {
{ 1, {0x90}, 0, "90 : nop"},
{ 1, {0xC3}, 0, "C3 : ret (for small/empty function interception"},
{ 1, {0xCC}, 0, "CC : int 3 i.e. registering weak functions)"},
{ 2, {0x31, 0xC0}, 0, "31 C0 : xor eax, eax"},
{ 2, {0x31, 0xC9}, 0, "31 C9 : xor ecx, ecx"},
{ 2, {0x31, 0xD2}, 0, "31 D2 : xor edx, edx"},
{ 2, {0x33, 0xC0}, 0, "33 C0 : xor eax, eax"},
{ 2, {0x33, 0xC9}, 0, "33 C9 : xor ecx, ecx"},
{ 2, {0x33, 0xD2}, 0, "33 D2 : xor edx, edx"},
{ 2, {0x6A, 0x71}, 0, "6A XX : push XX"},
{ 2, {0x84, 0xC0}, 0, "84 C0 : test al,al"},
{ 2, {0x84, 0xC9}, 0, "84 C9 : test cl,cl"},
{ 2, {0x84, 0xD2}, 0, "84 D2 : test dl,dl"},
{ 2, {0x84, 0xDB}, 0, "84 DB : test bl,bl"},
{ 2, {0x89, 0xc8}, 0, "89 C8 : mov eax, ecx"},
{ 2, {0x89, 0xD1}, 0, "89 D1 : mov ecx, edx"},
{ 2, {0x89, 0xE5}, 0, "89 E5 : mov ebp, esp"},
{ 2, {0x8A, 0x01}, 0, "8A 01 : mov al, byte ptr [ecx]"},
{ 2, {0x8B, 0xC1}, 0, "8B C1 : mov eax, ecx"},
Expand Down
Loading