summaryrefslogtreecommitdiff
path: root/lib/asan/asan_interceptors.h
AgeCommit message (Collapse)Author
2017-11-10[sanitizer] Remove unneeded forward declaration of real_sigactionVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[sanitizer] Remove unneeded forward declarationsVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[sanitizer] Allow sanitizers to redefine implementation of signal interceptorsVitaly Buka
Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D39870 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[sanitizer] Move signal interceptors from asan to sanitizer_commonVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D37889 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313449 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07Add NetBSD support in asan_interceptors.hKamil Rytarowski
Summary: Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, filcab, kcc, fjricci, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36375 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310246 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[asan] Interceptors for FuchsiaVitaly Buka
Summary: Fuchsia uses the "memintrinsics" interceptors, though not via any generalized interception mechanism. It doesn't use any other interceptors. Submitted on behalf of Roland McGrath. Reviewers: vitalybuka, alekseyshl, kcc Reviewed By: vitalybuka Subscribers: kubamracek, phosek, filcab, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36189 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-20[asan] Move memcpy, memmove, memset code out of asan_interceptors.ccAlex Shlyapnikov
This is a pure refactoring change. It simply moves all the code and macros related to defining the ASan interceptor versions of memcpy, memmove, and memset into a separate file. This makes it cleaner to disable all the other interceptor code while still using these three, for a port that defines these but not the other common interceptors. Reviewers: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35590 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04[ASAN] Add interceptor for __longjmp_chkPeter Wu
Summary: glibc on Linux calls __longjmp_chk instead of longjmp (or _longjmp) when _FORTIFY_SOURCE is defined. Ensure that an ASAN-instrumented program intercepts this function when a system library calls it, otherwise the stack might remain poisoned and result in CHECK failures and false positives. Fixes https://github.com/google/sanitizers/issues/721 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D32408 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302152 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-20[asan] Add __strdup interceptor.Evgeniy Stepanov
This happens on Linux when building as C (not C++) with optimization. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23[sanitizer] Add strnlen to the common interceptorsDerek Bruening
Summary: Adds strnlen to the common interceptors, under the existing flag intercept_strlen. Removes the now-duplicate strnlen interceptor from asan and msan. This adds strnlen to tsan, which previously did not intercept it. Adds a new test of strnlen to the sanitizer_common test cases. Reviewers: samsonov Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18397 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22[asan] Intercept strdup on WindowsReid Kleckner
Some unit tests were failing because we didn't intercept strdup. It turns out it works just fine on 2013 and 2015 with a small patch to the interception logic. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22[asan] Versioned interceptor for pthread_create.Evgeniy Stepanov
This fixes a crash in pthread_create on linux/i386 due to abi incompatibility between intercepted and non-intercepted functions. See the test case for more details. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-16[ASan] NFC: Factor out platform-specific interceptorsTimur Iskhodzhanov
Reviewed at http://reviews.llvm.org/D8321 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232377 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18[msan] Remove MSanDR and supporting code.Evgeniy Stepanov
MSanDR is a dynamic instrumentation tool that can instrument the code (prebuilt libraries and such) that could not be instrumented at compile time. This code is unused (to the best of our knowledge) and unmaintained, and starting to bit-rot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222232 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25[sanitizer] move mlock interceptor from asan/tsan/msan to common; no ↵Kostya Serebryany
functionality change intended git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21Follow-up for r215436: use SIZE_T for strlen and wcslen interceptors.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216184 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12[ASan] Use more appropriate return types for strlen/wcslen to avoid MSVC ↵Timur Iskhodzhanov
warnings git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215436 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-03[asan] i686-linux-android support.Evgeniy Stepanov
Large part of this change is required due to https://code.google.com/p/android/issues/detail?id=61799 dlsym() crashes when symbol resolution fails, which means we have to limit the interceptor list instead of relying on runtime detection. There are minor differencies in system headers, too. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212273 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-04[sancov] Handle fork.Evgeniy Stepanov
Reset coverage data on fork(). For memory-mapped mode (coverage_direct=1) this helps avoid loss of data (before this change two processes would write to the same file simultaneously). For normal mode, this reduces coverage dump size, because PCs from the parent process are no longer inherited by the child. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@210180 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14[asan] use some LIKELY/UNLIKELYKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208776 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04A set of trivial changes to support sanitizers on FreeBSD.Alexey Samsonov
Patch by Viktor Kutuzov! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202801 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13[asan] Enable signal and sigaction interceptors on Android.Evgeniy Stepanov
Fixes AddressSanitizer.SignalTest breakage. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201330 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-16[asan] Fix a bunch of style issues.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199380 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-26[ASan] Delete asan_intercepted_functions.h, move the code into ↵Alexander Potapenko
asan_interceptors.h Fixes https://code.google.com/p/address-sanitizer/issues/detail?id=188. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198048 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-20[sanitizer] Use the new sanitizer_interception.h header in all interceptors.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197808 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05[ASan] Delete the code related to static runtime on OS X.Alexander Potapenko
Nuke lib/interception/mach_override. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174383 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24If the program is linked to a dynamic ASan runtime which is not present in ↵Alexander Potapenko
DYLD_INSERT_LIBRARIES (which, in turn, is required for our interceptors to take effect), re-exec the program with DYLD_INSERT_LIBRARIES set. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-25Lots of trivial changes to remove extraneous semicolons throughout ASan.Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@159128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15[Sanitizer] move all the rest re-implementations of libc functions from ASan ↵Alexey Samsonov
runtime to common sanitizer runtime git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158519 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-15[Sanitizer] Use DEFINE_REAL macro in TSan runtime to call libc ↵Alexey Samsonov
implementations of functions. Move strchr to sanitizer_libc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158517 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-14[Sanitizer] Move internal_memcmp to common sanitizer libcAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158450 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-08[Sanitizer] add internal_memset and internal_strrchr to sanitizer_common/Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158202 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-06[Sanitizer] Move more functions/constants to sanitizer_common.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@158056 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-05[Sanitizer] add sanitizer_posix.cc. Move more various functions into ↵Alexey Samsonov
sanitizer_libc: sscanf, munmap, memchr git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157994 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04[Sanitizer]: move internal_strcmp to sanitizer_commonAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157926 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04[Sanitizer] Move internal_strncpy to sanitizer_libc (and make its behavior ↵Alexey Samsonov
conforming to manual) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157922 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31[asan] more renamingKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157747 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31[asan] more renamingKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157746 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-29Add internal_memset and replace the uses of REAL(memset) with it where the ↵Alexander Potapenko
performance allows. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@153641 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-21[asan] merge mac-specific interceptors into one functionAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@153180 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-21[asan]: remove asan_mac.hAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@153179 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27Introduce __asan_set_error_report_callback() to allow the client program ↵Alexander Potapenko
post-process the error reports. If the callback is set, Report() and Printf() print the reports into a buffer (together with stderr), which is then passed to the client. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@151528 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17AddressSanitizer: use custom strtol/atoll functionsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@150812 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16AddressSanitizer: revert r150683 - we can't get rid of headers that easilyAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@150699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16AddressSanitizer: don't include pthread.h and signal.h in interceptors on MacAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@150683 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14[ASan] Define an internal implementation of strchr to make stack OOB tests ↵Timur Iskhodzhanov
pass on Windows git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@150499 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08AddressSanitizer: start factoring out interception machineryAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@150083 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02AddressSanitizer: Add macro for definition/declaration of interceptorsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@149602 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-30AddressSanitizer: Enforce default visibility for all libc interceptorsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@149247 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-27Make compiler-rt/trunk/lib/asan compileable with Visual Studio 2008 on Windows.Alexander Potapenko
Patch by Timur Iskhodzhanov (timurrrr@google.com) To test: $ cl /c *.c* in the asan directory. The code fails to link if you omit the "/c" part but that's one of the next steps, as well as a few TODO's I've put into the Windows-specific code. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@149130 91177308-0d34-0410-b5e6-96231b3b80d8