summaryrefslogtreecommitdiff
path: root/lib/interception/tests
AgeCommit message (Collapse)Author
2017-10-12[cmake] [interception] Remove duplicate gtest from test COMPILE_DEPSMichal Gorny
Fix the gtest dependency to be included in DEPS only, rather than in COMPILE_DEPS + DEPS. The former variable is apparently used to provide unconditional dependencies, while the latter are only used for non-standalone builds. Since they are concatenated, specifying gtest in both is redundant. Furthermore, including it in COMPILE_DEPS causes build failure for standalone builds where 'gtest' target is not present. Differential Revision: https://reviews.llvm.org/D38839 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov
into a function. Most CMake configuration under compiler-rt/lib/*/tests have almost-the-same-but-not-quite functions of the form add_X_[unit]tests for compiling and running the tests. Much of the logic is duplicated with minor variations across different sub-folders. This can harm productivity for multiple reasons: For newcomers, resulting CMake files are very large, hard to understand, and hide the intention of the code. Changes for enabling certain architectures end up being unnecessarily large, as they get duplicated across multiple folders. Adding new sub-projects requires more effort than it should, as a developer has to again copy-n-paste the configuration, and it's not even clear from which sub-project it should be copy-n-pasted. With this change the logic of compile-and-generate-a-set-of-tests is extracted into a function, which hopefully makes writing and reading CMake much easier. Differential Revision: https://reviews.llvm.org/D36116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizers] Sanitizer tests CMake clean up: try #2George Karpenkov
This patch addresses two issues: Most of the time, hacks with `if/else` in order to get support for multi-configuration builds are superfluous. The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it expands to `.` on all single-configuration builds, and to a configuration name otherwise. The `if/else` hacks for the library name generation should also not be done, as CMake has `TARGET_FILE` generator expression precisely for this purpose, as it expands to the exact filename of the resulting target. Differential Revision: https://reviews.llvm.org/D35952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309341 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27Revert "[sanitizers] Sanitizer tests CMake clean up"George Karpenkov
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a. Fails on some bots, reverting until I can fix it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309318 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27[sanitizers] Sanitizer tests CMake clean upGeorge Karpenkov
This patch addresses two issues: Most of the time, hacks with `if/else` in order to get support for multi-configuration builds are superfluous. The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it expands to `.` on all single-configuration builds, and to a configuration name otherwise. The `if/else` hacks for the library name generation should also not be done, as CMake has `TARGET_FILE` generator expression precisely for this purpose, as it expands to the exact filename of the resulting target. Differential Revision: https://reviews.llvm.org/D35952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309306 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16[WinASan] Fix hotpatching new Win 10 build 1703 x64 strnlen prologueReid Kleckner
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30[interception] Check for export table's size before referring to its elements.Marcos Pividori
This fix a bug, when calling InternalGetProcAddress() for an executable that doesn't export any symbol. So the table is empty. If we don't check for this condition, the program fails with Error 0xc0000142. Also, I add a regression test for Windows. Differential Revision: https://reviews.llvm.org/D28502 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15[asan] Don't assert that a target is within 2GB on 32-bit WindowsReid Kleckner
Summary: In a 32-bit address space, PC-relative jump targets are wrapped, so a direct branch at 0x90000001 can reach address 0x10000000 with a displacement of 0x7FFFFFFFF. This can happen in applications, such as Chrome, that are linked with /LARGEADDRESSAWARE. Reviewers: etienneb Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26650 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14[interception] Avoid duplicate declaration of isdigit in testJonas Hahnfeld
Differential Revision: https://reviews.llvm.org/D24504 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03[compilter-rt] Try to fix correctly rL277560Etienne Bergeron
rL277560: [compiler-rt] Fix broken interception unittest git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277567 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03[compiler-rt] Fix broken interception unittestEtienne Bergeron
Summary: This patch is fixing a broken unittest which make the win64 bot failing. The bug was introduce here: https://reviews.llvm.org/D23046 The interception code is not the same in 32-bit and in 64-bit. The added unittest can only be patched on 32-bits. Reviewers: rnk Subscribers: llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23099 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02[asan] Intercept RtlRaiseException instead of kernel32!RaiseExceptionReid Kleckner
Summary: On my install of Windows 10, RaiseException is a tail call to kernelbase!RaiseException. Obviously, we fail to intercept that. Instead, try hooking at the ntdll!RtlRaiseException layer. It is unlikely that this layer will contain control flow. Intercepting at this level requires adding a decoding for 'LEA ESP, [ESP + 0xXXXXXXXX]', which is a really obscure way to write 'SUB ESP, 0xXXXXXXXX' that avoids clobbering EFLAGS. Reviewers: etienneb Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23046 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28Fix broken build botEtienne Bergeron
The address resolution is ussing RTLD_NEXT and not RTLD_DEFAULT. Which means &func may not be equivalent to dlsym("func"). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12[asan] Fix interception unittest on Windows64.Etienne Bergeron
mov edi,edi is _not_ NOP in 64-bit, use 66,90h instead. This bug was causing interception unittest to crash on Windows64 (windows 8 and windows 10). Credits to etienneb for finding the root cause. Patch by: Wei Wang Differential Revision: http://reviews.llvm.org/D22274 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11missing modifications for http://reviews.llvm.org/D21952Etienne Bergeron
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275124 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Refactor the interception code on windows.Etienne Bergeron
Summary: This is a cleanup and refactoring of the interception code on windows Enhancement: * Adding the support for 64-bits code * Adding several hooking technique: * Detour * JumpRedirect * HotPatch * Trampoline * Adding a trampoline memory pool (64-bits) and release the allocated memory in unittests Cleanup: * Adding unittests for 64-bits hooking techniques * Enhancing the RoundUpInstruction by sharing common decoder Reviewers: rnk Subscribers: llvm-commits, wang0109, chrisha Differential Revision: http://reviews.llvm.org/D22111 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275123 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11remove empty linesEtienne Bergeron
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07[compiler-rt] Enhance unittest coverage for lib interceptionEtienne Bergeron
Summary: This patch is adding more unittests for testing the interception of 32-bits code. Reviewers: rnk Subscribers: llvm-commits, wang0109, chrisha Differential Revision: http://reviews.llvm.org/D22077 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274775 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06Fix cmake generation on Apple for interception unittestsEtienne Bergeron
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06[compiler-rt] Disable interception tests on AppleEtienne Bergeron
Summary: The CMake generation is not working on Apple. This patch is disabling the generation until it's fixed. Reviewers: rnk Subscribers: tberghammer, chrisha, danalbert, llvm-commits, srhines Differential Revision: http://reviews.llvm.org/D22066 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06[compilter-rt] Add unittests for interception libraryEtienne Bergeron
Summary: This patch is adding unittests for the interception library. Reviewers: rnk Subscribers: majnemer, llvm-commits, wang0109, chrisha, tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D21980 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274657 91177308-0d34-0410-b5e6-96231b3b80d8