Commit Graph

14865 Commits

Author SHA1 Message Date
Tom Stellard 05c21f54a4 compiler-rt: Fix arch detection for ppc64le
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D110377
2021-10-21 16:12:13 -07:00
David Blaikie aee4925507 Recommit: Compress formatting of array type names (int [4] -> int[4])
Based on post-commit review discussion on
2bd8493847 with Richard Smith.

Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
they're all around pointer/reference types where the pointer/reference
token will appear at the rightmost side of the left side of the type
name, so they make nested types (eg: the "int" in "int *") behave as
though there is a non-empty placeholder (because the "*" is essentially
the placeholder as far as the "int" is concerned).

This was originally committed in 277623f4d5

Reverted in f9ad1d1c77 due to breakages
outside of clang - lldb seems to have some strange/strong dependence on
"char [N]" versus "char[N]" when printing strings (not due to that name
appearing in DWARF, but probably due to using clang to stringify type
names) that'll need to be addressed, plus a few other odds and ends in
other subprojects (clang-tools-extra, compiler-rt, etc).
2021-10-21 11:34:43 -07:00
Pirama Arumuga Nainar ab3d5d0533 Revert "[compiler-rt/profile] Hide __llvm_profile_raw_version"
This reverts commit 69708477be to unblock
instrprof-darwin-exports.c failure on MacOS bots.
2021-10-21 10:56:43 -07:00
Petr Hosek ba4920e98e Revert "[CMake] Cache the compiler-rt library search results"
This reverts commit 0eed292fba, there
are compiler-rt build failures that appear to have been introduced
by this change.
2021-10-21 10:32:01 -07:00
Ben Langmuir 92a6dd6e50 [test][ORC-RT] Disable x86_64 tests when target arch does not match
When cross-compiling, these tests will fail. For now leave the host arch
check that was already there since I don't know why it was added.
2021-10-21 10:01:23 -07:00
Ben Langmuir b8da594750 Reapply [ORC-RT] Configure the ORC runtime for more architectures and platforms
Reapply 5692ed0cce, but with the ORC runtime disabled explicitly on
CrossWinToARMLinux to match the other compiler-rt runtime libraries.

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

---

Enable building the ORC runtime for 64-bit and 32-bit ARM architectures,
and for all Darwin embedded platforms (iOS, tvOS, and watchOS). This
covers building the cross-platform code, but does not add TLV runtime
support for the new architectures, which can be added independently.

Incidentally, stop building the Mach-O TLS support file unnecessarily on
other platforms.

Differential Revision: https://reviews.llvm.org/D112111
2021-10-21 09:00:18 -07:00
Lang Hames 5c72323141 [ORC-RT] Remove stray printf debugging output.
These were accidentally picked up in an earlier commit.
2021-10-21 08:22:58 -07:00
Nikita Malyavin 4e1a6c0705 [msan] Add stat-family interceptors on Linux
Add following interceptors on Linux: stat, lstat, fstat, fstatat.

This fixes use-of-uninitialized value on platforms with GLIBC 2.33+.
In particular: Arch Linux, Ubuntu hirsute/impish.

The tests should have also been failing during the release on the mentioned platforms, but I cannot find any related discussion.

Most likely, the regression was introduced by glibc commit [[ 8ed005daf0 | 8ed005daf0ab03e14250032 ]]:
all stat-family functions are now exported as shared functions.

Before, some of them (namely stat, lstat, fstat, fstatat) were provided as a part of libc_noshared.a and called their __xstat dopplegangers. This is still true for Debian Sid and earlier Ubuntu's. stat interceptors may be safely provided for them, no problem with that.

Closes https://github.com/google/sanitizers/issues/1452.
See also https://jira.mariadb.org/browse/MDEV-24841

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D111984
2021-10-20 17:14:43 -07:00
Ben Langmuir f3671de550 Revert "[ORC-RT] Configure the ORC runtime for more architectures and platforms"
Broke on aarch64-linux. Reverting while I investigate.

This reverts commit 5692ed0cce.
2021-10-20 15:32:06 -07:00
Ben Langmuir 5692ed0cce [ORC-RT] Configure the ORC runtime for more architectures and platforms
Enable building the ORC runtime for 64-bit and 32-bit ARM architectures,
and for all Darwin embedded platforms (iOS, tvOS, and watchOS). This
covers building the cross-platform code, but does not add TLV runtime
support for the new architectures, which can be added independently.

