summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Improve macOS version detectionKuba Mracek2018-10-262-21/+30
| | | | | | Part of <https://reviews.llvm.org/D48445>. llvm-svn: 345406
* [sanitizer] Fix mallopt interceptor.Evgeniy Stepanov2018-10-255-5/+5
| | | | | | On error, mallopt is supposed to return 0, not -1. llvm-svn: 345323
* [sanitizer] Avoid calling a nullptr in MonotonicNanoTime if interceptors are ↵Kuba Mracek2018-10-241-2/+5
| | | | | | | | | | not yet initialized There's a TSan startup crash on Linux when used in Swift programs, where MonotonicNanoTime will try to call real_clock_gettime and then jump to NULL because interceptors are not yet initialized. This is on Ubuntu 18.04. Looks like TSan's main Initialize() function is called at a point where __progname is already set, but interceptors aren't yet set up. Let's fix this by checking whether interceptors are initialized in MonotonicNanoTime. Differential Revision: https://reviews.llvm.org/D53528 llvm-svn: 345174
* [hwasan] when printing a stack-related bugs, also print stack frame ↵Kostya Serebryany2018-10-243-3/+20
| | | | | | descriptions provided by the compiler llvm-svn: 345110
* [hwasan] add stack frame descriptions.Kostya Serebryany2018-10-232-0/+23
| | | | | | | | | | | | | | | | | | | Summary: At compile-time, create an array of {PC,HumanReadableStackFrameDescription} for every function that has an instrumented frame, and pass this array to the run-time at the module-init time. Similar to how we handle pc-table in SanitizerCoverage. The run-time is dummy, will add the actual logic in later commits. Reviewers: morehouse, eugenis Reviewed By: eugenis Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D53227 llvm-svn: 344985
* [interception] Switch to _type suffix instead of _f, NFC.Kuba Mracek2018-10-222-2/+2
| | | | | | | | Some Darwin functions have pairs like dispatch_apply and dispatch_apply_f so the added _f to interceptor types causes a clash. Let's add _type suffix instead. Differential Revision: https://reviews.llvm.org/D53167 llvm-svn: 344954
* [XRay] Account for virtual memory re-useDean Michael Berris2018-10-221-3/+1
| | | | | | | Change the assumption when releasing memory to a buffer queue that new generations might not be able to re-use the memory mapped addresses. llvm-svn: 344882
* [XRay][compiler-rt] Generational Buffer ManagementDean Michael Berris2018-10-224-64/+238
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This change updates the buffer queue implementation to support using a generation number to identify the lifetime of buffers. This first part introduces the notion of the generation number, without changing the way we handle the buffers yet. What's missing here is the cleanup of the buffers. Ideally we'll keep the two most recent generations. We need to ensure that before we do any writes to the buffers, that we check the generation number(s) first. Those changes will follow-on from this change. Depends on D52588. Reviewers: mboerger, eizan Subscribers: llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D52974 llvm-svn: 344881
* [XRay] Handle allocator exhaustion in segmented arrayDean Michael Berris2018-10-223-5/+48
| | | | | | | | | | | | | | | | | Summary: This change allows us to handle allocator exhaustion properly in the segmented array implementation. Before this change, we relied on the caller of the `trim` function to provide a valid number of elements to trim. This change allows us to do the right thing in case the elements to trim is greater than the size of the container. Reviewers: mboerger, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D53484 llvm-svn: 344880
* [Sanitizer] openbsd does not have sysctlbyname callDavid Carlier2018-10-212-5/+9
| | | | | | | | | | | | Enabling only for FreeBSD. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D53413 llvm-svn: 344876
* [X86][compiler-rt] Add additional CPUs and features to the cpu detection to ↵Craig Topper2018-10-201-35/+78
| | | | | | | | | | | | | | | | match libgcc Summary: This patch adds additional features and cpus from libgcc. Unfortunately we've overflowed the existing 32-bits of features so we had to add a new __cpu_features2 variable to hold the additional bits. This matches libgcc as far as I can tell. Reviewers: echristo Reviewed By: echristo Subscribers: dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D53461 llvm-svn: 344830
* Revert commit r344670 as the test fails on a bot ↵Douglas Yung2018-10-194-233/+62
| | | | | | http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/2683/. llvm-svn: 344771
* [XRay][compiler-rt] Generational Buffer ManagementDean Michael Berris2018-10-174-62/+233
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This change updates the buffer queue implementation to support using a generation number to identify the lifetime of buffers. This first part introduces the notion of the generation number, without changing the way we handle the buffers yet. What's missing here is the cleanup of the buffers. Ideally we'll keep the two most recent generations. We need to ensure that before we do any writes to the buffers, that we check the generation number(s) first. Those changes will follow-on from this change. Depends on D52588. Reviewers: mboerger, eizan Subscribers: llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D52974 llvm-svn: 344670
* [XRay] Use fully qualified name for LogWriterPetr Hosek2018-10-161-1/+1
| | | | | | This avoids the build error in newer versions of GCC. llvm-svn: 344579
* [XRay] Encapsulate all FD log related logic into a classPetr Hosek2018-10-165-105/+84
| | | | | | | | | | This abstracts away the file descriptor related logic which makes it easier to port XRay to platform that don't use file descriptors or file system for writing the log data, such as Fuchsia. Differential Revision: https://reviews.llvm.org/D52161 llvm-svn: 344578
* [XRay][compiler-rt] FDR Mode ControllerDean Michael Berris2018-10-158-29/+758
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change implements a controller for abstracting away the details of what happens when tracing with FDR mode. This controller type allows us to test in isolation the various cases where we're encountering function entry, exit, and other kinds of events we are handling when FDR mode is enabled. This change introduces a number of testing facilities we've needed to better support expressing the conditions we need for the unit tests. We leave some TODOs for moving those utilities into the LLVM project, sitting in the `Testing` library, to make matching conditions on XRay `Trace` instances through googlemock more manageable and declarative. We don't wire in the controller right away, to allow us to incrementally update the implementation(s) as we increase testing coverage of the controller type. There's a need to re-think the way we're managing buffers in a multi-threaded environment, which is more invasive than this implementation. This step in the process allows us to encode our assumptions in the implementation of the controller, and then evolve the buffer queue implementation to support generational buffer management to ensure we can continue to support the cases we're already supporting with the controller. Reviewers: mboerger, eizan Subscribers: mgorny, llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D52588 llvm-svn: 344488
* [libfuzzer][Windows] Silence linker warning in unittestJonathan Metzman2018-10-141-3/+1
| | | | | | | | | | | | | | | | Summary: Silence warning when linking unittest binary by not passing -lstdc++ to the linker since it is ignored. Reviewers: morehouse Reviewed By: morehouse Subscribers: mgorny Differential Revision: https://reviews.llvm.org/D53225 llvm-svn: 344480
* [sanitizer] Avoid extra newlines in syslog.Evgeniy Stepanov2018-10-121-7/+10
| | | | | | | Fix line splitting logic to avoid sending empty lines to syslog, as that adds extra newlines. llvm-svn: 344426
* [TSan] Cleanup TSan runtime support for Go on linux-aarch64. NFC.Arnaud A. de Grandmaison2018-10-121-28/+10
| | | | | | | | | | | | | | | This is a follow-up patch to r342541. After further investigations, only 48bits VMA size can be supported. As this is enforced in function InitializePlatformEarly from lib/rt1/tsan_platform_linux.cc, the access to the global variable vmaSize variable + switch can be removed. This also addresses a comment from https://reviews.llvm.org/D52167. vmaSize of 39 or 42bits are not compatible with a Go program memory layout as the Go heap will not fit in the shadow memory area. Patch by: Fangming Fang <Fangming.Fang@arm.com> llvm-svn: 344329
* [compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into ↵Roman Lebedev2018-10-113-10/+33
| | | | | | | | | | | | | | | | unsigned and signed checks Summary: This is compiler-rt part. clang part is D50901. Reviewers: rsmith, vsk, filcab, Sanitizers Reviewed by: filcab Differential Revision: https://reviews.llvm.org/D50902 llvm-svn: 344231
* [hwasan] more compact printing for 'Previosly allocated frames'Kostya Serebryany2018-10-111-4/+11
| | | | llvm-svn: 344210
* [hwasan] when reporting a bug, print some very basic information about the ↵Kostya Serebryany2018-10-103-6/+31
| | | | | | heap chunk (in addition to the more detailed info that we may fail to show) llvm-svn: 344193
* [hwasan] print all threads in a bug reportKostya Serebryany2018-10-101-1/+4
| | | | llvm-svn: 344174
* [hwasan] print more tags around the buggy address, and do it with a single ↵Kostya Serebryany2018-10-101-4/+3
| | | | | | Printf llvm-svn: 344169
* [sanitizers] [windows] Use a linker directive pragma for psapiMartin Storsjo2018-10-102-1/+4
| | | | | | | | | | | | | This allows users of static libraries (such as ubsan) to link without knowing about this transitive dependency, if using the psapi functions that require linking to a separate psapi library. Since Windows 7, these functions (EnumProcessModules, GetModuleInformation, GetProcessMemoryInfo) are remapped to K32- prefixed ones, available in kernel32.dll. Differential Revision: https://reviews.llvm.org/D53012 llvm-svn: 344126
* [libFuzzer] Generalize the code for getting the previous offset for ↵George Karpenkov2018-10-101-13/+33
| | | | | | | | | | | | | different architectures Without this change, tests in coverage.test and dump_coverage.test are failing on non-x86_64 platforms. The diff is copied from sanitizer_common library, an alternative would be to link it together with libFuzzer. Differential Revision: https://reviews.llvm.org/D53040 llvm-svn: 344104
* [compiler-rt] Remove unused formal parameters from allocateOneNode. NFC.Matt Davis2018-10-091-3/+2
| | | | | | | | | | | | | | Summary: This is just a minor cleanup to the allocateOneNode interface. The formals are no-longer used, so I just removed them. Reviewers: davidxl, void Reviewed By: davidxl Subscribers: dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D52509 llvm-svn: 344073
* Disable failing tests lib/asan/tests on NetBSDKamil Rytarowski2018-10-092-0/+4
| | | | | | These isses are not analyzed. llvm-svn: 344045
* Skip unsupported MSan tests on NetBSDKamil Rytarowski2018-10-091-0/+4
| | | | | | libm functions remquol and lgammal are missing on NetBSD. llvm-svn: 344042
* Remove remnant code of using indirect syscall on NetBSDKamil Rytarowski2018-10-085-66/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The NetBSD version of internal routines no longer call the indirect syscall interfaces, as these functions were switched to lib calls. Remove the remnant code complication that is no longer needed after this change. Remove the variations of internal_syscall, as they were NetBSD specific. No functional change intended. Reviewers: vitalybuka, joerg, javed.absar Reviewed By: vitalybuka Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D52955 llvm-svn: 343988
* [Sanitizer] fix internal_sysctlbyname build for FreeBSD.David Carlier2018-10-081-1/+1
| | | | llvm-svn: 343964
* Revert r343606/r342652 "[winasan] Unpoison the stack in NtTerminateThread""Reid Kleckner2018-10-051-11/+1
| | | | | | This still seems to be causing pnacl + asan to crash. llvm-svn: 343876
* Unwind local macro DEFINE_INTERNAL()Kamil Rytarowski2018-10-051-47/+43
| | | | | | | | No functional change intended. This is a follow up of a suggestion from D52793. llvm-svn: 343870
* Introduce internal_sysctlbyname in place of sysctlbynameKamil Rytarowski2018-10-055-6/+33
| | | | | | | | | | | | | | | | | | Summary: This change will allow to install sysctlbyname() interceptors more easily in sanitizers. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D52793 llvm-svn: 343840
* Esan for FreeBSD, forgotten file.David Carlier2018-10-041-0/+35
| | | | llvm-svn: 343815
* [Esan] Port cache frag to FreeBSDDavid Carlier2018-10-045-6/+23
| | | | | | | | | | | | Data involving struct accesses accounting work (plan to support only efficiency-cache-frag flag in the frontend side). Reviewers: krytarowski, vitalybuka, jfb Reviewed By : vitalybuka Differential Revision: https://reviews.llvm.org/D52608 llvm-svn: 343812
* [hwasan] Fix top PC in error stack trace being off by 1 instruction.Evgeniy Stepanov2018-10-021-4/+4
| | | | | | | | | | | | | | | Summary: GetStackTrace treats top PC as a return address from an error reporting function, and adjusts it down by 1 instruction. This is not necessary in a signal handler, so adjust PC up to compensate. Reviewers: kcc, vitalybuka, jfb Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D52802 llvm-svn: 343638
* [lib/fuzzer] Fix logging for FuchsiaPetr Hosek2018-10-022-8/+17
| | | | | | | | | | | | | | | | | This change fixes two aspects of logging on Fuchsia: 1. When logging to stdout, the output file descriptor should not be closed in ExecuteCommand, as it prevent fdio_spawn_etc from succeeding in subsequent calls. 2. When logging to a file in anything other than standalone Zircon, the log file needs to be created in mutable storage. The best indicator where this is relative to the Fuchsia component will be given by '-artifact_prefix=...', so save the log file relative to that path. Patch by: aarongreen Differential Revision: https://reviews.llvm.org/D52562 llvm-svn: 343607
* Reland r342652 "[winasan] Unpoison the stack in NtTerminateThread"David Major2018-10-021-1/+11
| | | | | | | | In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall. Differential Revision: https://reviews.llvm.org/D52091 llvm-svn: 343606
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-5/+19
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343605
* [Arm builtins] Remove non-necessary IS checkKristina Brooks2018-10-022-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the instruction set check to make the msr APSR_nzcvq, ip instruction only execute if Thumb2 is used. The APSR is a subset of the bits of the CPSR (B.1.3.3 of the Arm v7 A and R ARM [1]) and is only available for A and R profiles. However in section B.9.3.11 of the same document we see that: "In the A and R profiles, APSR_nzcvq is the same as CPSR_f" "ARM recommends the APSR forms when only the N, Z, C, V, Q, and GE[3:0] bits are being written." This patch also make those files assemble for Armv8-M Mainline architecture profile. The builtins were cross-compiled for Arm, Aarch64 and Armv6-M, Armv7-M and Armv7E-M targets. Cross-compiled tests were executed for Arm target. [1]: https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition Patch by hug-dev (Hugues de Valon). Differential Revision: https://reviews.llvm.org/D51854 llvm-svn: 343601
* Revert "[sanitizer] Include inlined frames into __sanitizer_symbolize_pc output"Jessica Paquette2018-10-021-19/+5
| | | | | | | | | This reverts r343554. It was breaking some bots: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/49997/ llvm-svn: 343600
* [sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsanStephen Hines2018-10-023-0/+24
| | | | | | | | | | | | | | | | | | Summary: This essentially reverts r337010 since it breaks UBSan, which is used for a few platform libraries. The "-z global" flag is now added for Scudo as well. The only other sanitizer shared libraries are for asan and hwasan, which have also been reinstated to use the global flag. Reviewers: cryptoad, eugenis Reviewed By: cryptoad Subscribers: kubamracek, mgorny, delcypher, #sanitizers, nickdesaulniers, chh, kongyi, pirama, llvm-commits Differential Revision: https://reviews.llvm.org/D52770 llvm-svn: 343599
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-5/+19
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343554
* Remove a path-length limitation for the xray logfile.Douglas Yung2018-10-011-3/+2
| | | | | | | | | | | | Reviewers: MaskRay Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52728 Patch by Jeremy Morse! llvm-svn: 343524
* Switch syscall(2)/__syscall(2) calls to libc calls on NetBSDKamil Rytarowski2018-10-014-51/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When possible, switch syscall(2)/__syscall(2) calls to direct calls of internal libc symbols. Add a new function to detect address of a libc symbol of a function that could be intercepted. With the address detector in GetRealLibcAddress(), an optional interceptor of libc call will be bypassed. The original approach with syscall(2)/__syscall(2) wasn't portable across supported ABIs and CPU architectures. The indirect syscall interface is also a candidate for removal in future revisions of NetBSD, as the C language ABI is not a good domain for serialization of arbitrary functions arguments. Switch the following functions to libc calls: - internal_mmap() - internal_munmap() - internal_mprotect() - internal_close() - internal_open() - internal_read() - internal_write() - internal_ftruncate() - internal_stat() - internal_lstat() - internal_fstat() - internal_dup2() - internal_readlink() - internal_unlink() - internal_rename() - internal_sched_yield() - internal__exit() - internal_sleep() - internal_execve() - NanoTime() - internal_clock_gettime() - internal_waitpid() - internal_getpid() - internal_getppid() - internal_getdents() - internal_lseek() - internal_sigaltstack() - internal_fork() - internal_sigprocmask() - internal_sysctl() - internal_sigemptyset() - internal_sigfillset() - GetTid() - TgKill() This revision leaves room for refactoring in subsequent commits. Reviewers: vitalybuka, kcc, joerg Reviewed By: vitalybuka Subscribers: mgorny, fedor.sergeev, jfb, loverszhaokai, devnexen, kubamracek, llvm-commits, ro, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D51419 llvm-svn: 343523
* Unbreak linux cfi buildDavid Carlier2018-10-011-0/+1
| | | | llvm-svn: 343512
* [Cfi] Compiling cfi library on FreeBSD and NetBSDDavid Carlier2018-10-012-7/+34
| | | | | | | | | | | | Making the library slighty more portable. Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D51682 llvm-svn: 343510
* [NFC] Fix `-Wcast-qual` warnings in Darwin `internal_sysctl(...)` ↵Dan Liew2018-10-011-2/+2
| | | | | | | | | | | | | | implementation. Summary: The warnings were introduced in r341187 and r341192. Reviewers: kubamracek, george.karpenkov, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52717 llvm-svn: 343496
* Switch sanitizer_procmaps_bsd to internal_sysctlKamil Rytarowski2018-09-291-4/+4
| | | | | | | | | | | | | | | | | | | | Summary: Stop using directly sysctl(3) routines in sanitizer_procmaps_bsd and replace it with internal_sysctl(). This will allow to install interceptors for sysctl(3). Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D52646 llvm-svn: 343370
OpenPOWER on IntegriCloud