Commit Graph

10872 Commits

Author SHA1 Message Date
Marco Castelluccio c8d94f3847 [GCOV] Make test path generic so it passes on all machines
llvm-svn: 345656
2018-10-30 21:43:47 +00:00
Kamil Rytarowski 5786b9fe88 Switch getline_nohang from XFAIL to UNSUPPORTED for NetBSD
This test sometimes works, usually breaks.

llvm-svn: 345655
2018-10-30 21:41:31 +00:00
Kamil Rytarowski 9e5016a384 Mark vptr-non-unique-typeinfo as a broken test for NetBSD/i386
llvm-svn: 345654
2018-10-30 21:39:45 +00:00
Kamil Rytarowski 3b59f89a56 Mark breaking sanitizer_common tests on NetBSD
Set XFAIL with appropriate configuration for:
 - NetBSD/getgroupmembership
 - Posix/dedup_token_length_test
 - Posix/readlinkat
 - get_module_and_offset_for_pc

llvm-svn: 345651
2018-10-30 21:20:17 +00:00
Reid Kleckner 96b823418d [builtins] Re-enable x86-only long double tests
Summary:
In r81552, the HAS_80_BIT_LONG_DOUBLE macro was added to the unit test
only version of int_lib.h. One month later in r85260 the duplicate
int_lib.h was removed, but the tests still passed because we don't build
with -Werror.

This is the minimal change to bring it back, and I decided to put the
configuration macro next to our 128-bit integer support macro.

Reviewers: joerg, compnerd, mstorsjo

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D53838

llvm-svn: 345645
2018-10-30 20:51:27 +00:00
Petr Hosek 0bd1a0fac1 [CMake] Check -ffreestanding as C not C++ flag
When -ffreestanding is used, main() isn't considered special and
when compiled as C++ code it'll get mangled which makes the
compilation fail since main() will be undefined so this check will
never succeed.

Differential Revision: https://reviews.llvm.org/D49332

llvm-svn: 345632
2018-10-30 19:19:47 +00:00
Kamil Rytarowski df8802da7a Handle NetBSD alias for pthread_sigmask
Summary:
Add a new helper macro TSAN_INTERCEPTOR_NETBSD_ALIAS_THR2
that handles pthread(3)/libc aliases in scenarios when a name in both
libraries differs not just in prefix namespace.

Handle TSan pthread_sigmask mangling accordingly into __libc_thr_sigsetmask.

Reviewers: vitalybuka, joerg

Reviewed By: vitalybuka

Subscribers: kubamracek, jfb, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D53863

