Commit Graph

15716 Commits

Author SHA1 Message Date
John Paul Adrian Glaubitz a1ec3c5a88 [scudo] Link against libatomic on all MIPS targets
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D126418
2022-05-26 00:00:16 -07:00
Paul Kirth 7f5439945b [compiler-rt][test] Fix flake in symbolize_stack test
Addresses tests flakes described in
https://github.com/llvm/llvm-project/issues/55460

The test being updated can fail in FileCheck to match when given long
enough stack traces. This can be problematic when file system paths
become long enough to cause the majority of the long function name to
become truncated. We found in our CI that the truncated output would
often fail to match, thereby causing the test to fail when it should not.

Here we change the test to match on sybolizer output that should be more
reliable than matching inside the long function name.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D126102
2022-05-25 19:02:30 +00:00
Andrew Browne b2b0322a81 [DFSan] Add option to specify individual library files, and an option to exit with an error code if any library file was not found.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D126336
2022-05-24 16:15:46 -07:00
Mariusz Borsa 8246b2e156 [Sanitizers][Darwin] Replace SANITIZER_MAC with SANITIZER_APPLE in source files
This is a follow up to [Sanitizers][Darwin] Rename Apple macro SANITIZER_MAC -> SANITIZER_APPLE (D125816)

Performed a global search/replace as in title against LLVM sources

Differential Revision: https://reviews.llvm.org/D126263
2022-05-24 12:59:27 -07:00
Leonard Chan 6edbdf80ca Revert "[compiler-rt][scudo] Add missing preprocessor token" and "[compiler-rt][scudo] Simplify TBI checks"
This reverts commit 676eaa2ca9
and f6038cdca0 since builders are still
broken.
2022-05-24 11:30:31 -07:00
Leonard Chan 676eaa2ca9 [compiler-rt][scudo] Add missing preprocessor token
This should fix build errors seen on bots like
https://lab.llvm.org/buildbot/#/builders/57/builds/18263.
2022-05-24 11:12:30 -07:00
Leonard Chan f6038cdca0 [compiler-rt][scudo] Simplify TBI checks
Differential Revision: https://reviews.llvm.org/D111080
2022-05-24 10:53:09 -07:00
Leonard Chan c8644ea88e [compiler-rt][lsan] Update CanBeAHeapPointer for AArch64
While attempting to get the 64-bit lsan allocator working for Fuchsia, I
noticed this function would incorrectly return false for pointers returned
by the 64-bit allocator. On AArch64, this function attempts to get the VMA
size dynamically by counting the number of leading zeros from the function
frame address. This will fail if the frame address is significantly below an
allocated pointer (that is, the frame address has more leading zeros than an
allocated pointer). This is possible on Fuchsia and linux (when not called
from the initial thread stack).

It seems the intended use of this function is to speed up pointer scanning by
filtering out addresses that user code might not be able to access. Other
platforms this check is done on seem to hardcode the VMA size/shift, so it
seems appropriate to do this for aarch64 as well. This implies pointers on
aarch64 where the VMA size is <64 will pass through, but bad pointers will
still be caught by subsequent scan checks.

This patch also renames the function to something more fitting of what it's
trying to do.

Differential Revision: https://reviews.llvm.org/D123814
2022-05-24 10:22:46 -07:00
Julian Lettner 1962389979 [Sanitizer][Darwin] Add explanation for Apple platform macros
Differential Revision: https://reviews.llvm.org/D126229
2022-05-23 11:59:44 -07:00
Julian Lettner 806e8a1c8e [Sanitizer][Darwin] Add SANITIZER_DRIVERKIT platform macro 2022-05-23 11:21:45 -07:00
Paul Kirth d6a3c8ca18 Revert "tsan: add lock free stack pattern test"
This reverts commit 5deca650fd.
2022-05-21 00:12:06 +00:00
Paul Kirth f1d197f1a8 Revert "Mark new TSan test as unsupported on PPC."
This reverts commit b517d679dd.
2022-05-21 00:11:50 +00:00
Mitch Phillips de06626725 PPC+TSan whack-a-mole, round 3.
More details in https://reviews.llvm.org/D110552.

