summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_platform_interceptors.h
AgeCommit message (Collapse)Author
2016-03-25[sanitizer] Add memset, memmove, and memcpy to the common interceptorsDerek Bruening
Summary: Currently, sanitizer_common_interceptors.inc has an implicit, undocumented assumption that the sanitizer including it has previously declared interceptors for memset and memmove. Since the memset, memmove, and memcpy routines require interception by many sanitizers, we add them to the set of common interceptions, both to address the undocumented assumption and to speed future tool development. They are intercepted under a new flag intercept_intrin. The tsan interceptors are removed in favor of the new common versions. The asan and msan interceptors for these are more complex (they incur extra interception steps and their function bodies are exposed to the compiler) so they opt out of the common versions and keep their own. Reviewers: vitalybuka Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18465 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264451 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-21[sanitizer] Add strchr* to the common interceptorsEvgeniy Stepanov
Adds strchr, strchrnul, and strrchr to the common interceptors, under a new common flag intercept_strchr. Removes the now-duplicate strchr interceptor from asan and all 3 interceptors from tsan. Previously, asan did not intercept strchrnul, but does now; previously, msan did not intercept strchr, strchrnul, or strrchr, but does now. http://reviews.llvm.org/D18329 Patch by Derek Bruening! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11[sanitizer] Add strlen to the common interceptorsAlexey Samsonov
Summary: Adds strlen to the common interceptors, under a new common flag intercept_strlen. This provides better sharing of interception code among sanitizers and cleans up the inconsistent type declarations of the previously duplicated interceptors. Removes the now-duplicate strlen interceptor from asan, msan, and tsan. The entry check semantics are normalized now for msan and asan, whose private strlen interceptors contained multiple layers of checks that included impossible-to-reach code. The new semantics are identical to the old: bypass interception if in the middle of init or if both on Mac and not initialized; else, call the init routine and proceed. Patch by Derek Bruening! Reviewers: samsonov, vitalybuka Subscribers: llvm-commits, kcc, zhaoqin Differential Revision: http://reviews.llvm.org/D18020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25[sanitizer] Disable recv and recvfrom interceptors on Windows.Maxim Ostapenko
Trying to fix sanitizer-windows buildbot by disabling new interceptors on Windows. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25[sanitizer] Move recvmsg and recv interceptors to sanitizer_common.Maxim Ostapenko
This patch moves recv and recvfrom interceptors from MSan and TSan to sanitizer_common to enable them in ASan. Differential Revision: http://reviews.llvm.org/D17479 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19Fix -Wexpansion-to-defined warnings in compiler-rt.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14[msan] Intercept ctermid, ctermid_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05[tsan] Fix build warnings on OS XKuba Brecka
Fixing `tsan_interceptors.cc`, which on OS X produces a bunch of warnings about unused constants and functions. Differential Revision: http://reviews.llvm.org/D14381 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-26[compiler-rt] Enable ptrace sanitizer for armAdhemerval Zanella
This patch enables the ptrace syscall interceptors for arm and adds support for both PTRACE_GETVFPREGS and PTRACE_SETVFPREGS used to get the VFP register from ARM. The ptrace tests is also updated with arm and PTRACE_GETVFPREGS tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22[msan] Intercept process_vm_readv/writev.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19[msan] Intercept mincore.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19[msan] Intercept pthread_getcancel*.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250752 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16[MSan] Enable MSAN for aarch64Adhemerval Zanella
This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA. As defined by lib/msan/msan.h the memory layout used is for 39-bit is: 00 0000 0000 - 40 0000 0000: invalid 40 0000 0000 - 43 0000 0000: shadow 43 0000 0000 - 46 0000 0000: origin 46 0000 0000 - 55 0000 0000: invalid 55 0000 0000 - 56 0000 0000: app (low) 56 0000 0000 - 70 0000 0000: invalid 70 0000 0000 - 80 0000 0000: app (high) And for 42-bit VMA: 000 0000 0000 - 100 0000 0000: invalid 100 0000 0000 - 11b 0000 0000: shadow 11b 0000 0000 - 120 0000 0000: invalid 120 0000 0000 - 13b 0000 0000: origin 13b 0000 0000 - 2aa 0000 0000: invalid 2aa 0000 0000 - 2ab 0000 0000: app (low) 2ab 0000 0000 - 3f0 0000 0000: invalid 3f0 0000 0000 - 400 0000 0000: app (high) Most of tests are passing with exception of: * Linux/mallinfo.cc * chained_origin_limits.cc * dlerror.cc * param_tls_limit.cc * signal_stress_test.cc * nonnull-arg.cpp The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8' instead of default first argument 'x1'. So a function prototype that aims to mimic (by using first argument as the return of function) won't work. For GCC one can make a register alias (register var asm ("r8")), but for clang it detects is an unused variable and generate wrong code. The 'chained_origin_limits' is probably due a wrong code generation, since it fails only when origin memory is used (-fsanitize-memory-track-origins=2) and only in the returned code (return buf[50]). The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic argument handling in memory sanitizer code instrumentation on LLVM side. Both 'dlerror' and 'param_tls_test' are unknown failures that require further investigation. All the failures are XFAIL for aarch64 for now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247809 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27[sanitizer] Disable sem_* interceptors on Mac.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27[sanitizer] Move sem_* to common interceptors.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26[compiler-rt] Add common interceptor for wcrtomb. Eric Fiselier
Summary: Currently there is a libc++ test failing under MSAN because wcrtomb is not intercepted. This patch adds an interceptor for it. Reviewers: samsonov, eugenis Subscribers: tberghammer, danalbert, srhines, llvm-commits Differential Revision: http://reviews.llvm.org/D12311 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30[sanitizer] add a weak hook for memcmp interceptor, to be used primarily for ↵Kostya Serebryany
fuzzing. More hooks will be added later. So far this is a Linux-only feature git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29[asan,tsan,msan] move the memcmp interceptor from asan/tsan to ↵Kostya Serebryany
sanitizer_common. This may potentially lead to more reports from msan as it now sees the reads inside memcmp. To disable, use the flag intercept_memcmp=0. Likewise, it may potentially cause new races to appear due to more strict memcmp checking (flag strict_memcmp=1) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243595 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-25[msan] Teach sanitizers about the PPC64 ptrace syscallJay Foad
Summary: This fixes test/msan/Linux/syscalls.cc, and should also fix the ppc64 sanitizer buildbots which are currently failing in "make check-sanitizer". Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10734 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240692 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19[msan] Intercept fopencookie.Evgeniy Stepanov
https://code.google.com/p/memory-sanitizer/issues/detail?id=86 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28[sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, ↵Yury Gribov
strpbrk. Patch by Maria Guseva. Differential Revision: http://reviews.llvm.org/D9017 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@238406 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-11[Msan] Fix the if_indextoname.cc test to pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9456 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236999 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07Intercept scandir() on FreeBSDViktor Kutuzov
Committed unreviewed with premission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236720 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07Intercept rand_r() on FreeBSDViktor Kutuzov
Committed unreviewed with premission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06[Msan] Fix the ifaddrs.cc test to build and pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236579 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28[Msan] Fix the getline.cc test to pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9251 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-25[Msan] Fix the iconv.cc test to build and pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9252 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24[Msan] XFAIL the ftime.cc test on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9222 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24[Msan] Fix the backtrace.cc tests to build and pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D9221 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18[MSan][MIPS] Fix for some failing tests on MIPS64Mohit K. Bhakkad
Enabling internal ptrace for mips, which fixes some ptrace related tests. Along with this fixing some other failures. Reviewers: Reviewers: eugenis, kcc, samsonov Subscribers: dsanders, sagar, lldb-commits Differential Revision: http://reviews.llvm.org/D7332 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-04[Msan] Fix the pthread_attr_get unit test to build on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D7342 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@228125 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02[Sanitizers] Intercept ether functions on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02[Sanitizers] Intercept memrchr() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02[Sanitizers] Intercept getpwnam_r() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02[Sanitizers] Intercept getpwent_r() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227792 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-02[Sanitizers] Intercept getpwent() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227791 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-30[Sanitizers] Intercept gethost functions on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@227572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23[Sanitizers] Intercept statfs() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226910 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22[sanitizer] Intercept sched_getparam.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22[Sanitizers] Intercept preadv() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21[Sanitizers] Intercept confstr() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19[Sanitizers] Intercept statvfs() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226462 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16[Sanitizers] Intercept clock_gettime() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226276 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16[Sanitizers] Intercept lgamma_r() on FreeBSDViktor Kutuzov
Committed unreviewed with permission. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226275 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22[Sanitizers] Intercept wcsnrtombs() on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6755 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224709 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22[Sanitizers] Intercept snprintf_l() on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6418 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224700 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22[Sanitizers] Intercept wordexp on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6737 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224699 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25[Sanitizers] Intercept __tls_get_addr() and shmctl() on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6384 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@222757 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-24[Tsan] Intercept pthread_set_name_np on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D5932 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220551 91177308-0d34-0410-b5e6-96231b3b80d8