summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer_common] Fix sha2 interceptors not to use vars in array lenMichal Gorny2018-12-191-1/+2
| | | | | | | | | | | | Fix the sha2 interceptor macros to use a constant for array parameter length rather than referencing the extern variable. Since the digest length is provided in hash name, reuse the macro parameter for it. Verify that the calculated value matches the one provided by system headers. Differential Revision: https://reviews.llvm.org/D55811 llvm-svn: 349645
* tsan: align default value of detect_deadlocks flag with actual behaviorDmitry Vyukov2018-12-191-1/+1
| | | | | | | | | | | | | | I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.) I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this This changes aligns the default value of the flag with the actual default behavior. Author: yln (Julian Lettner) Reviewed in: https://reviews.llvm.org/D55846 llvm-svn: 349609
* Don't trigger sanitizer initialization from `sysctlbyname` and `sysctl` ↵Dan Liew2018-12-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | interceptor. Summary: This fixes the `ThreadSanitizer-x86_64-iossim` testsuite which broke when r348770 (https://reviews.llvm.org/D55473) landed. The root cause of the problem is that early-on during the iOS simulator init process a call to `sysctlbyname` is issued. If the TSan initializer is triggered at this point it will eventually trigger a call to `__cxa_at_exit(...)`. This call then aborts because the library implementing this function is not yet had its initialization function called. rdar://problem/46696934 Reviewers: kubamracek, george.karpenkov, devnexen, vitalybuka, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55711 llvm-svn: 349402
* [Sanitizer] capsicum variadic api subsetDavid Carlier2018-12-171-0/+72
| | | | | | | | | | Reviewers: markj, vitalybuka Reviewed By: markj Differential Revision: https://reviews.llvm.org/D55714 llvm-svn: 349392
* Enable SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP for NetBSDKamil Rytarowski2018-12-151-1/+1
| | | | llvm-svn: 349262
* Fix internal_sleep() for NetBSDKamil Rytarowski2018-12-151-1/+1
| | | | | | This is a follow up of a similar fix for Linux from D55692. llvm-svn: 349257
* Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, ↵Dan Liew2018-12-145-12/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `FlatByteMap`, and `TwoLevelByteMap`. Summary: This is a follow up patch to r346956 for the `SizeClassAllocator32` allocator. This patch makes `AddressSpaceView` a template parameter both to the `ByteMap` implementations (but makes `LocalAddressSpaceView` the default), some `AP32` implementations and is used in `SizeClassAllocator32`. The actual changes to `ByteMap` implementations and `SizeClassAllocator32` are very simple. However the patch is large because it requires changing all the `AP32` definitions, and users of those definitions. For ASan and LSan we make `AP32` and `ByteMap` templateds type that take a single `AddressSpaceView` argument. This has been done because we will instantiate the allocator with a type that isn't `LocalAddressSpaceView` in the future patches. For the allocators used in the other sanitizers (i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is hard coded because we do not intend to instantiate the allocators with any other type. In the cases where untemplated types have become templated on a single `AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has been changed to have a `ASVT` suffix (Address Space View Type) to indicate they are templated. The only exception to this are the `AP32` types due to the desire to keep the type name as short as possible. In order to check that template is instantiated in the correct a way a `static_assert(...)` has been added that checks that the `AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h` header. rdar://problem/45284065 Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov Subscribers: mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D54904 llvm-svn: 349138
* [sanitizer] Fix nolibc internal_sleepFangrui Song2018-12-141-1/+1
| | | | | | | | | | | | Reviewers: kubamracek, vitalybuka Reviewed By: vitalybuka Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D55692 llvm-svn: 349134
* Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"Evgeniy Stepanov2018-12-131-5/+5
| | | | | | | | Breaks sanitizer-android buildbot. This reverts commit 85e02baff327e7b67ea5b47897302901abb2aa5d. llvm-svn: 349093
* Implement a small subset of the C++ `type_traits` header inside ↵Dan Liew2018-12-133-0/+73
| | | | | | | | | | | | | | | | | | sanitizer_common so we can avoid depending on system C++ headers. Summary: In particular we implement the `is_same<T,U>` templated type. This is useful for doing compile-time comparison of types in `static_assert`s. The plan is to use this in another patch ( https://reviews.llvm.org/D54904 ). Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov Subscribers: mgorny, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54951 llvm-svn: 349077
* [Sanitizer] capsicum further support of the APIDavid Carlier2018-12-131-0/+53
| | | | | | | | | | Reviewers: vitalybuka, krytarowski, emaste Reviewed By: emaste Differential Revision: https://reviews.llvm.org/D55622 llvm-svn: 349042
* Add a new interceptors for cdbr(3) and cdbw(3) API from NetBSDKamil Rytarowski2018-12-133-0/+220
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: cdb - formats of the constant database. cdbr, cdbr_open, cdbr_open_mem, cdbr_entries, cdbr_get, cdbr_find, cdbr_close - constant database access methods. cdbw_open, cdbw_put, cdbw_put_data, cdbw_put_key, cdbw_stable_seeder, cdbw_output, cdbw_close - creates constant databases. Add a dedicated test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55167 llvm-svn: 349021
* Add new interceptors for vis(3) API in NetBSDKamil Rytarowski2018-12-134-0/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for the NetBSD style of vis(3) present inside libc: - vis - nvis - strvis - stravis - strnvis - strvisx - strnvisx - strenvisx - svis - snvis - strsvis - strsnvis - strsvisx - strsnvisx - strsenvisx - unvis - strunvis - strnunvis - strunvisx - strnunvisx Add a dedicated test verifying the installed interceptors. Based on original work by Yang Zheng. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54594 llvm-svn: 349018
* Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)Ryan Prichard2018-12-121-5/+5
| | | | | | | | | | | | | | | | | | | | Summary: The TLS_SLOT_TSAN slot is available starting in N, but its location (8) is incompatible with the proposed solution for implementing ELF TLS on Android (i.e. bump ARM/AArch64 alignment to reserve an 8-word TCB). Instead, starting in Q, Bionic replaced TLS_SLOT_DLERROR(6) with TLS_SLOT_SANITIZER(6). Switch compiler-rt to the new slot. Reviewers: eugenis, srhines, enh Reviewed By: eugenis Subscribers: ruiu, srhines, kubamracek, javed.absar, kristof.beyls, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D55581 llvm-svn: 348984
* [Sanitizer] Expand FSEEK interception to FreeBSDDavid Carlier2018-12-113-1/+3
| | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55556 llvm-svn: 348888
* [Sanitizer] expand sysctl/getmntinfo/nl_langinfo to DarwinDavid Carlier2018-12-101-3/+3
| | | | | | | | | | Reviewers: vitalybuka, krytarowski, kubamracek Reviewed By: vitalybuka, krytarowski Differential Revision: https://reviews.llvm.org/D55473 llvm-svn: 348770
* Add data types needed for md2(3)/NetBSD interceptorsKamil Rytarowski2018-12-102-0/+6
| | | | | | Missing part of D55469. llvm-svn: 348747
* Add interceptors for the sha2(3) from NetBSDKamil Rytarowski2018-12-104-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: SHA224_Init, SHA224_Update, SHA224_Final, SHA224_End, SHA224_File, SHA224_FileChunk, SHA224_Data, SHA256_Init, SHA256_Update, SHA256_Final, SHA256_End, SHA256_File, SHA256_FileChunk, SHA256_Data, SHA384_Init, SHA384_Update, SHA384_Final, SHA384_End, SHA384_File, SHA384_FileChunk, SHA384_Data, SHA512_Init, SHA512_Update, SHA512_Final, SHA512_End, SHA512_File, SHA512_FileChunk, SHA512_Data – calculates the NIST Secure Hash Standard (version 2) Add tests for new interceptors. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54987 llvm-svn: 348745
* Add interceptors for md2(3) from NetBSDKamil Rytarowski2018-12-102-0/+79
| | | | | | | | | | | | | | | | | | | | Summary: MD2Init, MD2Update, MD2Final, MD2End, MD2File, MD2Data - calculates the RSA Data Security, Inc., "MD2" message digest. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55469 llvm-svn: 348744
* Add new interceptors for FILE repositioning streamKamil Rytarowski2018-12-104-0/+61
| | | | | | | | | | | | | | | | | | | | | | Summary: Add new interceptors for a set of functions to reposition a stream: fgetpos, fseek, fseeko, fsetpos, ftell, ftello, rewind . Add a dedicated test. Enable this interface on NetBSD. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55471 llvm-svn: 348743
* Revert a chunk of previous change in sanitizer_platform_limits_netbsd.hKamil Rytarowski2018-12-081-2/+0
| | | | | | | Undefining INLINE breaks the build. The invalid change in this file has been overlooked in D55386. llvm-svn: 348680
* Add interceptors for md5(3) from NetBSDKamil Rytarowski2018-12-084-0/+85
| | | | | | | | | | | | | | | | | | | | Summary: MD5Init, MD5Update, MD5Final, MD5End, MD5File, MD5Data - calculates the RSA Data Security, Inc., "MD5" message digest. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54993 llvm-svn: 348679
* Add interceptors for the rmd160(3) from NetBSDKamil Rytarowski2018-12-084-0/+101
| | | | | | | | | | | | | | | | | | | | Summary: RMD160Init, RMD160Update, RMD160Final, RMD160Transform, RMD160End, RMD160File, RMD160Data - calculates the ``RIPEMD-160'' message digest. Add a dedicated test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54991 llvm-svn: 348678
* Add interceptors for the md4(3) from NetBSDKamil Rytarowski2018-12-084-0/+85
| | | | | | | | | | | | | | | | | | | | Summary: MD4Init, MD4Update, MD4Final, MD4End, MD4File, MD4Data - calculates the RSA Data Security, Inc., "MD4" message digest. Add dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54990 llvm-svn: 348677
* Add interceptors for the sha1(3) from NetBSDKamil Rytarowski2018-12-084-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for: - SHA1Init - SHA1Update - SHA1Final - SHA1Transform - SHA1End - SHA1File - SHA1FileChunk - SHA1Data Add a dedicated regression test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: mgorny, llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54927 llvm-svn: 348676
* [sanitizer] Suppress lint warning conflicting with clang-formatVitaly Buka2018-12-081-1/+2
| | | | llvm-svn: 348673
* Fix style.David Carlier2018-12-081-1/+1
| | | | llvm-svn: 348672
* Conflict fixes from previous commits.David Carlier2018-12-082-1/+51
| | | | llvm-svn: 348669
* [Sanitizer] capsicum api subset interceptionDavid Carlier2018-12-081-0/+1
| | | | | | | | | | | | - For the moment a subset of this api dealing with file descriptors permissions and ioctls. Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D55368 llvm-svn: 348668
* Add interceptors for the strtoi(3)/strtou(3) from NetBSDKamil Rytarowski2018-12-072-0/+33
| | | | | | | | | | | | | | | | | | | | | | | Summary: strtoi/strtou converts string value to an intmax_t/uintmax_t integer. Add a dedicated test. Enable this API for NetBSD. It's a reworked version of the original work by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, tomsun.0.7, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54702 llvm-svn: 348663
* Add a new interceptors for statvfs1(2) and fstatvfs1(2) from NetBSDKamil Rytarowski2018-12-072-1/+36
| | | | | | | | | | | | | | | | | | | | | Summary: statvfs1, fstatvfs1 - get file system statistics. While there, use file descriptor related macros in the fstatvfs interceptor. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: dvyukov, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55031 llvm-svn: 348656
* Add a new interceptor for fparseln(3) from NetBSDKamil Rytarowski2018-12-072-0/+26
| | | | | | | | | | | | | | | | | | | Summary: fparseln - returns the next logical line from a stream. Add a dedicated test for this API. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55019 llvm-svn: 348654
* Add new interceptor for strtonum(3)Kamil Rytarowski2018-12-072-0/+26
| | | | | | | | | | | | | | | | | | | | | | | Summary: strtonum(3) reliably convertss string value to an integer. This function is used in OpenBSD compat namespace and is located inside NetBSD's libc. Add a dedicated test for this interface. It's a reworked version of the original code by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54527 llvm-svn: 348651
* Missing freebsd files.David Carlier2018-12-072-0/+1159
| | | | | | | A lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc A lib/sanitizer_common/sanitizer_platform_limits_freebsd.h llvm-svn: 348635
* [Sanitizer] Separate FreeBSD interception data structuresDavid Carlier2018-12-078-160/+52
| | | | | | | | | | Reviewers: vitalybuka, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55386 llvm-svn: 348634
* [Sanitizer] getmntinfo support in FreeBSDDavid Carlier2018-12-062-1/+5
| | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55354 llvm-svn: 348500
* Add new `__sanitizer_mz_default_zone()` API which returns the address of the ↵Dan Liew2018-12-061-0/+7
| | | | | | | | | | | | | | | | ASan malloc zone. This API will be used for testing in future patches. Summary: The name of the function is based on `malloc_default_zone()` found in Darwin's `malloc/malloc.h` header file. Reviewers: kubamracek, george.karpenkov Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55064 llvm-svn: 348481
* [Sanitizer] nl_langinfo forgotten bit.David Carlier2018-12-051-1/+1
| | | | | | M lib/sanitizer_common/sanitizer_platform_interceptors.h llvm-svn: 348377
* Add a new interceptor for modctl(2) from NetBSDKamil Rytarowski2018-12-054-1/+71
| | | | | | | | | | | | | | | | | | | Summary: modctl - controls loadable kernel modules. Skip tests as this call uses privileged operations. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55025 llvm-svn: 348370
* Add a new interceptor for nl_langinfo(3) from NetBSDKamil Rytarowski2018-12-052-0/+15
| | | | | | | | | | | | | | | | | | | Summary: nl_langinfo - gets locale information. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55015 llvm-svn: 348369
* Update GET_LINK_MAP_BY_DLOPEN_HANDLE() for NetBSD x86Kamil Rytarowski2018-12-051-2/+2
| | | | | | | | | | NetBSD 8.99.26 changed the layout of internal structure returned by dlopen(3), switch to it. Set new values for amd64 and i386 based on the results of &((struct Struct_Obj_Entry*)0)->linkmap. llvm-svn: 348329
* Unbreak build due to style.David Carlier2018-12-041-1/+2
| | | | llvm-svn: 348295
* [Sanitizer] intercept part of sysctl ApiDavid Carlier2018-12-043-39/+63
| | | | | | | | | | | | | - Distringuish what FreeBSD/NetBSD can and NetBSD specifics. - Fixing page size value collection. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55265 llvm-svn: 348293
* [SanitizerCommon] Test `CombinedAllocator::ForEachChunk()` in unit tests.Dan Liew2018-12-041-0/+16
| | | | | | | | | | | | | | Summary: Previously we weren't testing this function in the unit tests. Reviewers: kcc, cryptoad, dvyukov, eugenis, kubamracek Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54861 llvm-svn: 348260
* [compiler-rt] Use the new zx_futex_wait for Fuchsia sanitizer runtimePetr Hosek2018-12-041-2/+3
| | | | | | | | | This finishes the soft-transition to the new primitive that implements priority inheritance. Differential Revision: https://reviews.llvm.org/D55244 llvm-svn: 348236
* Improve the regerror(3) interceptorKamil Rytarowski2018-12-041-2/+2
| | | | | | | | | The res returned value might differ with REAL(strlen)(errbuf) + 1, as the buffer's value is limited with errbuf_size. Hot fix for D54584. llvm-svn: 348231
* Add interceptors for the sysctl(3) API family from NetBSDKamil Rytarowski2018-12-042-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add new interceptors for: - sysctl - sysctlbyname - sysctlgetmibinfo - sysctlnametomib - asysctl - asysctlbyname Cover the API with a new test file TestCases/NetBSD/sysctl.cc. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: devnexen, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54076 llvm-svn: 348228
* Add interceptors for the fts(3) API family from NetBSDKamil Rytarowski2018-12-044-0/+80
| | | | | | | | | | | | | | | | | | | | | | | Summary: fts(3) is API to traverse a file hierarchy. Cover this interface with interceptors. Add a test to validate the interface reading the number of regular files in /etc. Based on original work by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54247 llvm-svn: 348227
* Add new interceptor for regex(3) in NetBSDKamil Rytarowski2018-12-044-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for the NetBSD style of regex(3) present inside libc: - regcomp - regexec - regerror - regfree - regnsub - regasub Add a dedicated test verifying the installed interceptors. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54584 llvm-svn: 348224
* [SanitizerCommon] Remove RenameFileEugene Leviant2018-12-034-17/+0
| | | | | | | | | This function seems to be no longer used by compiler-rt libraries Differential revision: https://reviews.llvm.org/D55123 llvm-svn: 348140
OpenPOWER on IntegriCloud