Commit Graph

5677 Commits

Author SHA1 Message Date
Simi Pallipurath
6f4f1023fa [compiler-rt] [Arm] Make the tests for the runtime functions __aeabi_c{d,f} work on Big-Endian.
We are trying to build the compiler-rt as big-endian. And found that the tests compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c and compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c do not work on big endian at the moment. This patch makes these tests work on big endian as well.

Reviewed By: peter.smith, simon_tatham

Differential Revision: https://reviews.llvm.org/D155208
2023-07-17 12:27:32 +01:00
Caslyn Tonelli
c3767a943f [ubsan] Disable sigaction.cpp on archs for debugging
Add `ubsan-tsan` condition to test disablement.

Differential Revision: https://reviews.llvm.org/D155317
2023-07-15 15:02:50 +00:00
Dmitry Vyukov
f6db55ea66 ubsan: disable sigaction test for aarch64
The test seems to segfault on aarch64 with tsan:
https://lab.llvm.org/buildbot/#/builders/179/builds/6662
Reason unknown, needs debugging.

Reviewed By: melver, Caslyn

Differential Revision: https://reviews.llvm.org/D155272
2023-07-14 16:39:29 +00:00
Weining Lu
ef33d6cbfc [XRay] Add initial support for loongarch64
Only support patching FunctionEntry/FunctionExit/FunctionTailExit for now.

Reviewed By: MaskRay, xen0n
Co-Authored-By: zhanglimin <zhanglimin@loongson.cn>

Differential Revision: https://reviews.llvm.org/D140727
2023-07-14 09:27:13 +08:00
Dmitry Vyukov
1377179396 sanitizer_common: initialize sanitizer runtimes lazily from signal interceptors
Currently if a program calls sigaction very early (before non-lazy sanitizer
initialization, in particular if .preinit_array initialization is not enabled),
then sigaction will wrongly fail since the interceptor is not initialized yet.

In all other interceptors we do lazy runtime initialization for this reason,
but we don't do it in the signal interceptors.
Do lazy runtime initialization in signal interceptors as well.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D155188
2023-07-13 16:28:25 +02:00
Petr Hosek
bb7a902c76 [CMake] Use COMPILER_RT_BUILD_CRT in the condition for test
Unlike COMPILER_RT_HAS_CRT this handles the case where CRT is available
but has been disabled by setting COMPILER_RT_BUILD_CRT. This addresses
an issue reported on D153989.

Differential Revision: https://reviews.llvm.org/D155126
2023-07-12 22:30:43 +00:00
Daniel Thornburgh
6be453ed7f [debuginfod] Use dedicated cache dir for tests 2023-07-12 14:28:56 -07:00
Petr Hosek
286f4c0f07 Revert "[CMake] Use COMPILER_RT_BUILD_CRT in the condition for test"
This reverts commit 926f3759ec.
2023-07-12 18:02:19 +00:00
Petr Hosek
926f3759ec [CMake] Use COMPILER_RT_BUILD_CRT in the condition for test
Unlike COMPILER_RT_HAS_CRT this handles the case where CRT is available
but has been disabled by setting COMPILER_RT_BUILD_CRT.
2023-07-12 17:41:16 +00:00
Petr Hosek
b47beecc81 [compiler-rt] Move crt into builtins
On Linux crt is typically use in combination with builtins. In the Clang
driver the use of builtins and crt is controlled by the --rtlib option.
Both builtins and crt also have similar build requirements where they
need to be built before any other runtimes and must avoid dependencies.
We also want builtins and crt these to be buildable separately from the
rest of compiler-rt for bootstrapping purposes. Given how simple crt is,
rather than maintaining a separate directory with its own separate build
setup, it's more efficient to just move crt into builtins. We still use
separate CMake option to control whether to built crt same as before.

This is an alternative to D89492 and D136664.