Last try until I revert the whole shenanigans.
2022-05-20 14:21:58 -07:00
Mitch Phillips bd62b70b51 Add 'ppc' as a target (for both 32- and 64-bit ppc).
Needed for a TSan test that won't pass on PPC. Relevant information is
in https://reviews.llvm.org/D110552.
2022-05-20 13:56:25 -07:00
Mitch Phillips b517d679dd Mark new TSan test as unsupported on PPC.
Notably fails under PPC. For now, just exclude it. More details in the
original Phabricator review, https://reviews.llvm.org/D110552.
2022-05-20 13:06:44 -07:00
Mitch Phillips 80ac0b9bc8 Fix up fuzzing test on Windows.
3bd112c720 fixed the fuzzing test on Linux, which, after
https://reviews.llvm.org/D125933, has one less branch. Turns out, on
Windows, that it still has the extra branch. I'm guessing that's because
exit() isn't known to be noreturn on Windows or something.

Either way, just make the test more tolerant.
2022-05-20 11:27:08 -07:00
Mitch Phillips 3bd112c720 Update fuzzing test to comply with new optimisation.
https://reviews.llvm.org/D125933 improved some of LLVM's handling of
binary ORs, which meant we have one less conditional branch, because the
'if (Size > 5 && Data[5] == 'R')' and 'if (bits == 63)' branches are now
correctly folded.
2022-05-20 11:01:31 -07:00
Alexey Katranov 5deca650fd tsan: add lock free stack pattern test
Add a set of tests that iterate over possible combinations of
memory orders for lock free stack implementation.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D110552
2022-05-20 13:36:01 +02:00
Julian Lettner ec563c5a90 [ASan] Add sleep_before_init flag
Also do a little bit of refactoring instead of just copy&paste.

Differential Revision: https://reviews.llvm.org/D126037
2022-05-19 20:41:43 -07:00
Mariusz Borsa 77014b9a13 [Sanitizers][Darwin] Rename Apple macro SANITIZER_MAC -> SANITIZER_APPLE
Initial introduction of the new macro before obsoleting the old one - the old name was really confusing.
Also moved SANITIZER_WATCHOS and SANITIZER_TVOS definitions under common #if defined(__APPLE__) block

Differential Revision: https://reviews.llvm.org/D125816
2022-05-18 14:46:41 -07:00
Mitch Phillips f9a3c43eaa [NFCI] clang-format gwp-asan files. 2022-05-18 14:10:44 -07:00
Mitch Phillips e831ea6912 [NFCI] clang-format scudo standalone 2022-05-18 14:04:04 -07:00
Eli Friedman dd20323f51 [compiler-rt builtins] Assert that atomic.c can be compiled correctly.
The spinlock requires that lock-free operations are available;
otherwise, the implementation just calls itself. As discussed in
D120026.

Differential Revision: https://reviews.llvm.org/D123080
2022-05-16 14:40:57 -07:00
John Paul Adrian Glaubitz d4aacc1a01 [sanitizer] Don't use newfstatat for Linux on SPARC
Linux on SPARC uses fstatat64 instead.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D125572
2022-05-16 12:21:55 -07:00
Timm Bäder 791e0d1bc8 [compiler-rt] Add NO_EXEC_STACK_DIRECTIVE on s390x
Differential Revision: https://reviews.llvm.org/D125454
2022-05-13 07:57:10 +02:00
Julian Lettner 824d83068e [TSan] Relax pthread introspection-based test
Thread create/destroy events are not guaranteed to belivered on the
parent thread, e.g., output from a CI job:
```
5: THREAD_CREATE 0x7e8000104000, self: 0x1102ebdc0, name: n/a
6: THREAD_START 0x7e8000104000, self: 0x7e8000104000, name: n/a
7: Hello from pthread
8: THREAD_TERMINATE 0x7e8000104000, self: 0x7e8000104000, name: child thread
9: THREAD_DESTROY 0x7e8000104000, self: 0x7e8000104000, name: child thread
```
Here, THREAD_DESTROY is delivered on the thread being destroyed.

