summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement a large part of NetBSD syscalls of netbsd_syscall_hooks.hKamil Rytarowski2018-02-151-1/+3688
| | | | | | | | | | This is a follow up of: r325206 - Add NetBSD syscall hooks skeleton in sanitizers Sponsored by <The NetBSD Foundation> llvm-svn: 325248
* Enable syscall-specific functions in TSan/NetBSDKamil Rytarowski2018-02-151-1/+1
| | | | | | | | | | | | | NetBSD ships now with netbsd_syscall_hooks.h and requires support for TSan specific features to be enabled. This is follow up of: D42048: Add NetBSD syscall hooks skeleton in sanitizers Sponsored by <The NetBSD Foundation> llvm-svn: 325245
* Add Xray instrumentation support to FreeBSDKamil Rytarowski2018-02-158-18/+49
| | | | | | | | | | | | | | | | | | | Summary: - Enabling the build. - Using assembly for the cpuid parts. - Using thr_self FreeBSD call to get the thread id Patch by: David CARLIER Reviewers: dberris, rnk, krytarowski Reviewed By: dberris, krytarowski Subscribers: emaste, stevecheckoway, nglevin, srhines, kubamracek, dberris, mgorny, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43278 llvm-svn: 325240
* Teach sanitizer about NetBSD specific ioctl(2) callsKamil Rytarowski2018-02-156-205/+5169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Introduce handling of 1200 NetBSD specific ioctl(2) calls. Over 100 operations are disabled as unavailable or conflicting with the existing ones (the same operation number). Add a script that generates the rules to detect ioctls on NetBSD. The generate_netbsd_ioctls.awk script has been written in NetBSD awk(1) (patched nawk) and is compatible with gawk. Generate lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc with the awk(1) script. Update sanitizer_platform_limits_netbsd accordingly to add the needed definitions. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, dvyukov Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, fedor.sergeev, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41636 llvm-svn: 325212
* Prevent recursive MSan interceptors in strftime(3) like functionsKamil Rytarowski2018-02-151-0/+1
| | | | | | | | | | | | | | | | | | | Summary: This corrects intercepting this call on NetBSD without false positives. Sponsored by <The NetBSD Foundation> Reviewers: joerg, eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42883 llvm-svn: 325208
* Prevent recursive MSan interceptors in fgets(3)Kamil Rytarowski2018-02-151-0/+1
| | | | | | | | | | | | | | | | | | | Summary: This corrects intercepting this call on NetBSD without false positives. Sponsored by <The NetBSD Foundation> Reviewers: joerg, eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42884 llvm-svn: 325207
* Add NetBSD syscall hooks skeleton in sanitizersKamil Rytarowski2018-02-157-0/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implement the skeleton of NetBSD syscall hooks for use with sanitizers. Add a script that generates the rules to handle syscalls on NetBSD: generate_netbsd_syscalls.awk. It has been written in NetBSD awk(1) (patched nawk) and is compatible with gawk. Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h that is a public header for applications, and included as: <sanitizer_common/sanitizer_platform_limits_netbsd.h>. Generate sanitizer_syscalls_netbsd.inc that defines all the syscall rules for NetBSD. This file is modeled after the Linux specific file: sanitizer_common_syscalls.inc. Start recognizing NetBSD syscalls with existing sanitizers: ASan, ESan, HWASan, TSan, MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, dvyukov, eugenis Reviewed By: vitalybuka Subscribers: hintonda, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42048 llvm-svn: 325206
* Add new interceptor: lstat(2)Kamil Rytarowski2018-02-152-0/+19
| | | | | | | | | | | | | | | | | | | | | Summary: lstat - get file status Use it on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42909 llvm-svn: 325199
* [libFuzzer] Set -experimental_len_control=1000 as default.Matt Morehouse2018-02-134-6/+9
| | | | | | | | | | | | | | | | | | | | Summary: Experiments using https://github.com/google/fuzzer-test-suite/tree/master/engine-comparison show a significant increase in coverage and reduction in corpus size with this option enabled. Addresses https://llvm.org/pr36371. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42932 llvm-svn: 325050
* [sanitizer] Implement GetRSS on WindowsKostya Kortchinsky2018-02-131-1/+4
| | | | | | | | | | | | | | | | | | Summary: Pretty straightforward, returning the `WorkingSetSize` of a `PROCESS_MEMORY_COUNTERS` structure. AFAIU, `GetProcessMemoryInfo` is in `kernel32.lib` for Windows 7 and above. Support for earlier Windows versions would require `psapi.lib`, but I don't think those are supported by ASan? Reviewers: alekseyshl, rnk, vitalybuka Reviewed By: vitalybuka Subscribers: vitalybuka, kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42822 llvm-svn: 325020
* [sanitizer] Size class map & local cache improvementsKostya Kortchinsky2018-02-123-40/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - Reland rL324263, this time allowing for a compile-time decision as to whether or not use the 32-bit division. A single test is using a class map covering a maximum size greater than 4GB, this can be checked via the template parameters, and allows SizeClassAllocator64PopulateFreeListOOM to pass; - `MaxCachedHint` is always called on a class id for which we have already computed the size, but we still recompute `Size(class_id)`. Change the prototype of the function to work on sizes instead of class ids. This also allows us to get rid of the `kBatchClassID` special case. Update the callers accordingly; - `InitCache` and `Drain` will start iterating at index 1: index 0 contents are unused and can safely be left to be 0. Plus we do not pay the cost of going through an `UNLIKELY` in `MaxCachedHint`, and touching memory that is otherwise not used; - `const` some variables in the areas modified; - Remove an spurious extra line at the end of a file. Reviewers: alekseyshl, tl0gic, dberris Reviewed By: alekseyshl, dberris Subscribers: dberris, kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43088 llvm-svn: 324906
* Revert r324847, there's bot failures.Kuba Mracek2018-02-116-82/+93
| | | | llvm-svn: 324849
* [sanitizer] Implement NanoTime() on DarwinKuba Mracek2018-02-111-2/+12
| | | | | | | | Currently NanoTime() on Darwin is unimplemented and always returns 0. Looks like there's quite a few things broken because of that (TSan periodic memory flush, ASan allocator releasing pages back to the OS). Let's fix that. Differential Revision: https://reviews.llvm.org/D40665 llvm-svn: 324847
* [compiler-rt] Replace forkpty with posix_spawnKuba Mracek2018-02-116-93/+82
| | | | | | | | | | On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork or forkpty has, e.g. that after fork, interceptors are still active and this sometimes causes crashes or hangs. This is especially problematic for TSan, which uses interceptors for OS-provided locks and mutexes, and even Libc functions use those. This patch replaces forkpty with posix_spawn. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Additionally, this also fixes a latent threading problem with ptsname (it's unsafe to use this function in multithreaded programs). Yet another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now. Differential Revision: https://reviews.llvm.org/D40032 llvm-svn: 324846
* [XRay] Rename Buffer.Buffer to Buffer.DataDean Michael Berris2018-02-105-18/+18
| | | | | | | | | | | | | | | | | | Summary: some compiler (msvc) treats Buffer.Buffer as constructor and refuse to compile. NFC Authored by comicfans44. Reviewers: rnk, dberris Reviewed By: dberris Subscribers: llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40346 llvm-svn: 324807
* [scudo] Allow options to be defined at compile timeKostya Kortchinsky2018-02-085-11/+18
| | | | | | | | | | | | | | | | Summary: Allow for options to be defined at compile time, like is already the case for other sanitizers, via `SCUDO_DEFAULT_OPTIONS`. Reviewers: alekseyshl, dberris Reviewed By: alekseyshl, dberris Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42980 llvm-svn: 324620
* [builtins] Workaround for infinite recursion in c?zdi2Jonas Devlieghere2018-02-082-0/+12
| | | | | | | | | | | gcc resolves `__builtin_c?z` to `__c?zdi2` which leads to infinite recursion. This problem has been observed for sparc64, mips64 and riscv. Presumably this happens whenever an arch without dedicated bit counting instructions is targeted. This patch provides a workaround. Differential revision: https://reviews.llvm.org/D42902 llvm-svn: 324593
* [asan] Fix filename size on linux platforms.Yvan Roux2018-02-071-1/+2
| | | | | | | | | | | | This is a a fix for: https://bugs.llvm.org/show_bug.cgi?id=35996 Use filename limits from system headers to be synchronized with what LD_PRELOAD can handle. Differential Revision: https://reviews.llvm.org/D42900 llvm-svn: 324496
* Correct a bug in GetArgsAndEnv() for NetBSDKamil Rytarowski2018-02-071-2/+1
| | | | | | Fix setting envp. llvm-svn: 324481
* [Fuzzer] Use Zircon's public API on FuchsiaPetr Hosek2018-02-071-31/+43
| | | | | | | | | | The original libFuzzer Fuchsia port relied on convenience libraries, but these are not exported as part of Fuchsia sysroot. This change eliminates the use of these libraries and relies on public API only. Differential Revision: https://reviews.llvm.org/D42996 llvm-svn: 324454
* [Sanitizers, Darwin] Disable SANITIZER_SUPPORTS_WEAK_HOOKS before Mac OS X 10.9Vitaly Buka2018-02-051-1/+7
| | | | | | | | | | | | | | | | | | Summary: Before Xcode 4.5, undefined weak symbols don't work reliably on Darwin: https://stackoverflow.com/questions/6009321/weak-symbol-link-on-mac-os-x Therefore this patch disables their use before Mac OS X 10.9 which is the first version only supported by Xcode 4.5 and above. Reviewers: glider, kcc, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41346 llvm-svn: 324284
* [sanitizer] Revert rL324263Kostya Kortchinsky2018-02-051-3/+2
| | | | | | | | | | | | | | Summary: The 32-bit division breaks SizeClassAllocator64PopulateFreeListOOM which uses Primary that has a maximum size > 32-bit. Reviewers: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42928 llvm-svn: 324268
* [sanitizer] SizeClassMap minor improvement/correctness changesKostya Kortchinsky2018-02-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In `ClassID`, make sure we use an unsigned as based for the `lbits` shift. The previous code resulted in spurious sign extensions like for x64: ``` add esi, 0FFFFFFFFh movsxd rcx, esi and rcx, r15 ``` The code with the `U` added is: ``` add esi, 0FFFFFFFFh and rsi, r15 ``` And for `MaxCachedHint`, use a 32-bit division instead of `64-bit`, which is faster (https://lemire.me/blog/2017/11/16/fast-exact-integer-divisions-using-floating-point-operations/) and already used in other parts of the code (64-bit `GetChunkIdx`, 32-bit `GetMetaData` enforce 32-bit divisions) Not major performance gains by any mean, but they don't hurt. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42916 llvm-svn: 324263
* [sanitizer] Allocator local cache improvementsKostya Kortchinsky2018-02-051-34/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Here are a few improvements proposed for the local cache: - `InitCache` always read from `per_class_[1]` in the fast path. This was not ideal as we are working with `per_class_[class_id]`. The latter offers the same property we are looking for (eg: `max_count != 0` means initialized), so we might as well use it and keep our memory accesses local to the same `per_class_` element. So change `InitCache` to take the current `PerClass` as an argument. This also makes the fast-path assembly of `Deallocate` a lot more compact; - Change the 32-bit `Refill` & `Drain` functions to mimic their 64-bit counterparts, by passing the current `PerClass` as an argument. This saves some array computations; - As far as I can tell, `InitCache` has no place in `Drain`: it's either called from `Deallocate` which calls `InitCache`, or from the "upper" `Drain` which checks for `c->count` to be greater than 0 (strictly). So remove it there. - Move the `stats_` updates to after we are done with the `per_class_` accesses in an attempt to preserve locality once more; - Change some `CHECK` to `DCHECK`: I don't think the ones changed belonged in the fast path and seemed to be overly cautious failsafes; - Mark some variables as `const`. The overall result is cleaner more compact fast path generated code, and some performance gains with Scudo (and likely other Sanitizers). Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42851 llvm-svn: 324257
* Handle NetBSD symbol mangling devname -> __devname50Kamil Rytarowski2018-02-051-0/+1
| | | | llvm-svn: 324240
* Add new NetBSD interceptors: devname(3), devname_r(3)Kamil Rytarowski2018-02-022-0/+35
| | | | | | | | | | | | | | | | | | | Summary: devname, devname_r - get device name Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42053 llvm-svn: 324120
* Correct the return value of strlcat(3) in the interceptorKamil Rytarowski2018-02-021-5/+4
| | | | | | | | | Late fix for SVN r. 324034 Add new interceptors: strlcpy(3) and strlcat(3) There was forgotten an addition of len to the return value. llvm-svn: 324091
* Add new interceptors: strlcpy(3) and strlcat(3)Kamil Rytarowski2018-02-012-1/+37
| | | | | | | | | | | | | | | | | | | | | | Summary: NetBSD ships with strlcpy(3) and strlcat(3), a safe replacement of strcpy(3) and strcat(3). Hide both functions under SANITIZER_INTERCEPT_STRLCPY. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42061 llvm-svn: 324034
* [sanitizer] Implement NanoTime & MonotonicNanoTime for WindowsKostya Kortchinsky2018-02-012-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Implement `MonotonicNanoTime` using `QueryPerformanceCounter`. This function is used by Scudo & the 64-bit Primary allocator. Implementing it now means that the release-to-OS mechanism of the Primary will kick in (it never did since the function returned 0 always), but `ReleaseMemoryPagesToOS` is still not currently implemented for Windows. Performance wise, this adds a syscall & a 64-bit division per call to `MonotonicNanoTime` so the impact might not be negligible, but I don't think there is a way around it. Reviewers: rnk, alekseyshl, amccarth Reviewed By: alekseyshl, amccarth Subscribers: amccarth, flowerhack, kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42579 llvm-svn: 324011
* [scudo] Minor Secondary changesKostya Kortchinsky2018-02-011-8/+8
| | | | | | | | | | | | | | | | | | | Summary: Few changes to the secondary: - mark `const` variables as such; - change some `CHECK` to `DCHECK`: I don't feel we need to be as conservative as we were with out checks, as they are the results of our own computation. - mark a condition as `UNLIKELY`. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42696 llvm-svn: 323997
* Make detect_invalid_pointer_pairs option to be tristate.Alex Shlyapnikov2018-02-012-4/+8
| | | | | | | | | | | | | | | | Summary: With the change, one can choose not to report comparison (or subtraction) of a pointer with nullptr pointer. Reviewers: kcc, jakubjelinek, alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D41479 llvm-svn: 323995
* [CMake] Remove -stdlib= which is unused when passing -nostdinc++Jonas Hahnfeld2018-02-012-0/+5
| | | | | | | | | This avoids the warnings when building with LLVM_ENABLE_LIBCXX which automatically adds -stdlib=libc++ to CMAKE_CXX_FLAGS. Differential Revision: https://reviews.llvm.org/D42238 llvm-svn: 323969
* [XRay][compiler-rt+llvm] Update XRay register stashing semanticsDean Michael Berris2018-02-011-41/+49
| | | | | | | | | | | | | | | | | | | | | | Summary: This change expands the amount of registers stashed by the entry and `__xray_CustomEvent` trampolines. We've found that since the `__xray_CustomEvent` trampoline calls can show up in situations where the scratch registers are being used, and since we don't typically want to affect the code-gen around the disabled `__xray_customevent(...)` intrinsic calls, that we need to save and restore the state of even the scratch registers in the handling of these custom events. Reviewers: pcc, pelikan, dblaikie, eizan, kpw, echristo, chandlerc Reviewed By: echristo Subscribers: chandlerc, echristo, hiraditya, davide, dblaikie, llvm-commits Differential Revision: https://reviews.llvm.org/D40894 llvm-svn: 323940
* [sanitizer] Fix tests on Android and DarwinVitaly Buka2018-01-301-3/+10
| | | | llvm-svn: 323834
* [fuzzer] Update and enable libFuzzer on FuchsiaPetr Hosek2018-01-301-3/+3
| | | | | | | | | | | | | This change updates the Fuchsia-specific code to use the C++ friendly duration expressions and flips on the building of libclang_rt.fuzzer-x86_64.a and similar for Fuchsia. Given that compiler-rt doesn't build on Fuchsia, test have been run by explicitly building the library and linking it against lib/fuzzer/tests/FuzzerUnittest.cpp. Differential Revision: https://reviews.llvm.org/D42670 llvm-svn: 323828
* [sanitizer] Add interceptors for readlinkat, name_to_handle_at, ↵Vitaly Buka2018-01-305-10/+116
| | | | | | | | | | | | | | | | | | | | | open_by_handle_at Summary: Also move existing readlink msan interceptor to sanitizer_common. Fixes google/sanitizers#908 Patch by Oliver Chang Reviewers: vitalybuka, eugenis Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42630 llvm-svn: 323825
* [libFuzzer] Fix sizeof(ptr) bug.Matt Morehouse2018-01-301-1/+1
| | | | | | | sizeof(const char *) returns 4 or 8 when what we really want is the size of the array. llvm-svn: 323802
* [scudo] Add default implementations for weak functionsKostya Kortchinsky2018-01-303-2/+22
| | | | | | | | | | | | | | | | Summary: This is in preparation for platforms where `SANITIZER_SUPPORTS_WEAK_HOOKS` is 0. They require a default implementation. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42557 llvm-svn: 323795
* [sanitizer] Update from zx_time_get to zx_clock_getPetr Hosek2018-01-271-2/+2
| | | | | | | | This Zircon syscall was renamed. Differential Revision: https://reviews.llvm.org/D42617 llvm-svn: 323611
* [NFC] fix trivial typos in comments and documentsHiroshi Inoue2018-01-261-1/+1
| | | | | | "in in" -> "in", "on on" -> "on" etc. llvm-svn: 323510
* [scudo] Overhaul malloc related interceptorsKostya Kortchinsky2018-01-253-72/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow-up to D42506. There are a few of things that bothered me about `scudo_interceptors.cpp`: - the filename is a misnomer: it intercepts some functions, but the rest (C++) is actually in `scudo_new_delete.cpp`. I feel like `scudo_malloc.cpp` is more appropriate (ASan uses the same naming scheme); - we do not need "full" interceptors, since we are never accessing the unsanitized version of the functions, we just need the `extern "C" INTERCEPTOR_ATTRIBUTE` part of it to just call our functions; - a couple of functions where duplicated while they could just be `ALIAS`'d; - use the `SANITIZER_INTERCEPT_*` defines to hide the unneeded interceptors; - use `SIZE_T` instead of `uptr`: while it's the same behind the curtain, the former is meant for this use case. In the end there is no functional change on the currently supported platforms (Linux, Android). Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: mgorny, hintonda, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42546 llvm-svn: 323464
* [sanitizer] Implement GetNumberOfCPUs for WindowsKostya Kortchinsky2018-01-251-2/+3
| | | | | | | | | | | | | | | | | Summary: Implement `GetNumberOfCPUs` using `GetNativeSystemInfo`. The only consummer of this function is Scudo which is not functional on Windows yet. Reviewers: rnk, zturner Reviewed By: zturner Subscribers: zturner, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42547 llvm-svn: 323462
* Correct typo in TSan codeKamil Rytarowski2018-01-251-3/+3
| | | | | | | | We wrongly enabled additional (unwanted) branch for NetBSD. Noted by Vlad Tsyrklevich llvm-svn: 323413
* [scudo] Remove SANITIZER_LINUX requirement for the malloc interceptorsKostya Kortchinsky2018-01-241-6/+1
| | | | | | | | | | | | | | | | | | | | Summary: Currently all platforms are using the `scudo_interceptors.cpp` interceptors. We might to come up with platform specific interceptors when/if we get Apple & Windows, but as of now, that allows for Fuchsia to use them. `scudo_new_delete.cpp` didn't have the `#if SANITIZER_LINUX` so it's good to go. Reviewers: alekseyshl, flowerhack Reviewed By: flowerhack Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42506 llvm-svn: 323386
* [builtins] Align addresses to cache lines in __clear_cache for aarch64Martin Storsjo2018-01-241-2/+4
| | | | | | | | | | | | This makes sure that the last cache line gets invalidated properly. This matches the example code at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/BABJDBHI.html, and also matches what libgcc does. Differential Revision: https://reviews.llvm.org/D42196 llvm-svn: 323315
* Break a line into <= 80 charactersKamil Rytarowski2018-01-231-1/+2
| | | | llvm-svn: 323279
* [scudo] Allow for weak hooks, gated by a defineKostya Kortchinsky2018-01-232-2/+10
| | | | | | | | | | | | | | | | | | | | | | Summary: Hooks in the allocation & deallocation paths can be a security risk (see for an example https://scarybeastsecurity.blogspot.com/2016/11/0day-exploit-advancing-exploitation.html which used the glibc's __free_hook to complete exploitation). But some users have expressed a need for them, even if only for tests and memory benchmarks. So allow for `__sanitizer_malloc_hook` & `__sanitizer_free_hook` to be called if defined, and gate them behind a global define `SCUDO_CAN_USE_HOOKS` defaulting to 0. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42430 llvm-svn: 323278
* Add a new interceptor: paccept(2)Kamil Rytarowski2018-01-232-0/+25
| | | | | | | | | | | | | | | | | | | Summary: paccept(2) is a NetBSD-specific variation of accept(2). Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42052 llvm-svn: 323273
* [ubsan] Add preinit initializer for ubsanFrancis Ricci2018-01-233-2/+48
| | | | | | | | | | | | | | | | | | | | Summary: Now that ubsan does function interception (for signals), we need to ensure that ubsan is initialized before any library constructors are called. Otherwise, if a constructor calls sigaction, ubsan will intercept in an unitialized state, which will cause a crash. This patch is a partial revert of r317757, which removed preinit arrays for ubsan. Reviewers: vitalybuka, eugenis, pcc Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42389 llvm-svn: 323249
* [ubsan] Disable signal handling on Android.Evgeniy Stepanov2018-01-221-4/+19
| | | | | | | | | | | | Summary: See rationale in the comments. Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D42329 llvm-svn: 323142
OpenPOWER on IntegriCloud