summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/interception/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix check-interception link error in compiler-rt debug modeReid Kleckner2019-10-101-1/+4
| | | | llvm-svn: 374472
* compiler-rt: Rename .cc file in lib/{interception/tests,safestack} to .cppNico Weber2019-08-014-7/+7
| | | | | | Like r367463, but for interception/tests and safestack. llvm-svn: 367560
* [compiler-rt][tests] Propagate COMPILER_RT_UNITTEST_LINK_FLAGSHubert Tong2019-05-011-0/+3
| | | | | | | | | | | | | | | | | | | | `COMPILER_RT_UNITTEST_LINK_FLAGS` is dropped in many places, unlike `COMPILER_RT_UNITTEST_CFLAGS`. This patch attempts to remove that inconsistency. Previously reviewed as part of D58951. Reviewers: sfertile, peter.smith, pzheng, phosek, Hahnfeld, nemanjai, jasonliu Reviewed By: sfertile Subscribers: jsji, kubamracek, dberris, mgorny, delcypher, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60143 llvm-svn: 359733
* [Sanitizer] Reland "Cleanup INTERCEPT_FUNCTION macro"Julian Lettner2019-05-011-10/+5
| | | | | | | | | | | | | | | | | | | | | | On Linux both version of the INTERCEPT_FUNCTION macro now return true when interception was successful. Adapt and cleanup some usages. Also note that `&(func) == &WRAP(func)` is a link-time property, but we do a runtime check. Tested on Linux and macOS. Previous attempt reverted by: 5642c3feb03d020dc06a62e3dc54f3206a97a391 This attempt to bring order to the interceptor macro goes the other direction and aligns the Linux implementation with the way things are done on Windows. Reviewed By: vitalybuka, rnk Differential Revision: https://reviews.llvm.org/D61358 llvm-svn: 359725
* Revert r359325 "[NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION ↵Reid Kleckner2019-04-301-0/+11
| | | | | | | | | | | | | | | to void" Changing INTERCEPT_FUNCTION to return void is not functionally correct. IMO the best way to communicate failure or success of interception is with a return value, not some external address comparison. This change was also creating link errors for _except_handler4_common, which is exported from ucrtbase.dll in 32-bit Windows. Also revert dependent changes r359362 and r359466. llvm-svn: 359611
* [NFC][Sanitizer] Remove GetRealFunctionAddress and replace usagesJulian Lettner2019-04-271-11/+0
| | | | | | | | Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D61205 llvm-svn: 359362
* [Sanitizer] Fix testJulian Lettner2019-04-261-0/+2
| | | | | | | I broke the build, panicked and applied the wrong fix in my previous commit. The ASSERT was obsolete, but not the call INTERCEPT_FUNCTION. llvm-svn: 359336
* [Sanitizer] Fix compliation error in testJulian Lettner2019-04-261-2/+0
| | | | | | | Remove obsolete assert. I missed this in my previous patch: https://reviews.llvm.org/D61145 llvm-svn: 359335
* [NFC][Sanitizer] Extract GetFuncAddr from GetRealFunctionAddressJulian Lettner2019-04-251-0/+5
| | | | | | | | | | | | | | Summary: Hopefully, this will enable cleanup/removal of GetRealFunctionAddress in follow-up commits. Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61110 llvm-svn: 359213
* Commit macro intended to be included in r353483.Reid Kleckner2019-02-071-1/+1
| | | | llvm-svn: 353484
* [compiler rt] Win64 GetInstructionSize additional register MOV + stack ↵Reid Kleckner2019-02-071-2/+23
| | | | | | | | | | | | | | | | | | | | | | | alignment AND Current interception code does not cover all of the required registers on Windows for a specific flavor of MOV, so this patch adds cases to identify the following 5-byte instructions on 64-bit Windows: mov QWORD PTR [rsp + XX], rdx <- second integer argument mov QWORD PTR [rsp + XX], r9 <- third integer argument mov QWORD PTR [rsp + XX], r8 <- fourth integer argument The instruction for MOV [...] RCX is already covered in the previous version. Patch by Matthew McGovern! Reviewers: rnk Differential Revision: https://reviews.llvm.org/D57339 llvm-svn: 353483
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-193-12/+9
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [cmake] [interception] Remove duplicate gtest from test COMPILE_DEPSMichal Gorny2017-10-121-1/+1
| | | | | | | | | | | | | 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 llvm-svn: 315605
* [sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov2017-08-151-27/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 310971
* [sanitizers] Sanitizer tests CMake clean up: try #2George Karpenkov2017-07-281-15/+2
| | | | | | | | | | | | | | | | | 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 llvm-svn: 309341
* Revert "[sanitizers] Sanitizer tests CMake clean up"George Karpenkov2017-07-271-2/+15
| | | | | | | | This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a. Fails on some bots, reverting until I can fix it. llvm-svn: 309318
* [sanitizers] Sanitizer tests CMake clean upGeorge Karpenkov2017-07-271-15/+2
| | | | | | | | | | | | | | | | | 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 llvm-svn: 309306
* [WinASan] Fix hotpatching new Win 10 build 1703 x64 strnlen prologueReid Kleckner2017-06-161-0/+11
| | | | | | | | | | | 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
* [interception] Check for export table's size before referring to its elements.Marcos Pividori2017-01-301-0/+7
| | | | | | | | | | | | 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 llvm-svn: 293521
* [asan] Don't assert that a target is within 2GB on 32-bit WindowsReid Kleckner2016-11-152-6/+26
| | | | | | | | | | | | | | | | 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 llvm-svn: 286997
* [interception] Avoid duplicate declaration of isdigit in testJonas Hahnfeld2016-09-141-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D24504 llvm-svn: 281486
* [compilter-rt] Try to fix correctly rL277560Etienne Bergeron2016-08-031-4/+0
| | | | | rL277560: [compiler-rt] Fix broken interception unittest llvm-svn: 277567
* [compiler-rt] Fix broken interception unittestEtienne Bergeron2016-08-031-0/+4
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 277560
* [asan] Intercept RtlRaiseException instead of kernel32!RaiseExceptionReid Kleckner2016-08-021-0/+8
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 277518
* Fix broken build botEtienne Bergeron2016-07-281-2/+1
| | | | | | | The address resolution is ussing RTLD_NEXT and not RTLD_DEFAULT. Which means &func may not be equivalent to dlsym("func"). llvm-svn: 276951
* [asan] Fix interception unittest on Windows64.Etienne Bergeron2016-07-121-0/+10
| | | | | | | | | | | | | 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 llvm-svn: 275207
* missing modifications for http://reviews.llvm.org/D21952Etienne Bergeron2016-07-111-1/+2
| | | | llvm-svn: 275124
* [compiler-rt] Refactor the interception code on windows.Etienne Bergeron2016-07-111-69/+428
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 275123
* remove empty linesEtienne Bergeron2016-07-111-2/+0
| | | | llvm-svn: 275112
* [compiler-rt] Enhance unittest coverage for lib interceptionEtienne Bergeron2016-07-071-15/+96
| | | | | | | | | | | | | | 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 llvm-svn: 274775
* Fix cmake generation on Apple for interception unittestsEtienne Bergeron2016-07-061-2/+0
| | | | llvm-svn: 274671
* [compiler-rt] Disable interception tests on AppleEtienne Bergeron2016-07-061-3/+1
| | | | | | | | | | | | | | | 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 llvm-svn: 274667
* [compilter-rt] Add unittests for interception libraryEtienne Bergeron2016-07-064-0/+376
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 llvm-svn: 274657
OpenPOWER on IntegriCloud