rdar://92679941
2022-05-12 18:13:12 -07:00
Blue Gaston 9145cb8b7c [Sanitizers][Darwin] Add READ/WRITE detection on arm64 for darwin.
On arm64 the read/write flag is set on the esr register.
	Adding this flag check for arm64 enables a more accurate
	print out for sanitizer signal reports and matches the
	behavior on x86.

	Fixes bug: https://bugs.llvm.org/show_bug.cgi?id=27543 https://github.com/google/sanitizers/issues/653

	These tests are now passing:
		SanitizerCommon-asan-arm64-Darwin :: Posix/illegal_read_test.cpp
		SanitizerCommon-asan-arm64-Darwin :: Posix/illegal_write_test.cpp
		SanitizerCommon-asan-arm64e-Darwin :: Posix/illegal_read_test.cpp
  		SanitizerCommon-asan-arm64e-Darwin :: Posix/illegal_write_test.cpp
  		SanitizerCommon-tsan-arm64-Darwin :: Posix/illegal_read_test.cpp
  		SanitizerCommon-tsan-arm64-Darwin :: Posix/illegal_write_test.cpp
  		SanitizerCommon-tsan-arm64e-Darwin :: Posix/illegal_read_test.cpp
  		SanitizerCommon-tsan-arm64e-Darwin :: Posix/illegal_write_test.cpp
  		SanitizerCommon-ubsan-arm64-Darwin :: Posix/illegal_read_test.cpp
  		SanitizerCommon-ubsan-arm64-Darwin :: Posix/illegal_write_test.cpp
  		SanitizerCommon-ubsan-arm64e-Darwin :: Posix/illegal_read_test.cpp
  		SanitizerCommon-ubsan-arm64e-Darwin :: Posix/illegal_write_test.cpp

rdar://92104440

Differential Revision: https://reviews.llvm.org/D125416
2022-05-12 10:51:49 -07:00
Florian Mayer de67bc8edb [HWASan symbolize] Write error to stderr. 2022-05-10 17:00:57 -07:00
Florian Mayer be17d18ae8 [HWASan] deflake hwasan_symbolize test more.
Don't fail on corrupted ELF file on indexing. This happens because files
change in the directory from concurrent tests.
2022-05-10 16:57:44 -07:00
Nikita Popov ddfc84e634 [fuzzer] Reduce size of large.test
This halves the size of LargeTest, dropping time to compile this
file locally from 14s to 5.5s. Hopefully this will also fix the
persistent timeouts in pre-merge checks.

Differential Revision: https://reviews.llvm.org/D124237
2022-05-10 10:19:04 +02:00
Florian Mayer b77d16f7f3 [HWASan] deflake hwasan_symbolize test
Also enable on X86_64.

The directory would change during the test execution. This should not
necessarily prevent us from indexing a directory (a user might
potentially do that if they specify a parent directory of the actual
symbols directory, and change unrelated files).

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D125143
2022-05-09 14:11:52 -07:00
Clemens Wasser d08e5d4cc6 Make lsan TestCases more consistent
Inlining `LSAN_BASE` makes the lsan TestCases more consistent to the other sanitizer TestCases.
It is also needed on Windows: https://reviews.llvm.org/D115103

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D124322
2022-05-09 11:32:15 -07:00
Peter S. Housel 1dda6ad80c [test][ORC-RT] Disable elfnix_platform tests on non-x86_64 platforms
ORC ELFNixPlatform currently only supports x86_64.
2022-05-06 20:11:35 -07:00
Petr Hosek bf3cba71e1 Revert "[runtime] Build compiler-rt with --unwindlib=none"
This reverts commit 102bc634cb because
some tests are failing on sanitizer bots.
2022-05-06 19:53:30 -07:00
Petr Hosek 102bc634cb [runtime] Build compiler-rt with --unwindlib=none
This applies the change made to libunwind+libcxxabi+libcxx in D113253
to compiler-rt as well.

Differential Revision: https://reviews.llvm.org/D115674
2022-05-06 17:53:47 -07:00
Petr Hosek d7732695eb Revert "[runtime] Build compiler-rt with --unwindlib=none"
This reverts commit fecad835fb.
2022-05-06 17:52:10 -07:00
Petr Hosek fecad835fb [runtime] Build compiler-rt with --unwindlib=none
This applies the change made to libunwind+libcxxabi+libcxx in D113253
to compiler-rt as well.

Differential Revision: https://reviews.llvm.org/D115674
2022-05-06 17:36:17 -07:00
Florian Mayer 68cd47e0ca [HWASan] Clean up hwasan_symbolize.
The globals are better expressed as members of the Symbolizer, and all
functions operating on it should be methods instead.

