summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Commit message (Collapse)AuthorAgeFilesLines
* [msan] Fix underflow in qsort interceptor.Evgenii Stepanov2020-01-061-10/+14
|
* [msan] Check qsort input.Evgenii Stepanov2020-01-061-0/+14
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* Reland "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-271-0/+71
| | | | | | | This reverts commit 8fcce5ac73d49981656d9126e6c88391c1f6bf01. I spoke too soon, the revert does not actually cause the startup crash to go away.
* Revert "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-271-71/+0
| | | | | | | | | | | | | | | | | | | This reverts commit 7a9ebe95125ea87a494d0c18f44f10bd70e12188, and dependent commit 54c522420347e58aa7bae1892cf5c5672b57c875, which disables qsort interception for some iOS platforms. After this change, the -Nolibc sanitizer common test binary crashes on startup on my regular Linux workstation, as well as on our bots: https://ci.chromium.org/p/chromium/builders/try/linux_upload_clang/740 ******************** Failing Tests (1): SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test/SanitizerCommon.NolibcMain Loading it up in gdb shows that it crashes during relocation processing, which suggests that some glibc loader versions do not support the THREADLOCAL data added in this interceptor.
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* Temporarily Revert "[compiler-rt] [netbsd] Add support for versioned statvfs ↵Eric Christopher2019-12-261-8/+1
| | | | | | | | | | | interceptors" as it's failing the netbsd specific linter parts of the sanitizer linter: llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc:23: Lines should be <= 80 characters long [whitespace/line_length] llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:2450: Do not use variable-length arrays. Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size. This reverts commit 78f714f824fac8aa3fdd85908c41538bccefb959.
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* Revert "[msan] Check qsort input."Evgenii Stepanov2019-12-261-18/+0
| | | | | | | | | | | | | This change breaks LLVM bootstrap with ASan and MSan. FAILED: lib/ToolDrivers/llvm-lib/Options.inc OptParser.td:137:1: error: Option is equivalent to def INPUT : Option<[], "<input>", KIND_INPUT>; ^ OptParser.td:137:1: error: Other defined here def INPUT : Option<[], "<input>", KIND_INPUT>; This reverts commit caa48a6b88aeed8ae80e6ddb1eae8c6a7cbe260b.
* [msan] Check qsort input.Evgenii Stepanov2019-12-231-0/+18
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-231-0/+71
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* Revert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."Jonas Devlieghere2019-12-201-89/+0
| | | | | | | | | | | | | | Temporarily revert the qsort changes because they fail to build on bots that build with modules: > error: thread-local storage is not supported for the current > target (iossim) http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/1820/console http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/4983/console This reverts commit ddf897fc80499ece298bc33201db6b697d2af50e. This reverts commit 07861e955d0095f25639d84c5726c73b528567cb.
* [msan] Check qsort input.Evgenii Stepanov2019-12-201-0/+18
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-201-0/+71
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* Don't forward __pthread_mutex_* interceptors to pthread_mutex_* versionVitaly Buka2019-11-221-2/+18
| | | | | | | | | | | | | | | Summary: Allows to use rr with asan Fixes PR41095 Reviewers: eugenis Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D70581
* [Sanitizers] Porting getrandom/getentropy interceptors to FreeBSDDavid Carlier2019-10-101-0/+16
| | | | | | | | | | | | | - Available from 12.x branch, by the time it lands next year in FreeBSD tree, the 11.x's might be EOL. - Intentionally changed the getrandom test to C code as with 12.0 (might be fixed in CURRENT since), there is a linkage issue in C++ context. Reviewers: emaste, dim, vitalybuka Reviewed-By: vitalybuka Differential Revision: https://reviews.llvm.org/D68451 llvm-svn: 374315
* [msan] Add interceptors: crypt, crypt_r.Evgeniy Stepanov2019-10-081-0/+37
| | | | | | | | | | | | Reviewers: vitalybuka Subscribers: srhines, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68431 llvm-svn: 373993
* Add __lsan::ScopedInterceptorDisabler for strerror(3)Kamil Rytarowski2019-09-211-0/+6
| | | | | | | | | | | | | | | | | | | | Summary: strerror(3) on NetBSD uses internally TSD with a destructor that is never fired for exit(3). It's correctly called for pthread_exit(3) scenarios. This is a case when a leak on exit(3) is expected, unavoidable and harmless. Reviewers: joerg, vitalybuka, dvyukov, mgorny Reviewed By: vitalybuka Subscribers: dmgreen, kristof.beyls, jfb, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D67337 llvm-svn: 372461
* [compiler-rt] Remove some cpplint filtersVitaly Buka2019-09-121-16/+19
| | | | llvm-svn: 371704
* Remove NOLINTs from compiler-rtVitaly Buka2019-09-111-13/+11
| | | | llvm-svn: 371687
* [compiler-rt] Implement getrandom interceptionVitaly Buka2019-08-061-0/+16
| | | | | | | | | | | | | | | | | | | | | | | Summary: Straightforward implementation of `getrandom` syscall and libc hooks. Test Plan: Local MSAN failures caused by uninstrumented `getrandom` calls stop failing. Patch by Andrew Krieger. Reviewers: eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, kubamracek, dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65551 llvm-svn: 367999
* Don't initialize interceptor_metadata_map unless SI_POSIX is setEugene Leviant2019-07-281-1/+3
| | | | | | Differential revision: https://reviews.llvm.org/D64794 llvm-svn: 367188
* [ASan] Support `{f}puts(NULL)` on Darwin, part 2Julian Lettner2019-07-181-2/+4
| | | | | | | Add braces around macro `{ MACRO(); }` to guard against macros that expand to multiple statements. llvm-svn: 366488
* [ASan] Support `{f}puts(NULL)` on DarwinJulian Lettner2019-07-171-2/+4
| | | | | | | | | | | | | On Darwin, the man page states that "both fputs() and puts() print `(null)' if str is NULL." rdar://48227136 Reviewed By: Lekensteyn Differential Revision: https://reviews.llvm.org/D64773 llvm-svn: 366342
* [Sanitizer] Add interceptor for wcsdupPavel Labath2019-05-221-0/+18
| | | | | | | | | | | | | | Summary: The wide-string equivalent of strdup. Implementation trivial. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D62189 llvm-svn: 361357
* [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptorPavel Labath2019-04-081-7/+10
| | | | | | | | | | | | | | | | | | Summary: r357240 added an interceptor for wctomb, which uses a temporary local buffer to make sure we don't write to unallocated memory. This patch applies the same technique to wcrtomb, and adds some additional tests for this function. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59984 llvm-svn: 357889
* [Sanitizer] Add interceptor for wctombPavel Labath2019-03-291-0/+23
| | | | | | | | | | | | | | | | | Summary: This is required to avoid msan false positives for code using this function (although generally one should avoid using this function in favor of wcrtomb). Reviewers: eugenis, EricWF, vitalybuka Subscribers: srhines, kubamracek, fedor.sergeev, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59548 llvm-svn: 357240
* [sanitizer] Intercept bzero.Evgeniy Stepanov2019-03-041-1/+11
| | | | | | | | | | | | | | | | Summary: Intercept bzero and enable existing __bzero interceptor in Linux. bzero is deprecated but still used occasionally. Reviewers: vitalybuka Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58850 llvm-svn: 355347
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-021-35/+27
| | | | | | | | | Breaks TSan on Mac, which does return REAL(func)(... in COMMON_INTERCEPTOR_ENTER, which is not OK when REAL(func) has return type of void. llvm-svn: 355256
* [sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.Evgeniy Stepanov2019-03-011-27/+35
| | | | llvm-svn: 355231
* Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."Evgeniy Stepanov2019-03-011-16/+13
| | | | | | This change is incomplete. llvm-svn: 355230
* [sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.Evgeniy Stepanov2019-03-011-13/+16
| | | | | | They return void, unlike memset/memcpy/memmove. llvm-svn: 355225
* [msan] Add an interceptor for ttyname().Evgeniy Stepanov2019-03-011-0/+15
| | | | llvm-svn: 355214
* Reland "[compiler-rt] Intercept the bcmp() function."Clement Courbet2019-03-011-7/+28
| | | | | | | Fix test issues on darwin: The REQUIRES for the test should be the same as the guard for whether we intercept bcmp. llvm-svn: 355204
* Revert "[compiler-rt] Intercept the bcmp() function."Vlad Tsyrklevich2019-02-261-28/+7
| | | | | | | This reverts commits r354851, 354852, 354853 and r354888. They were causing build failures on the android sanitizer bot. llvm-svn: 354906
* [Sanitizer] Add interceptor for pthread_sigmaskPavel Labath2019-02-261-0/+20
| | | | | | | | | | | | | | | | | | | | | | Summary: pthread_sigmask is just like sigprocmask, except that its behavior in multithreaded programs is explicitly specified. Sanitizers were lacking a common interceptor for pthread_sigmask (although some specific sanitizers defined custom version), which lead to false positives (at least in msan) when using this function. The interceptor implementation, and its test are based on the equivalent code for sigprocmask. Reviewers: eugenis, vitalybuka Subscribers: kubamracek, delcypher, jfb, jdoerfert, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58382 llvm-svn: 354874
* [compiler-rt] Intercept the bcmp() function.Clement Courbet2019-02-261-7/+28
| | | | | | | | | | | | | | | | | | | | | Summary: I have not introduced a separate hook for `bcmp()` as I don't think there should be any reason for a sanitizer to treat it differently from `memcmp()`. This is only enabled when building on POSIX with GNU extensions. Context: this is to avoid losing coverage when emitting `bcmp() == 0` instead of `memcmp() == 0` in llvm, see https://reviews.llvm.org/D56593. Reviewers: mgorny, krytarowski, vitalybuka, dvyukov Subscribers: kubamracek, dberris, delcypher, jdoerfert, #sanitizers, llvm-commits, jyknight Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58379 llvm-svn: 354851
* [sanitizer] Remove unneeded pointer checkVitaly Buka2019-02-071-16/+16
| | | | | | | | | | | | | | Summary: unpoison_passwd and unpoison_group support nullptrs Reviewers: eugenis Subscribers: kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D57784 llvm-svn: 353365
* [sanitizer] Don't unpoison buffer in getpw/getgr functionsVitaly Buka2019-02-071-52/+36
| | | | | | | | | | | | | | | | | Summary: Buffer should be referenced by results so used parts will be unpoisoned with unpoison_group and unpoison_passwd. This fixes TSAN performance issue made us to disable this interceptors. Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, krytarowski, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D57731 llvm-svn: 353351
* [sanitizer] Fix unused function 'unpoison_passwd'Vitaly Buka2019-02-051-12/+4
| | | | llvm-svn: 353205
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [Sanitizer] Intercept sl_add api on FreeBSD/NetBSDDavid Carlier2019-01-151-0/+54
| | | | | | | | | | Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56670 llvm-svn: 351189
* [Sanitizer] Intercept getusershellDavid Carlier2019-01-111-0/+16
| | | | | | | | | | | | - If entries are properly copied (there were a bug in FreeBSD implementation in earlier version), or list properly reset. Reviewers: vitalybuka, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56562 llvm-svn: 350919
* [sanitizer_common] Define __sanitizer_FILE on NetBSDMichal Gorny2019-01-101-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D56109 llvm-svn: 350882
* i[Sanitizer] Enable pututxline interceptionDavid Carlier2019-01-101-1/+13
| | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56495 llvm-svn: 350796
* [Sanitizer] Intercept fdevname on FreeBSDDavid Carlier2019-01-081-0/+35
| | | | | | | | | | | | | - Is a file descriptor flavor FreeBSD's specific. - reentrant version included. Reviewers: vitalybuka, krytarowski, emaste Reviewed By: emaste Differential Revision: https://reviews.llvm.org/D56268 llvm-svn: 350658
* [sanitizer_common] Implement funopen*() interceptors for NetBSDMichal Gorny2019-01-021-0/+162
| | | | | | Differential Revision: https://reviews.llvm.org/D56158 llvm-svn: 350233
* [sanitizer_common] Implement popen, popenve, pclose interceptorsMichal Gorny2019-01-021-0/+74
| | | | | | | | | | | | | | | Implement the interceptors for popen(), pclose() and popenve() functions. The first two are POSIX, the third one is specific to NetBSD. popen() spawns a process and creates a FILE object piping data from/to that process. pclose() closes the pipe and waits for the process to terminate appropriately. For the purpose of popen(), the COMMON_INTERCEPTOR_FILE_OPEN macro is modified to allow null path parameter. Differential Revision: https://reviews.llvm.org/D56157 llvm-svn: 350232
* [sanitizer_common] Fix devname_r() return type on !NetBSDMichal Gorny2019-01-021-4/+11
| | | | | | | | | | Update the interceptor for devname_r() to account for correct return types on different platforms. This function returns int on NetBSD but char* on FreeBSD/OSX. Noticed by @krytarowski. Differential Revision: https://reviews.llvm.org/D56150 llvm-svn: 350228
* [Sanitizer] Intercept arc4random_buf / arc4random_addrandom on FreeBSD/NetBSDDavid Carlier2018-12-281-0/+26
| | | | | | | | | | | | | | | - Disabled on purpose on Android and Darwin platform (for now). - Darwin supports it, would need interception in its specific code before enabling it. - Linux does not support it but only via third party library. - Android supports it via bionic however it is known to have issue with older versions of the implementations. Can be enabled by an Android committer later on if necessary once there is more 'certainity'/been more tested. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56125 llvm-svn: 350123
* [Sanitizer] Add fstab api to FreeBSD/LinuxDavid Carlier2018-12-271-0/+40
| | | | | | | | | | | | Interception of /etc/fstab function parsers. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56099 llvm-svn: 350099
OpenPOWER on IntegriCloud