Skip to content

Commit bf6f1ca

Browse files
authored
[win/asan] GetInstructionSize: Make F6 C1 XX a generic entry. (#118144)
1 parent 213c90d commit bf6f1ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler-rt/lib/interception/interception_win.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,9 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
634634
case 0xD284: // 84 D2 : test dl,dl
635635
return 2;
636636

637+
case 0xC1F6: // F6 C1 XX : test cl, XX
638+
return 3;
639+
637640
// Cannot overwrite control-instruction. Return 0 to indicate failure.
638641
case 0x25FF: // FF 25 XX YY ZZ WW : jmp dword ptr ds:[WWZZYYXX]
639642
return 0;
@@ -723,8 +726,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
723726
return 7;
724727
}
725728

726-
switch (0x00FFFFFF & *(u32*)address) {
727-
case 0x07c1f6: // f6 c1 07 : test cl, 0x7
729+
switch (0x00FFFFFF & *(u32 *)address) {
728730
case 0x10b70f: // 0f b7 10 : movzx edx, WORD PTR [rax]
729731
case 0xc00b4d: // 4d 0b c0 : or r8, r8
730732
case 0xc03345: // 45 33 c0 : xor r8d, r8d

compiler-rt/lib/interception/tests/interception_win_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ const struct InstructionSizeData {
927927
{ 3, {0x4d, 0x85, 0xed}, 0, "4d 85 ed : test r13, r13"},
928928
{ 3, {0x4d, 0x85, 0xf6}, 0, "4d 85 f6 : test r14, r14"},
929929
{ 3, {0x4d, 0x85, 0xff}, 0, "4d 85 ff : test r15, r15"},
930+
{ 3, {0xf6, 0xc1, 0x72}, 0, "f6 c1 XX : test cl, XX"},
930931
{ 4, {0x44, 0x0f, 0xb6, 0x1a}, 0, "44 0f b6 1a : movzx r11d, BYTE PTR [rdx]"},
931932
{ 4, {0x44, 0x8d, 0x42, 0x73}, 0, "44 8d 42 XX : lea r8d , [rdx + XX]"},
932933
{ 4, {0x48, 0x83, 0xec, 0x73}, 0, "48 83 ec XX : sub rsp, XX"},

0 commit comments

Comments
 (0)