diff options
| author | Reid Kleckner <rnk@google.com> | 2017-06-16 20:44:00 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2017-06-16 20:44:00 +0000 |
| commit | f1b9f3a23f90bb3ea230a8f2514b98e81849ed88 (patch) | |
| tree | 759fd2ad4a5c4ff926e610b9a70f1f88bfa76857 /compiler-rt/lib/interception/tests | |
| parent | d340605a37379d09d7c1c0ef6d3c8defe46091c4 (diff) | |
| download | bcm5719-llvm-f1b9f3a23f90bb3ea230a8f2514b98e81849ed88.tar.gz bcm5719-llvm-f1b9f3a23f90bb3ea230a8f2514b98e81849ed88.zip | |
[WinASan] Fix hotpatching new Win 10 build 1703 x64 strnlen prologue
The first instruction of the new ucrtbase!strnlen implementation loads a
global, presumably to dispatch between SSE and non-SSE optimized strnlen
implementations.
Fixes PR32895 and probably
https://github.com/google/sanitizers/issues/818
llvm-svn: 305581
Diffstat (limited to 'compiler-rt/lib/interception/tests')
| -rw-r--r-- | compiler-rt/lib/interception/tests/interception_win_test.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cc b/compiler-rt/lib/interception/tests/interception_win_test.cc index a705768d6d5..37ef994f83d 100644 --- a/compiler-rt/lib/interception/tests/interception_win_test.cc +++ b/compiler-rt/lib/interception/tests/interception_win_test.cc @@ -170,6 +170,13 @@ const u8 kPatchableCode5[] = { 0x54, // push esp }; +#if SANITIZER_WINDOWS64 +u8 kLoadGlobalCode[] = { + 0x8B, 0x05, 0x00, 0x00, 0x00, 0x00, // mov eax [rip + global] + 0xC3, // ret +}; +#endif + const u8 kUnpatchableCode1[] = { 0xC3, // ret }; @@ -502,6 +509,10 @@ TEST(Interception, PatchableFunction) { EXPECT_TRUE(TestFunctionPatching(kPatchableCode4, override)); EXPECT_TRUE(TestFunctionPatching(kPatchableCode5, override)); +#if SANITIZER_WINDOWS64 + EXPECT_TRUE(TestFunctionPatching(kLoadGlobalCode, override)); +#endif + EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode1, override)); EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode2, override)); EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode3, override)); |