Differential Revision: https://reviews.llvm.org/D153989
2023-07-11 23:05:45 +00:00
Daniel Thornburgh
580f9f7ef0 [llvm-cov][debuginfod] Make test more hermetic 2023-07-11 16:00:46 -07:00
Martin Storsjö
4579843d59 [compiler-rt] [test] Mark a windows specific test as requiring an MSVC like environment
This test relies on MSVC style linking details, such as -Wl,-dll
(which could be expressed with just "-shared", which would work
with MinGW too) and an implicitly created import library named
"<basename>.lib" (which isn't created when linking in MinGW mode).

This fixes running the compiler-rt tests in MinGW environments.
2023-07-12 00:11:47 +03:00
Thurston Dang
9095d5c44b Reland '[msan] Intercept dladdr1, and refactor dladdr'
Relanding with #if SANITIZER_GLIBC to avoid breaking FreeBSD.
Also incorporates Arthur's BUILD.gn fix (thanks!) from https://reviews.llvm.org/rGc1e283851772ba494113311405d48cfb883751d1

Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D154272
2023-07-11 20:05:54 +00:00
Petr Hosek
7c4dbff05d Revert "[compiler-rt] Move crt into builtins"
This reverts commit dae9d1b524 since
it caused https://github.com/llvm/llvm-project/issues/63799.
2023-07-11 15:32:49 +00:00
Petr Hosek
dae9d1b524 [compiler-rt] Move crt into builtins
On Linux crt is typically use in combination with builtins. In the Clang
driver the use of builtins and crt is controlled by the --rtlib option.
Both builtins and crt also have similar build requirements where they
need to be built before any other runtimes and must avoid dependencies.
We also want builtins and crt these to be buildable separately from the
rest of compiler-rt for bootstrapping purposes. Given how simple crt is,
rather than maintaining a separate directory with its own separate build
setup, it's more efficient to just move crt into builtins. We still use
separate CMake option to control whether to built crt same as before.

This is an alternative to D89492 and D136664.

Differential Revision: https://reviews.llvm.org/D153989
2023-07-11 07:41:04 +00:00
Zequan Wu
985486dca4 [Profile] Remove duplicate file locks when enabled continuous mode and online merging.
In `initializeProfileForContinuousMode`, we have already locked the profile file when merging is enabled, so there's no need to lock the same file second time in `openFileForMerging`.

On Linux/Darwin, the locking the same file twice doesn't cause any problem. But on Windows, it causes the problem to hang forever.

With this minor fix, continuous mode seems working with online merging on Windows.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D154748
2023-07-10 11:01:28 -04:00
Kirill Stoimenov
3c0ae1f5ab [ASAN] Moved mmap/munmap test to posix. 2023-07-07 22:42:31 +00:00
Kirill Stoimenov
9b79e15da1 [ASAN] Disable mmap test on Windows. 2023-07-07 18:46:51 +00:00
Kirill Stoimenov
a34e702aa1 [ASAN] Add mmap and munmap interceptor in ASAN
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D154659
2023-07-07 15:48:12 +00:00
David Spickett
e5a7e48652 [compiler-rt][xray] Disable fdr-single-thread test on Arm
For unknown reasons this casues a bus error.

See:
https://lab.llvm.org/buildbot/#/builders/178/builds/5157
2023-07-07 09:46:07 +00:00
Thurston Dang
667b9add73 Revert "Reland '[msan] Intercept dladdr1, and refactor dladdr'"
This reverts my commit 015dabd767
due to breaking non-glibc builds.
2023-07-07 00:23:03 +00:00
Thurston Dang
015dabd767 Reland '[msan] Intercept dladdr1, and refactor dladdr'
Reland with -Wcast-qual issue fixed

Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D154272
2023-07-06 16:16:22 +00:00
Fangrui Song
f7624b080a [XRay][test] Remove unneeded REQUIRES: x86_64-target-arch
fdr-thread-order.cpp can be very slow when the thread contention is large.
Enable it for AArch64 and x86-64 for now.

fdr-mode.cpp fails on a ppc64le machine. Unsupport it on ppc64le for now.

The remaining modified tests pass on AArch64, ppc64le, and x86-64.
2023-07-05 21:34:02 -07:00
Fangrui Song
9e7a052eef [XRay][AArch64] Implement __xray_ArgLoggerEntry 2023-07-05 20:56:00 -07:00
Fangrui Song
88b9d4d77e [XRay][test] Replace some XFAIL with more appropriate REQUIRES 2023-07-05 20:06:37 -07:00
Mariusz Borsa
3ff080b53b [Sanitizers][Darwin][Test] Mark symbolize_pc test unsupported in Darwin/LSan context
LSan is unsupported on Darwin anyway, and this test fals on public Darwin bots

Differential Revision: https://reviews.llvm.org/D154389
2023-07-05 16:54:20 -07:00
Blue Gaston
f171c76b68 [ASanAbi][Darwin] Build ios stable ABI library
In the initially commit, we limited the static archive to osx.

This patch removes that limitation.

Differential Revision: https://reviews.llvm.org/D153789
2023-07-04 14:32:59 -07:00
zhanglimin
280d163887 [dfsan] Support Linux loongarch64
Make minor changes to enable DFSAN and its tests on
loongarch64. And port Linux loongarch64 memory mappings
from msan.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D140690
2023-07-03 16:05:02 +08:00
Rainer Orth
81ff4d6f2e [sanitizer_common][test] Fix huge_malloc.c UNSUPPORTED syntax
`lit` doesn't accept arbitrary substrings of the target triple any longer,
so d5a779b5a3
<https://reviews.llvm.org/rGd5a779b5a39b655ed9fafedaacbb017c46f5dbfe> has
no effect.

Instead, this patch uses the `target=` syntax as all other tests in
`compiler-rt`.

Tested on `amd64-pc-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D154298
2023-07-02 13:27:04 +02:00
Thurston Dang
8ccf0426a4 Revert "[msan] Intercept dladdr1, and refactor dladdr"
Reverting my commit because of buildbot breakage.

This reverts commit d0b0dbeae1.
2023-07-01 20:27:11 +00:00
Thurston Dang
d0b0dbeae1 [msan] Intercept dladdr1, and refactor dladdr
This patch adds an msan interceptor for dladdr1 (with support
for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying
test. It also adds a helper file, msan_dl.cpp, that contains
UnpoisonDllAddrInfo (refactored out of the dladdr interceptor)
and UnpoisonDllAddr1ExtraInfo.

Differential Revision: https://reviews.llvm.org/D154272
2023-07-01 19:18:27 +00:00
Thurston Dang
850daa51f0 [msan] Add lit test for dladdr
This adds a simple lit test for dladdr. (There is currently a dladdr testcase in
compiler-rt/lib/msan/tests/msan_test.cpp, but not a stand-alone lit test.)

This is an incremental step towards adding a test case (and, eventually, an interceptor)
for the more complicated dladdr1 function.

Differential Revision: https://reviews.llvm.org/D154255
2023-06-30 20:52:49 +00:00
usama hameed
52a280bb60 [UBSan] Fix shared library linking in test for Darwin.
Without rpath information, the test fails on some Darwin platforms since the binary fails to find the shared library.

rdar://110010041

Differential Revision: https://reviews.llvm.org/D154003
2023-06-30 13:00:29 -07:00
zhanglimin
310a6f12b5 [MSan] Enable MSAN for loongarch64
This patch adds basic memory sanitizer support for loongarch64
with 47-bit VMA, which memory layout is based on x86_64.

The LLVM part of the LoongArch memory sanitizer implementation will
be done separately, which will fix failing tests in check-msan.
These failing tests fail with the following same error: "error in
backend: unsupported architecture".

Reviewed By: #sanitizers, vitalybuka, MaskRay

Differential Revision: https://reviews.llvm.org/D140528
2023-06-29 11:33:04 +08:00
Alex Richardson
f05c5c9c2c [builtins] Avoid using floating point q suffix. NFCI
The q floating point suffix is not supported by all compilers
configurations (e.g. GCC only supports it for some targets), so use a
macro (much like UINT64_C) instead. As this touches almost all lines in
the two tests also run them through clang-format.
2023-06-27 16:54:29 -07:00
Vitaly Buka
d5a779b5a3 [test][sanitizer] Disable D153500 test on solaris
The test causes unexpectedly high RSS usage there.
2023-06-27 10:34:10 -07:00
Alex Richardson
f157afceb0 [builtins] Fix __floattitf and __floatuntitf on x86
These conversion functions were using LDBL_MANT_DIG (which is the 80-bit
extended float on x86) instead of the appropriate macro for the 128-bit
floating point type expected by the *tf* softfloat library calls.
This was discovered while testing D98261 (which allows building the *tf*
functions on x86).

This also changes the constants used in the two tests to use 128-bit
floating-point literals instead of long double ones to ensure that the
comparison succeeds on platforms with smaller long double (e.g. x86_64)

Reviewed By: scanon

Differential Revision: https://reviews.llvm.org/D131787
2023-06-27 09:22:25 -07:00
Alex Brachet
0c11478b79 [compiler-rt] Stop using system ldd to detect libc version
The system libc may be different from the libc passed in
CMAKE_SYSROOT. Instead of using the ldd in PATH to detect
glibc version, use the features.h header file.

Differential Revision: https://reviews.llvm.org/D151678
2023-06-26 13:41:19 +00:00
Vitaly Buka
ee2bf319bc [test][MSAN] Fix test by printing action before execution it
We expect log messages from enother thread triggered by actions.
2023-06-23 21:12:01 -07:00
Vitaly Buka
6fc0e54807 [test][msan] Add test for dc4d9d6 2023-06-23 15:08:09 -07:00
Vitaly Buka
ca9c18a2e8 [msan] Optimize zeroing allocated memory
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D153599
2023-06-23 15:07:49 -07:00
Fangrui Song
f9fd0062b6 [XRay][AArch64] Suppport __xray_customevent/__xray_typedevent
`__xray_customevent` and `__xray_typedevent` are built-in functions in Clang.
With -fxray-instrument, they are lowered to intrinsics llvm.xray.customevent and
llvm.xray.typedevent, respectively. These intrinsics are then lowered to
TargetOpcode::{PATCHABLE_EVENT_CALL,PATCHABLE_TYPED_EVENT_CALL}. The target is
responsible for generating a code sequence that calls either
`__xray_CustomEvent` (with 2 arguments) or `__xray_TypedEvent` (with 3
arguments).

Before patching, the code sequence is prefixed by a branch instruction that
skips the rest of the code sequence. After patching
(compiler-rt/lib/xray/xray_AArch64.cpp), the branch instruction becomes a NOP
and the function call will take effects.

This patch implements the lowering process for
{PATCHABLE_EVENT_CALL,PATCHABLE_TYPED_EVENT_CALL} and implements the runtime.

```
// Lowering of PATCHABLE_EVENT_CALL
.Lxray_sled_N:
  b  #24
  stp x0, x1, [sp, #-16]!
  x0 = reg of op0
  x1 = reg of op1
  bl __xray_CustomEvent
  ldrp x0, x1, [sp], #16
```

As a result, two updated tests in compiler-rt/test/xray/TestCases/Posix/ now
pass on AArch64.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D153320
2023-06-23 09:24:18 -07:00
Vitaly Buka
243ef9efea [test][hwasan] Reformat comments 2023-06-22 17:07:02 -07:00
Vitaly Buka
f0b97270af [test][hwasan] Describe why HWASAN does not work 2023-06-22 17:07:02 -07:00
Vitaly Buka
82a6152344 [asan] Don't double poison secondary allocations
Sanitizers allocate shadow and memory as MAP_NORESERVE.

User memory can stay this way and do not increase RSS as long as we
don't store there.

The shadow unpoisoning also can avoid RSS increase for zeroed pages.
However as soon we poison the shadow, we need the page in RSS.

To avoid unnececary RSS increase we should not poison memory just before
unpoisoning them.

Depends on D153497.

Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D153500
2023-06-22 12:35:21 -07:00
Vitaly Buka
10f57cf5db [asan] Don't quarantine large blocks
Almost NFC, as blocks over max quarantine size will trigger immediate
drain anyway. In followup patches we can optimize passthrough case.

Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D153495
2023-06-22 10:07:45 -07:00
Vitaly Buka
9540f50281 [test][sanitizer] Reformat and print to stderr 2023-06-21 23:21:41 -07:00
Vitaly Buka
116b5e1eb4 [test][sanitizer] Pre-commit huge malloc test 2023-06-21 16:20:02 -07:00
Vitaly Buka
758935061c [test] Add llvm-xray into XRAY_TEST_DEPS 2023-06-21 16:13:47 -07:00
Vitaly Buka
2cb547a719 [test] Add lli into ORC_TEST_DEPS 2023-06-21 16:13:47 -07:00