diff options
| author | Nicole Mazzuca <nicole@strega-nil.co> | 2023-08-21 14:13:51 -0700 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2023-08-21 14:17:42 -0700 |
| commit | c0c83668f8992ec00f5718ee330f82e2ce4ad5c8 (patch) | |
| tree | 8d82525ee42f18e1c7af09ca2854b67ef37f1db9 /compiler-rt/lib/interception/interception_win.cpp | |
| parent | 651e644595b72c22fd22f51358cf083146790ed4 (diff) | |
| download | llvm-c0c83668f8992ec00f5718ee330f82e2ce4ad5c8.zip llvm-c0c83668f8992ec00f5718ee330f82e2ce4ad5c8.tar.gz llvm-c0c83668f8992ec00f5718ee330f82e2ce4ad5c8.tar.bz2 | |
ASan: Add additional wcs* interceptors on Windows
This adds wcs[n]cat, wcs[n]cmp, wcs[n]cpy, and wcschr functions to the
interception code on Windows; wcs[n]cat was already intercepted, but only on
POSIX.
Differential Revision: https://reviews.llvm.org/D157038
Diffstat (limited to 'compiler-rt/lib/interception/interception_win.cpp')
| -rw-r--r-- | compiler-rt/lib/interception/interception_win.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp index 00c3175..5cdea407 100644 --- a/compiler-rt/lib/interception/interception_win.cpp +++ b/compiler-rt/lib/interception/interception_win.cpp @@ -520,15 +520,21 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { switch (*(u16*)(address)) { case 0x018A: // 8A 01 : mov al, byte ptr [ecx] case 0xFF8B: // 8B FF : mov edi, edi + case 0xDC8B: // 8B DC : mov ebx, esp case 0xEC8B: // 8B EC : mov ebp, esp case 0xc889: // 89 C8 : mov eax, ecx case 0xE589: // 89 E5 : mov ebp, esp case 0xC18B: // 8B C1 : mov eax, ecx + case 0xFF33: // 33 FF : xor edi, edi case 0xC033: // 33 C0 : xor eax, eax case 0xC933: // 33 C9 : xor ecx, ecx case 0xD233: // 33 D2 : xor edx, edx return 2; + case 0xEC83: // 83 EC XX : sub esp, XX + case 0xE483: // 83 E4 XX : and esp, XX + return 3; + // Cannot overwrite control-instruction. Return 0 to indicate failure. case 0x25FF: // FF 25 XX XX XX XX : jmp [XXXXXXXX] return 0; @@ -589,6 +595,9 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { case 0xd28548: // 48 85 d2 : test rdx, rdx case 0xc0854d: // 4d 85 c0 : test r8, r8 case 0xc2b60f: // 0f b6 c2 : movzx eax, dl + case 0xc2b70f: // 0f b7 c2 : movzx eax, dx + case 0x01b70f: // 0f b7 01 : movzx eax, WORD PTR [rcx] + case 0x02b70f: // 0f b7 02 : movzx eax, WORD PTR [rdx] case 0xc03345: // 45 33 c0 : xor r8d, r8d case 0xc93345: // 45 33 c9 : xor r9d, r9d case 0xdb3345: // 45 33 DB : xor r11d, r11d @@ -602,11 +611,13 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { case 0xc00b4d: // 3d 0b c0 : or r8, r8 case 0xc08b41: // 41 8b c0 : mov eax, r8d case 0xd18b48: // 48 8b d1 : mov rdx, rcx + case 0xc22b4c: // 4c 2b c2 : sub r8, rdx case 0xdc8b4c: // 4c 8b dc : mov r11, rsp case 0xd18b4c: // 4c 8b d1 : mov r10, rcx case 0xE0E483: // 83 E4 E0 : and esp, 0xFFFFFFE0 return 3; + case 0x398366: // 66 83 39 XX : cmp DWORD PTR [rcx], XX case 0xec8348: // 48 83 ec XX : sub rsp, XX case 0xf88349: // 49 83 f8 XX : cmp r8, XX case 0x588948: // 48 89 58 XX : mov QWORD PTR[rax + XX], rbx @@ -631,6 +642,8 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { } switch (*(u32*)(address)) { + case 0x01b70f44: // 44 0f b7 01 : movzx r8d, WORD PTR [rcx] + return 4; case 0x24448b48: // 48 8b 44 24 XX : mov rax, QWORD ptr [rsp + XX] case 0x246c8948: // 48 89 6C 24 XX : mov QWORD ptr [rsp + XX], rbp case 0x245c8948: // 48 89 5c 24 XX : mov QWORD PTR [rsp + XX], rbx @@ -640,6 +653,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { case 0x24548948: // 48 89 54 24 XX : mov QWORD PTR [rsp + XX], rdx case 0x244c894c: // 4c 89 4c 24 XX : mov QWORD PTR [rsp + XX], r9 case 0x2444894c: // 4c 89 44 24 XX : mov QWORD PTR [rsp + XX], r8 + case 0x24548966: // 66 89 54 24 XX : mov WORD PTR [rsp + XX], dx return 5; case 0x24648348: // 48 83 64 24 XX : and QWORD PTR [rsp + XX], YY return 6; |