llvm-svn: 345627
2018-10-30 18:49:19 +00:00
Calixte Denizet 4b0c66deb3 [GCOV] Add a test for function defined on one line (follow-up of https://reviews.llvm.org/D53600)
Summary: Add a test for coverage for function definition like void foo() { }.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D53601

llvm-svn: 345625
2018-10-30 18:41:41 +00:00
Kamil Rytarowski 98f1dd0bd5 Cast the return value of _Unwind_GetIP() to uptr
This is needed for NetBSD to match the expected type in
Unwind_GetIP().

llvm-svn: 345620
2018-10-30 18:25:12 +00:00
Kamil Rytarowski d54d17b6e2 Mark interception_failure_test with XFAIL for NetBSD
This test breaks also on FreeBSD.

llvm-svn: 345619
2018-10-30 18:21:58 +00:00
Kamil Rytarowski d045b15bce Disable ASan test asan_and_llvm_coverage_test for NetBSD
Right now the LLVM profile feature is turned off for this OS.

llvm-svn: 345600
2018-10-30 13:58:45 +00:00
Kamil Rytarowski 02f838d778 Adapt ASan test heavy_uar_test for NetBSD
The stack size is tight for the main thread in multithread
environment and follow the FreeBSD approach of reducing stack
usage.

llvm-svn: 345599
2018-10-30 13:49:15 +00:00
Kamil Rytarowski 647ece0144 Mark breaking TSan tests on NetBSD with XFAIL
Failing tests:
 - dtls
 - ignored-interceptors-mmap
 - mutex_lock_destroyed

llvm-svn: 345595
2018-10-30 13:28:32 +00:00
Kamil Rytarowski 8f545983a3 Cleanup includes in sanitizer_platform_limits_netbsd.cc
Sort the headers more correctly according to NetBSD style.
Prevent in this code part clang-format, as shuffling the order
will cause build failures.

llvm-svn: 345586
2018-10-30 11:34:36 +00:00
Kamil Rytarowski 4f343547ba Regenerate syscall hooks for NetBSD 8.99.25
Register new syscall getsockopt2.
Drop removed syscalls pmc_get_info and pmc_control.

While there address compiler warnings about potentially
unused variables.

llvm-svn: 345582
2018-10-30 11:10:36 +00:00
Kamil Rytarowski 1308779f79 Update generate_netbsd_syscalls.awk for NetBSD 8.99.25
Register new syscall getsockopt2.
Drop removed syscalls pmc_get_info and pmc_control.

While there address compiler warnings about potentially
unused variables.

llvm-svn: 345580
2018-10-30 11:03:37 +00:00
Kamil Rytarowski da78171643 Handle pthread_sigmask in DemangleFunctionName()
Translate __libc_thr_sigsetmask to pthread_sigmask on NetBSD.

llvm-svn: 345574
2018-10-30 08:51:34 +00:00
Kamil Rytarowski 7fc4f0d9af Drop now hidden ioctl(2) operations for NetBSD
POWER_IOC_GET_TYPE_WITH_LOSSAGE is no longer accessible from userland.

llvm-svn: 345572
2018-10-30 08:32:47 +00:00
Kamil Rytarowski 4c5620f233 Handle NetBSD symbol mangling for tzset
Native code generated on NetBSD mangles tzet to __tzset50.

Handle this accordingly in MSan.

llvm-svn: 345571
2018-10-30 08:16:14 +00:00
Kamil Rytarowski 7b88204b39 Handle NetBSD symbol mangling for nanosleep and vfork
Summary:
Native code generated on NetBSD mangles:

 - vfork into __vfork14
 - nanosleep into __nanosleep50

Handle this accordingly in TSan.

Reviewers: vitalybuka, dvyukov, joerg

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D53806

llvm-svn: 345570
2018-10-30 08:06:42 +00:00
Dean Michael Berris 01aeb3221d [XRay] Migrate FDR runtime to use refactored controller
Summary:
This change completes the refactoring of the FDR runtime to support the
following:

- Generational buffer management.

- Centralised and well-tested controller implementation.

In this change we've had to:

- Greatly simplify the code in xray_fdr_logging.cc to only implement the
  glue code for calling into the controller.

- Implement the custom and typed event logging functions in the
  FDRLogWriter.

- Imbue the `XRAY_NEVER_INSTRUMENT` attribute onto all functions in the
  controller implementation.

Reviewers: mboerger, eizan, jfb

Subscribers: jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D53858

llvm-svn: 345568
2018-10-30 04:35:48 +00:00
Vitaly Buka 7c180fa915 [ubsan-minimal] update comments in CMakeLists.txt
Summary:
Prepend minimal when UBsan is mentioned and delete a dead comment

Patch by Igor Sugak

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: mgorny, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D53826

llvm-svn: 345557
2018-10-30 01:20:12 +00:00
Vitaly Buka 9817192691 [sanitizer] Move interceptor initialization check into real_clock_gettime
Reviewers: cryptoad, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D53777

llvm-svn: 345556
2018-10-30 01:20:01 +00:00
Erik Pilkington 81b89fd7bd [compiler-rt][builtins] Don't #include CoreFoundation in os_version_check.c
This breaks some configurations, so just forward declare everything that we need.

rdar://35943793

Differential revision: https://reviews.llvm.org/D50269

llvm-svn: 345551
2018-10-29 23:01:26 +00:00
Reid Kleckner 143f1a9e72 [builtins] Fix -Wunused-local-typedef warning in compile time asserts
Use the __attribute__ spellings when compiling with clang-cl so that
__attribute__((unused)) expands to something.

llvm-svn: 345550
2018-10-29 22:48:14 +00:00
Petr Hosek 54153c3b5e [CMake] When built with LLVM, not use `-Wl,-z,defs`
This matches standalone build behavior. PR28681

Differential Revision: https://reviews.llvm.org/D53686

Patch By: tabloid.adroit

llvm-svn: 345547
2018-10-29 22:16:56 +00:00
Kamil Rytarowski 0ef090cad1 Mark test/tsan/getline_nohang as XFAIL for NetBSD
llvm-svn: 345493
2018-10-29 09:44:42 +00:00
Kamil Rytarowski 43d1653fc0 Disable the GNU strerror_r TSan test for NetBSD
Revert older change that was incorrect in this test.
It was already reverted in the past after an attempt to port it to Darwin.

While there, mark FreeBSD as unsupported as well.

llvm-svn: 345492
2018-10-29 09:12:38 +00:00
Kamil Rytarowski 5267698376 Mark test/tsan/ignore_lib5 as unsupported for NetBSD
ReadProcMaps() on NetBSD does not handle >=1MB of memory layout information.

llvm-svn: 345490
2018-10-29 08:42:46 +00:00
Dean Michael Berris e01d25efbd [XRay] Guard call to postCurrentThreadFCT()
Summary:
Some cases where `postCurrentThreadFCT()` are not guarded by our
recursion guard. We've observed that sometimes these can lead to
deadlocks when some functions (like memcpy()) gets outlined and the
version of memcpy is XRay-instrumented, which can be materialised by the
compiler in the implementation of lower-level components used by the
profiling runtime.

This change ensures that all calls to `postCurrentThreadFCT` are guarded
by our thread-recursion guard, to prevent deadlocks.

Reviewers: mboerger, eizan

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D53805

llvm-svn: 345489
2018-10-29 05:39:43 +00:00
Dean Michael Berris 36d9746630 [XRay] Use more portable control block
Summary:
In D53560, we assumed a specific layout for memory without using an
explicit structure. This follow-up change uses more portable layout
control by using unions in a struct, and consolidating the memory
management code in the buffer queue.

We also take the opportunity to improve the documentation on the types
and operations, along with simplifying some of the logic in the buffer
queue implementation.

Reviewers: mboerger, eizan

Subscribers: jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D53802

llvm-svn: 345485
2018-10-29 02:18:14 +00:00
Dean Michael Berris 299e9b8be0 [XRay] Refcount backing store for buffers
Summary:
This change implements the ref-counting for backing stores associated
with generational buffer management. We do this as an implementation
detail of the buffer queue, instead of exposing this to the interface.

This change allows us to keep the buffer queue interface and usage model
the same.

Depends on D53551.

Reviewers: mboerger, eizan

Subscribers: jfb, llvm-commits

Differential Revision: https://reviews.llvm.org/D53560

llvm-svn: 345471
2018-10-28 09:12:43 +00:00
Dean Michael Berris 18024786b9 [XRay] Support generational buffers in FDR controller
Summary:
This is an intermediary step in the full support for generational buffer
management in the FDR runtime. This change makes the FDR controller
aware of the new generation number in the buffers handed out by the
BufferQueue type.

In the process of making this change, we've realised that the cleanest
way of ensuring that the backing store per generation is live while all
the threads that need access to it will need reference counting to tie
the backing store to the lifetime of all threads that have a handle on
buffers associated with the memory.

We also learn that we're missing the edge-case in the function exit
handler's implementation where the first record being written into the
buffer is a function exit, which is caught/fixed by the test for
generational buffer management.

We still haven't wired the controller into the FDR mode runtime, which
will need the reference counting on the backing store implemented to
ensure that we're being conservatively thread-safe with this approach.

Depends on D52974.

Reviewers: mboerger, eizan

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D53551

llvm-svn: 345445
2018-10-27 03:00:21 +00:00
Kuba Mracek 117360cc24 [sanitizer] Improve macOS version detection
Part of <https://reviews.llvm.org/D48445>.

llvm-svn: 345406
2018-10-26 17:19:41 +00:00
Evgeniy Stepanov f4a6f6424d [sanitizer] Fix mallopt test on Android.
There is not a single common mallopt option between gnu/linux and
android, so simply use a random number there.

llvm-svn: 345394
2018-10-26 15:13:20 +00:00
Evgeniy Stepanov ea857e8225 [sanitizer] Fix mallopt interceptor.
On error, mallopt is supposed to return 0, not -1.

llvm-svn: 345323
2018-10-25 22:15:44 +00:00
Kuba Mracek 6b6d9bbd48 [sanitizer] Avoid calling a nullptr in MonotonicNanoTime if interceptors are 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
2018-10-24 18:40:08 +00:00
Kostya Serebryany ad11526c30 [hwasan] when printing a stack-related bugs, also print stack frame descriptions provided by the compiler
llvm-svn: 345110
2018-10-24 01:35:50 +00:00
Kostya Serebryany af95597c3c [hwasan] add stack frame descriptions.
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
2018-10-23 00:50:40 +00:00
Kuba Mracek 975352c0b1 [interception] Switch to _type suffix instead of _f, NFC.
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
2018-10-22 20:54:48 +00:00
Dean Michael Berris 2336dc3c51 [XRay] Account for virtual memory re-use
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
2018-10-22 06:11:50 +00:00
Dean Michael Berris 788b17ca78 [XRay][compiler-rt] Generational Buffer Management
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
2018-10-22 04:53:58 +00:00
Dean Michael Berris ebfbf89000 [XRay] Handle allocator exhaustion in segmented array
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
2018-10-22 02:11:27 +00:00
David Carlier cea5db8302 [Sanitizer] openbsd does not have sysctlbyname call
Enabling only for FreeBSD.

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

Differential Revision: https://reviews.llvm.org/D53413

llvm-svn: 344876
2018-10-21 21:17:03 +00:00
Craig Topper 3fe6470951 [X86][compiler-rt] Add additional CPUs and features to the cpu detection to 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
2018-10-20 03:49:04 +00:00
Douglas Yung e61c8eb98f Revert commit r344670 as the test fails on a bot http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/2683/.
llvm-svn: 344771
2018-10-19 04:09:32 +00:00
Dan Albert 98a6692380 [compiler-rt] Don't explicitly set CMAKE_CXX_FLAGS.
Summary:
C++ flags should not be used for not-C++ files as it may trigger
-Werror=unused-command-line-argument. CMake will use CMAKE_C_FLAGS,
CMAKE_CXX_FLAGS, and CMAKE_ASM_FLAGS as appropriate implicitly, so
this does not need to be explicitly handled here.

This change depends on https://reviews.llvm.org/D53301, since one of
the builders depended on this behavior because it was not configuring
CMAKE_ASM_FLAGS.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis, vitalybuka

Subscribers: dberris, mgorny, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D53335

llvm-svn: 344751
2018-10-18 18:04:28 +00:00
Dean Michael Berris e85af163bc [XRay][compiler-rt] Generational Buffer Management
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
2018-10-17 06:57:50 +00:00
Petr Hosek 4886652773 [XRay] Use fully qualified name for LogWriter
This avoids the build error in newer versions of GCC.

llvm-svn: 344579
2018-10-16 02:06:08 +00:00
Petr Hosek 6a8cedef25 [XRay] Encapsulate all FD log related logic into a class
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
2018-10-16 01:24:46 +00:00