908 Commits

Author SHA1 Message Date
Peter Collingbourne
36cb81cced
Change python to python3 in some shebangs.
Reviewers: vitalybuka

Reviewed By: vitalybuka

Pull Request: https://github.com/llvm/llvm-project/pull/134945
2025-04-08 16:15:39 -07:00
Florian Mayer
e0c8fc793c
Reapply "[sanitizer] intercept getservent_r, getservbyname_r, getservbyport_r" (#133358) (#133528)
This reverts commit 52d7f14a895eb8669d72cd02754e5586de3e61d8.
2025-04-01 15:25:01 -07:00
Mariusz Borsa
02837acaaf
[Sanitizers][Darwin][Test] Remove community incompliant internal link from sources (#133187)
The malloc_zone.cpp test currently fails on Darwin hosts, in
SanitizerCommon
tests with lsan enabled.

Need to XFAIL this test to buy time to investigate this failure. Also
we're trying to bring the number of test failing on Darwin bots to 0, to
get clearer signal of any new failures.

rdar://145873843

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-03-31 17:06:41 -07:00
Florian Mayer
1e00bb16f4
[sanitizer] actually run preadv2 test (#133529)
it seems the %run was accidentally omitted, otherwise the `assert` calls
would not make sense
2025-03-28 16:31:38 -07:00
Qinkun Bao
45b9e24b1e
Fix some small typos in compiler-rt. NFC (#133388) 2025-03-28 15:51:13 -04:00
Midhunesh
d75a40a9c1
Add cmake option to enable/disable searching PATH for symbolizer (#129012)
Introduced a cmake option that is disabled by default that suppresses
searching via the PATH variable for a symbolizer. The option will be
enabled for downstream builds where the user will need to specify the
symbolizer path more explicitly, e.g., by using ASAN_SYMBOLIZER_PATH.
2025-03-25 16:29:35 -07:00
Mariusz Borsa
ab58a3c35b
XFAIL malloc_zone.cpp for darwin/lsan (#131234)
Silence darwin bot while we investigate the problem

rdar://145873843

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-03-13 16:01:32 -07:00
David CARLIER
9a54c77aa3
Reland copy file range san (#129114) 2025-02-27 12:58:51 -08:00
Daniel Thornburgh
e5d93100b6 Revert "[compiler-rt][sanitizer_common] copy_file_range syscall interception. (#125816)" and fix
This reverts commit 7521207e415b19b2924930ac95c2fcf07d56f2f2.
This reverts commit 5f6a3e63a31aaebc620a18c47bc5590f6f705c98.
2025-02-27 12:12:51 -08:00
David CARLIER
7521207e41
[compiler-rt][sanitizer_common] fix copy_file_range test. (#129010)
Passing Large File Support.

Address #125816
2025-02-27 07:12:26 +00:00
David CARLIER
5f6a3e63a3
[compiler-rt][sanitizer_common] copy_file_range syscall interception. (#125816) 2025-02-27 05:33:38 +00:00
Cullen Rhodes
61cfa53896
[compiler-rt][asan] Re-enable forkpty test on AArch64 (NFC) (#127667)
Disabled in 86474c7a1addf59d511050552b697b8b2af61838, no longer failing
on AArch64 (for me at least).

Fixes: https://github.com/llvm/llvm-project/issues/24774
2025-02-18 17:01:23 -08:00
Nico Weber
1464b8ec8a Revert "Move interceptors for libresolv functions to MSan (#119071)"
This reverts commit f5f965058a5f9b835382f96bd4041bc7e608ece0.
Breaks a test on some bots, see
https://github.com/llvm/llvm-project/pull/119071#issuecomment-2544000926
2024-12-15 14:04:56 -05:00
Aaron Puchert
f5f965058a
Move interceptors for libresolv functions to MSan (#119071)
The functions are not relevant for most sanitizers and only required for
MSan to see which regions have been written to. This eliminates a link
dependency for all other sanitizers and fixes #59007: while `-lresolv`
had been added for the static runtime in 6dce56b2a308, it wasn't added
to the shared runtimes.

Instead of just moving the interceptors, we adapt them to MSan
conventions:
* We don't skip intercepting when `msan_init_is_running` is true, but
directly call ENSURE_MSAN_INITED() like most other interceptors. It
seems unlikely that these functions are called during initialization.
* We don't unpoison `errno`, because none of the functions is specified
to use it.
2024-12-09 22:03:03 +01:00
Rainer Orth
cec147ae5c
[ASan][test] Enable ASan tests on SPARC (#107405)
With PR #107223 and PR #107403, ASan testing can be enabled on SPARC.
This patch does so, 32-bit only on both Solaris and Linux. There is no
64-bit support even in GCC.

Apart from the obvious CMake changes, this patch includes a couple of
testcase adjustments necessary for SPARC:
- In `asan_oob_test.cpp`, the `OOB_int` subtest needs to be disabled: it
performs unaligned accesses that cannot work on a strict-alignment
target like SPARC.
- `asan_test.cpp` needs to disable subtests that depend on support for
`__builtin_setjmp` and `__builtin_longjmp`.
- `zero_page_pc.cpp` reports `0x5` as the faulting address on access to
`0x4`. I don't really know why, but it's consistent between Solaris and
Linux.

Tested on `sparcv9-sun-solaris2.11` and `sparc64-unknown-linux-gnu`.
2024-11-04 09:33:55 +01:00
Eisuke Kawashima
0af6c304e4
[NFC][compiler-rt] fix(compiler-rt/**.py): fix comparison to None (#94015)
from PEP8
(https://peps.python.org/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or
is not, never the equality operators.
2024-10-24 07:32:10 -07:00
David CARLIER
b8ee0aac2a
[compiler-rt] DumpAllRegisters implementation for windows arm64. (#112254) 2024-10-14 23:13:37 +01:00
David CARLIER
e866e6b8bb
[compiler-rt] Implements DumpAllRegisters for windows intel archs. (#108688) 2024-10-12 21:10:47 +01:00
David CARLIER
d0b9c2c564
[compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. (#110246)
To Fix #110215

Interceptors introduced with 18a7ebda99044473fdbce6376993714ff54e6690
2024-10-09 05:47:00 +01:00
David CARLIER
a8eb12cdc9
[compiler-rt] Reapply freadlink interception for macOs. (#110917)
Fixed test, needed explicit O_SYMLINK on symbolic link opening.
2024-10-08 23:50:39 +01:00
Hans Wennborg
c6b12bc829 Revert "[compiler-rt] intercept macOs's freadlink call. (#83679)"
The lit test has been failing on green dragon since it landed,
e.g. https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/2276/testReport/

This reverts commit a6ea0b0d2973d3d94f9ed7aac6db9ca722664774 and
follow-up commits ce72c76e9bd0bf74af614cae6a9f85cfd4720e95,
a280275cff497f96492d7c1094ba30309dbd3ad6, and
d705bd25eb9f11e100d3e79b65a80d446fd06f30.
2024-10-02 15:21:25 +02:00
David CARLIER
ce72c76e9b
[compiler-rt] XFAIL freadlink on darwin x86_64. (#110745)
GH-110372
2024-10-01 22:43:58 +01:00
David CARLIER
a6ea0b0d29
[compiler-rt] intercept macOs's freadlink call. (#83679)
available since macOs Ventura.
2024-09-25 07:28:07 +01:00
David CARLIER
a977b9460f
Reapply [compiler-rt] prctl interception update, SECCOMP_MODE_FILTER … (#109834)
…support. #107722
2024-09-24 19:15:50 +01:00
Nico Weber
99ade15d19 Revert "[compiler-rt] prctl interception update, SECCOMP_MODE_FILTER support. (#107722)"
This reverts commit b75174d05aa033a382d4c088e96e068a774f46da.
Does not build on Android, see comments on
https://github.com/llvm/llvm-project/pull/107722
2024-09-24 11:27:06 -04:00
David CARLIER
b75174d05a
[compiler-rt] prctl interception update, SECCOMP_MODE_FILTER support. (#107722) 2024-09-24 09:44:18 +01:00
Vitaly Buka
81c3499531 [NFC][sanitizer] Skip test if O_TMPFILE EINVAL on some FS 2024-09-22 18:46:58 -07:00
Vitaly Buka
1429204352 [NFC][sanitizer] Debug errno in test 2024-09-22 18:39:35 -07:00
Vitaly Buka
a0879f2054 [NFC][sanitizer] Skip O_TMPFILE if FS does not support it 2024-09-22 18:12:59 -07:00
Vitaly Buka
f5ec00b79b [NFC][sanitizer] Remove leftover from previous run 2024-09-22 16:22:25 -07:00
Vitaly Buka
397b96aa87 [NFC][sanitizer] Make test Android friendly 2024-09-22 16:16:24 -07:00
Vitaly Buka
2603c8b23b [NFC][sanitizer] Undo "RUN:" part of 4ab22d7b3cc92d08c6371df367ae21716d1b6942
It was not compartible with mobile tests.
2024-09-22 13:47:58 -07:00
Vitaly Buka
2e729bac35
[NFC][sanitizer] Debug test on bot
Remove unneded _GNU_SOURCE.
Add perror.
2024-09-22 12:57:55 -07:00
Vitaly Buka
76cffc2aa5 [sanitizer] Add O_TMPFILE test
For #108291
2024-09-22 12:35:57 -07:00
Vitaly Buka
4ab22d7b3c [NFC][sanitizer] Extract test from main function
And extract cleanup into RUN: command
2024-09-22 12:35:56 -07:00
Vitaly Buka
e5d174c792 [NFC][sanitizer] Don't use FileCheck in test
`assert` is enough.
2024-09-22 12:35:56 -07:00
Vitaly Buka
3ad3f05ac8 [NFC][tsan] Move variadic-open test
There is nothing Darwin or tsan specific in the test.

For #108291
2024-09-22 12:35:56 -07:00
Vitaly Buka
71a91c1194
[tsan] Use DlSymAllocator (#108920)
`DlSymAllocator` allows early allocations, when
tsan is not yet initialized, e.g. from `dlsym`.

All other sanitizers with interceptors already use
`DlSymAllocator`.

Existing `in_symbolizer()` tsan logic is very similar.
However, we need to keep both as `DlSymAllocator`
does not support large allocations, needed for Symolizer.
2024-09-17 11:06:26 -07:00
Vitaly Buka
f13b7d0b02
Reland "[sanitizer] Fix partially initialized static TLS range" (#108883)
Reland llvm/llvm-project#108685

Arguments order was wrong on Windows and Darwin.
2024-09-16 14:05:00 -07:00
Vitaly Buka
9a1d0744ed
Revert "[sanitizer] Fix partially initialized static TLS range" (#108881)
Reverts llvm/llvm-project#108685

Breaks Darwin and Windows
https://lab.llvm.org/buildbot/#/builders/107/builds/2930
https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/11684/
2024-09-16 13:51:23 -07:00
Vitaly Buka
b7c9ebe4ec
[sanitizer] Fix partially initialized static TLS range (#108685)
Fixes asan, msan crash on check added in #108684.
The #108684 includes reproducer of the issue.

Change interface of `GetThreadStackAndTls` to
set `tls_begin` and `tls_end` at the same time.
2024-09-16 12:48:24 -07:00
Vitaly Buka
0ea0e3a1b6
[sanitizer] Add CHECK that static TLS info is ready (#108684)
There is possibility of
static_tls_begin is set and static_tls_end is not yet

The test reproduces the case.
Stack trace looks like this:
* `MsanThread::Init`
* `SetThreadStackAndTls`
* `GetThreadStackAndTls`
* `GetThreadStackTopAndBottom`
* `pthread_getattr_np`
* `realloc`
* `__sanitizer_malloc_hook`
* TLS access
* `___interceptor___tls_get_addr`
* `DTLS_on_tls_get_addr`

The issue is that `SetThreadStackAndTls` implementation
stores `tls_begin` before `GetThreadStackTopAndBottom`,
and `tls_end` after. So we have partially initialized
state in `DTLS_on_tls_get_addr`.
2024-09-16 11:21:08 -07:00
Rainer Orth
d76966e317
[sanitizer_common][test] Disable sanitizer_coverage_trace_pc_guard.cp… (#108206)
…p etc. on SPARC

When enabling ASan testing on SPARC as per PR #107405, two tests `FAIL`:
```
  SanitizerCommon-asan-sparc-SunOS :: sanitizer_coverage_trace_pc_guard-dso.cpp
  SanitizerCommon-asan-sparc-SunOS :: sanitizer_coverage_trace_pc_guard.cpp

```
The issue is the same in both cases:
```
WARNING: No coverage file for projects/compiler-rt/test/sanitizer_common/asan-sparc-SunOS/Output/sanitizer_coverage_trace_pc_guard.cpp.tmp
WARNING: No coverage file for sanitizer_coverage_trace_pc_guard.cpp.tmp.22766.sancov
ERROR: No valid coverage files given.

```
Checking the file with `sancov -print` reveals `Wrong magic:
4294967090`. There seems to be an endianess bug somewhere, since the
tests are already disabled on other big-endian targets.

This patch matches this.

Tested on `sparcv9-sun-solaris2.11`.
2024-09-16 09:45:20 +02:00
Vitaly Buka
f0b3287297
[sanitizer] Disable new test on powerpc64le (#108505)
The reason is not clear
https://lab.llvm.org/buildbot/#/builders/72/builds/3260

The test was introduced in #108349.
2024-09-12 23:33:11 -07:00
Vitaly Buka
55afd5b9e8 [sanitizer] Try to fix the test on powerpc bot
It silently fails with tsan.
https://lab.llvm.org/buildbot/#/builders/72/builds/3257
2024-09-12 22:54:00 -07:00
Arthur Eubanks
d9ed8b018d
[test][compiler-rt] Mark dlsym_alloc.c as unsupported on macos (#108439)
With #106912, the test now fails on macos, e.g.

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/2058/.
2024-09-12 20:52:24 -07:00
Vitaly Buka
95eab0d195
[sanitizer] Test for __sanitizer_get_dtls_size (#108349)
Test for #108348 which is almost NFC. However, the test
may fail on some platforms, and a few iterations could be
needed to filter out unsupported platforms.
2024-09-12 13:43:42 -07:00
tmiasko
ae0ed3d586
[lsan] Fix free(NULL) interception during initialization (#106912)
Previously an attempt to free a null pointer during initialization would
fail on ENSURE_LSAN_INITED assertion (since a null pointer is not owned
by DlsymAlloc).
2024-09-11 15:37:02 -07:00
Vitaly Buka
1797174ea6
[NFC][sanitizer] Commit test for #106912 (#108289)
Almost all sanitizers already support the test.
* Tsan does not use DlsymAlloc yet.
* Lsan will support with #106912.

memprof,rtsan,nsan are not tested as part of
sanitizer_common, but we should keep them here to
show up when it happen.

---------

Co-authored-by: Xiaofeng Tian <110771974+txff99@users.noreply.github.com>
2024-09-11 14:44:06 -07:00
Vitaly Buka
086ee762cb [sanitizer] Remove "null" for 256 allocations in test
Very rarely this case can return all non-null
for all allocations, making this test flaky.
2024-09-06 15:30:17 -07:00