Incidentally, stop building the Mach-O TLS support file unnecessarily on
other platforms.

Differential Revision: https://reviews.llvm.org/D112111
2021-10-20 11:21:18 -07:00
Sterling Augustine 6b6564fcf9 Fix unused variable warning. 2021-10-20 09:59:16 -07:00
PZ Read 9e7b7303f1 [libFuzzer] Update InputInfo.TimeOfUnit when replacing it in the corpus.
Previously, when the fuzzing loop replaced an input in the corpus, it didn't update the execution time of the input. Therefore, some schedulers (e.g. Entropic) would adjust weights based on the incorrect execution time.

This patch updates the execution time of the input when replacing it.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D111479
2021-10-20 06:52:57 -07:00
Lang Hames b574c52db5 [ORC-RT] Add MethodWrapperHandler utility for WrapperFunction.
This is an ORC runtime counterpart to a01f772d19, which introduced the same
functionality into LLVM.
2021-10-19 18:38:01 -07:00
Lang Hames 21369d4b9d [ORC-RT] Use function pointer type (rather than reference) for traits class.
Aligns this template with the corresponding one in LLVM.
2021-10-19 18:38:01 -07:00
Lang Hames ea9826ff77 [ORC-RT] Avoid switching out-of-band error value into __orc_rt::Error and back.
WrapperFunctionResult can already convey serialization errors as out-of-band
error values, so there's no need to wrap it in an Expected here. Removing the
wrapper simplifies the plumbing and call sites.
2021-10-19 18:38:01 -07:00
Matt Morehouse e1e2635327 [HWASan] Use tagged-globals feature on x86.
Allows us to use the small code model when we disable relocation
relaxation.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D111344
2021-10-19 05:56:50 -07:00
Petr Hosek 0eed292fba [CMake] Cache the compiler-rt library search results
There's a lot of duplicated calls to find various compiler-rt libraries
from build of runtime libraries like libunwind, libc++, libc++abi and
compiler-rt. The compiler-rt helper module already implemented caching
for results avoid repeated Clang invocations.

This change moves the compiler-rt implementation into a shared location
and reuses it from other runtimes to reduce duplication and speed up
the build.

Differential Revision: https://reviews.llvm.org/D88458
2021-10-18 14:44:07 -07:00
Dmitry Vyukov 27969c4e00 tsan: refactor trace tests
Instead of creating real threads for trace tests
create a new ThreadState in the main thread.
This makes the tests more unit-testy and will also
help with future trace tests that will need
more than 1 thread. Creating more than 1 real thread and
dispatching test actions across multiple threads in the
required deterministic order is painful.

This is resubmit of reverted D110546 with 2 changes:
1. The previous version patched ImitateTlsWrite to not
expect ThreadState to be allocated in TLS (the CHECK
failed for the fake test threads).
This added an ugly hack into production code and was still
logically wrong because we imitated write to the main
thread TLS/stack when we started the fake test thread
(which has nothing to do with the main thread TLS/stack).
This version uses ThreadType::Fiber instead of ThreadType::Regular
for the fake threads. This naturally makes ThreadStart skip
obtaining stack/tls and imitating writes to them.

2. This version still skips the tests on Darwin and PowerPC
to be on the safer side. Build bots reported failures for PowerPC
for the previous version.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D111156
2021-10-17 12:38:56 +02:00
David Blaikie 6176fda3f9 Fix a few warnings (signed/unsigned comparison in gtest, and missing field initializers) 2021-10-16 22:43:57 -07:00
Vitaly Buka 746dd6a700 [NFC][sanitizer] Add StackDepotTestOnlyUnmap 2021-10-16 13:47:57 -07:00
Vitaly Buka c0b1b52a28 [NFC][sanitizer] Rename stack depot tests 2021-10-16 13:38:09 -07:00
Pirama Arumuga Nainar 69708477be [compiler-rt/profile] Hide __llvm_profile_raw_version
Hide __llvm_profile_raw_version so as not to resolve reference from a
dependent shared object.  Since libclang_rt.profile is added later in
the command line, a definition of __llvm_profile_raw_version is not
included if it is provided from an earlier object, e.g.  from a shared
dependency.