Also using the standard idiom of wrapping the main code in
`if __name__ == '__main__'`.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D125032
2022-05-06 15:45:53 -07:00
Florian Mayer d8564dcbcf [HWASan] Allow to linkify symbolizer output.
Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D124950
2022-05-06 15:44:14 -07:00
Louis Dionne a097c4ce95 [compiler-rt] Fix issue with compiler-rt tests mixing <atomic> and <stdatomic.h>
Since D97044, libc++ implements <stdatomic.h>, which is not compatible
with the <atomic> header in C++03 mode. To fix the tests, avoid using
<stdatomic.h> at all, since it is not strictly required.

rdar://92867529

Differential Revision: https://reviews.llvm.org/D125118
2022-05-06 17:36:12 -04:00
Peter S. Housel 981523b2e4 [ORC-RT][ORC] Handle dynamic unwind registration for libunwind
This changes the ELFNix platform Orc runtime to use, when available,
the __unw_add_dynamic_eh_frame_section interface provided by libunwind
for registering .eh_frame sections loaded by JITLink. When libunwind
is not being used for unwinding, the ELFNix platform detects this and
defaults to the __register_frame interface provided by libgcc_s.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D114961
2022-05-06 14:00:29 -07:00
Nico Weber c9faea04b1 Revert "[HWASan] Allow to linkify symbolizer output."
This reverts commit 4af9392e13.
The new test fails on several machines (including some bots),
see https://reviews.llvm.org/D124950
2022-05-06 09:53:45 -04:00
Nico Weber f3d31c7f81 Revert "[HWASan] Clean up hwasan_symbolize."
This reverts commit 6ca1df61d2.
Prerequisite for reverting 4af9392e13.
2022-05-06 09:53:45 -04:00
Ben Shi 3902ebdd57 [compiler-rt][builtins] Fix wrong ABI of AVR __mulqi3 & __mulhi3
Reviewed By: aykevl, dylanmckay

Differential Revision: https://reviews.llvm.org/D125077
2022-05-06 13:46:49 +00:00
Sam McCall 7cc8377f2c Generalize "check-all" umbrella targets, use for check-clang-tools
The mechanism behind "check-all" is recording params of add_lit_testsuite()
calls in global variables LLVM_LIT_*, and then creating an extra suite with
their union at the end.
This avoids composing the check-* targets directly, which doesn't work well.

We generalize this by allowing multiple families of variables LLVM_{name}_LIT_*:
  umbrella_lit_testsuite_begin(check-foo)
  ... test suites here will be added to LLVM_FOO_LIT_* variables ...
  umbrella_lit_testsuite_end(check-foo)
(This also moves some implementation muck out of {llvm,clang}/CMakeLists.txt

This patch also changes check-clang-tools to use be an umbrella test target,
which means the clangd and clang-pseudo tests are included in it, along with the
the other testsuites that already are (like check-clang-extra-clang-tidy).

Differential Revision: https://reviews.llvm.org/D121838
2022-05-06 12:30:49 +02:00
Wael Yehia 93bb2f16e8 XFAIL some PGO tests on AIX until the new linker becomes publicly available. 2022-05-06 01:35:32 +00:00
Florian Mayer 6ca1df61d2 [HWASan] Clean up hwasan_symbolize.
The globals are better expressed as members of the Symbolizer, and all
functions operating on it should be methods instead.

Also using the standard idiom of wrapping the main code in
`if __name__ == '__main__'`.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D125032
2022-05-05 16:41:11 -07:00
Florian Mayer 4af9392e13 [HWASan] Allow to linkify symbolizer output.
Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D124950
2022-05-05 16:40:09 -07:00
Ben Shi 70a66c08fc [compiler-rt][builtins] Add helper functions for uint16/sint16/uint8/sint8 div and mod
__udivmodhi4 : uint16 div and mod
__udivmodqi4 : uint8 div and mod
__divmodhi4  : sint16 div and mod
__divmodqi4  : sint8 div and mod

The above helper functions in libgcc have special ABI as described at
https://gcc.gnu.org/wiki/avr-gcc#Exceptions_to_the_Calling_Convention .

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D124600
2022-05-05 23:29:14 +00:00
H.J. Lu b226894d47 [sanitizer] Correct GetTls for x32
Since x32 pointer size is 4 bytes, the self pointer offset in TCB:

struct
{
  void *tcb;
  dtv_t *dtv;
  void *self;
  ...

should be 8, not 16.

Fixes https://github.com/llvm/llvm-project/issues/55288

Differential Revision: https://reviews.llvm.org/D125025
2022-05-05 13:55:19 -07:00