This causes an extra dependence edge where if libA.so depends on libB.so
and both are coverage-instrumented, libA.so uses libB.so's definition of
__llvm_profile_raw_version.  This leads to a runtime link failure if the
libB.so available at runtime does not provide this symbol (but provides
the other dependent symbols).  Such a scenario can occur in Android's
mainline modules.
E.g.:
  ld -o libB.so libclang_rt.profile-x86_64.a
  ld -o libA.so -l B libclang_rt.profile-x86_64.a

libB.so has a global definition of __llvm_profile_raw_version.  libA.so
uses libB.so's definition of __llvm_profile_raw_version.  At runtime,
libB.so may not be coverage-instrumented (i.e. not export
__llvm_profile_raw_version) so runtime linking of libA.so will fail.

Marking this symbol as hidden forces each binary to use the definition
of __llvm_profile_raw_version from libclang_rt.profile.

Differential Revision: https://reviews.llvm.org/D111759
2021-10-15 11:56:16 -07:00
Vitaly Buka e0f3a3b228 [ubsan] Remove REQUIRED from some TestCases
It's not obvious why they are needed, and tests pass.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D111859
2021-10-15 10:20:34 -07:00
Dan Liew 2232a68b2d Fix another test not using the standard separator for sanitizer options.
rdar://83637067
2021-10-15 00:20:34 -07:00
Vitaly Buka a1e78aee66 [NFC][asan] Speedup uar_signals.cpp test
It was the slowest test:
--------------------------------------------------------------------------
41.77s: AddressSanitizer-x86_64-linux :: TestCases/Linux/uar_signals.cpp
26.64s: AddressSanitizer-i386-linux :: TestCases/Linux/uar_signals.cpp
14.82s: AddressSanitizer-x86_64-linux :: TestCases/Posix/current_allocated_bytes.cpp
14.79s: AddressSanitizer-i386-linux :: TestCases/Posix/current_allocated_bytes.cpp
11.55s: AddressSanitizer-x86_64-linux :: TestCases/scariness_score_test.cpp
10.15s: AddressSanitizer-x86_64-linux :: TestCases/Posix/stack-use-after-return.cpp
2021-10-14 17:05:19 -07:00
Vitaly Buka 882ce178b3 [NFC][sanitizer] Remove %stdcxx11
-std=c++14 is a default for a while.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D111848
2021-10-14 16:47:43 -07:00
Vitaly Buka 1274a07da0 [NFC][asan] Use more common socket type in test 2021-10-14 16:46:07 -07:00
Evgenii Stepanov 439e00a25b [scudo] Fix running tests under hwasan.
When built with hwasan, assume that the target architecture does not
support TBI. HWASan uses that byte for its own purpose, and changing it
breaks things.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D111842
2021-10-14 14:56:58 -07:00
Evgenii Stepanov 7a3fb71c3c [hwasan] Fix TestCases/thread-uaf.c.
On newer glibc, this test detects an extra match somewhere under
pthread_getattr_np. This results in Thread: lines getting spread out in
the report and failing to match the CHECKs.

Fix the CHECKs to allow this possibility.

Reviewed By: fmayer

Differential Revision: https://reviews.llvm.org/D111841
2021-10-14 14:56:57 -07:00
Evgenii Stepanov 039096ee71 [hwasan] Add default "/" prefix.
Add a default "/" prefix to the symbol search path in the
symbolization script. Without this, the binary itself is not considered
a valid source of symbol info.

Differential Revision: https://reviews.llvm.org/D111840
2021-10-14 14:56:55 -07:00
Collin Baker 8c66d78172 [test] Fix asan dynamic unit tests with per-target runtime dirs
When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
Asan-i386-calls-Dynamic-Test and Asan-i386-inline-Dynamic-Test fail to
run on a x86_64 host. This is because asan's unit test lit files are
configured once, rather than per target arch as with the non-unit
tests. LD_LIBRARY_PATH ends up incorrect, and the tests try linking
against the x86_64 runtime which fails.

This changes the unit test CMake machinery to configure the default
and dynamic unit tests once per target arch, similar to the other asan
tests. Then the fix from https://reviews.llvm.org/D108859 is adapted
to the unit test Lit files with some modifications.

Fixes PR52158.

Differential Revision: https://reviews.llvm.org/D111756
2021-10-14 16:47:25 -04:00
Vitaly Buka 8282024a74 [sanitizer] Move out stack trace pointer from header StackDepot
Trace pointers accessed very rarely and don't need to
be in hot data.

Depends on D111613.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111614
2021-10-14 09:23:04 -07:00
Jinsong Ji 4fee8a1691 [NFC][compiler-rt][profile] Remove non-Posix -h option from test
We are running `ls -lh` in gcov-execlp.c test in Posix folder.
However `-h` is not a POSIX option,ls on some POSIX system (eg: AIX)
may not support it.

This patch remove this option to avoid break.

Reviewed By: anhtuyen

Differential Revision: https://reviews.llvm.org/D111807
2021-10-14 15:08:38 +00:00
Vitaly Buka 8383e49b53 [sanitizer] Cleanup benchmark 2021-10-13 13:58:28 -07:00
Vitaly Buka 43bae7ae26 [sanitizer] Add trivial StackDepot benchmark 2021-10-13 12:03:13 -07:00
Jinsong Ji 666accf283 [compiler-rt][profile] Enable profile tests for AIX
This patch enable profile test for supported options on AIX.

Reviewed By: w2yehia

Differential Revision: https://reviews.llvm.org/D110945
2021-10-13 03:00:32 +00:00
Gulfem Savrun Yeniceri 9a70eb918e [profile] Remove emitting symbolizer markup
Fuchsia Clang code coverage pipeline started to use binary ids that are
embedded in profiles. This patch removes emitting symbolizer markup,
which is not necessary in the coverage pipeline anymore.

Differential Revision: https://reviews.llvm.org/D111674
2021-10-13 01:43:07 +00:00
Vitaly Buka ca0036df7d [sanitizer] Remove StackDepotReverseMap
Now StackDepotGet can retrive the stack in O(1).

Depends on D111612.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111613
2021-10-12 15:59:27 -07:00
Vitaly Buka ce7f8c8474 [sanitizer] Remove id and replace link with u32
This lets us reduce size of Node, similar to D111183 proposal.

Depends on D111610.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111612
2021-10-12 15:53:28 -07:00
Vitaly Buka f815c2ccda [sanitizer] Fix test on Windows 2021-10-12 15:38:37 -07:00
Vitaly Buka 3ec4d4dc99 [NFC][sanitizer] Add a few consts
Depends on D111609.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111610
2021-10-12 15:38:37 -07:00
Vitaly Buka d402fb02b9 [NFC][sanitizer] Clang-format a line
Depends on D111608.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111609
2021-10-12 14:11:26 -07:00
Vitaly Buka 67905bcaf3 [sanitizer] Re-enable test on Windows
It's likely missdiagnosed issue fixed with 336e88636a
2021-10-12 14:10:46 -07:00
Vitaly Buka d80a5d54e1 [NFC][sanitizer] Move consts into on top of the class 2021-10-12 13:59:16 -07:00
Vitaly Buka 38f121cd84 [sanitizer] Switch StackDepot to TwoLevelMap
Depends on D111607.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111608
2021-10-12 13:57:30 -07:00
Vitaly Buka 884d290427 [sanitizer] Remove SpinMutexLock from stat function
Mapped size is more appropriate for most users.

Depends on D111605.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111607
2021-10-12 13:49:10 -07:00
Vitaly Buka 9939e562f7 [NFC][sanitizer] Refactor Maps into templates
Depends on D111599.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111605
2021-10-12 13:37:44 -07:00
Vitaly Buka 336e88636a [sanitizer] Fix test on Windows
UL suffix on MSVC is 32bit.
2021-10-12 13:24:40 -07:00
Vitaly Buka 0e0d3b3326 [sanitizer] Fix typo in test 2021-10-12 13:24:40 -07:00
Vitaly Buka b4db2a500d [sanitizer] Fix StackDepotPrintAll
unlock corrupted backets by using s set by loop to nullptr.
Also StackDepot supports iterating without locking.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D111599
2021-10-12 10:57:40 -07:00