19343 Commits

Author SHA1 Message Date
Brad Smith
e0cd57decb
[compiler-rt] Remove support and workarounds for Android 4 and older (#124056) 2025-01-23 13:00:39 -05:00
Ellis Hoag
a2453097e3
[llvm-profdata] Add block percent to detailed summary (#105915) 2025-01-23 09:30:23 -08:00
Paweł Bylica
091741a880
[libfuzzer] Clarify -max_len behavior on bigger files (#123095) 2025-01-23 09:19:21 +01:00
David CARLIER
939f2900d0
[compiler-rt][rtsan] getsockopt/setsockopt interception. (#124004) 2025-01-22 23:23:32 +00:00
David CARLIER
630177ccdd
[compiler-rt][rtsan] Fix madvise/posix_madvise for macOs. (#124020)
only bsd and linux intercept these syscalls.
Fix #123601
2025-01-22 23:03:48 +00:00
Victor Campos
ffde2687be
[compiler-rt] Make Arm builtins aware of endianness in VMOVs (#123204)
This patch makes Arm builtins aware of endianness in VMOVs.

Before this patch, the functions' definitions assumed little endian,
which made any program compiled for big endian incorrect.
2025-01-22 10:56:48 +00:00
David CARLIER
c745ece254
[compiler-rt][rtsan] page regions api interception update. (#123601)
madvise/mprotect/msync/mincore calls with care for signature difference
for the latter.
2025-01-22 10:40:04 +00:00
David CARLIER
6123a81b47
[compiler-rt][rtsan] Fix process_vm_readv/process_vm_writev signatures. (#123914)
missing pid_t first argument. Fix #123839
2025-01-22 19:05:58 +09:00
bernhardu
56592a8108
[win/asan] GetInstructionSize: Support some more 4 byte instructions. (#123709)
This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
                https://bugs.winehq.org/show_bug.cgi?id=50993
                https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
                https://bugs.winehq.org/show_bug.cgi?id=52386
                https://bugs.winehq.org/attachment.cgi?id=71626
```
2025-01-22 10:27:05 +01:00
bernhardu
5f40570714
[win/asan] GetInstructionSize: Support some more 5 byte instructions. (#123844)
This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.
```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
                https://bugs.winehq.org/show_bug.cgi?id=50993
                https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
                https://bugs.winehq.org/show_bug.cgi?id=52386
                https://bugs.winehq.org/attachment.cgi?id=71626
```
2025-01-22 10:22:02 +01:00
Yi Kong
2ee36d40f0
[compiler-rt][rtsan] Fix sendmmsg and recvmmsg rtsan interceptor for MUSL (#123907)
MUSL have different signatures for sendmmsg and recvmmsg.

This fixes build breakage from #123484.
2025-01-22 18:18:18 +09:00
David CARLIER
8fad58a648
[compiler-rt][rtsan] process_vm_readv/process_vm_writev interception. (#123839) 2025-01-22 06:23:39 +00:00
David CARLIER
a31e25396e
[compiler-rt][rtsan] Fix recvmmsg rtsan interceptor for glibc < 2.21 (#123664)
linux/glibc prior to 2.21 had a different signature for recvmmsg.

Fix llvm#123484
2025-01-21 18:54:48 +00:00
Kyle Evans
a79098bc72
[compiler-rt] Destroy pthread attrs after use in tests (#114923)
The attr typically located on the stack is of an opaque pthread_attr_t
type, which may be a pointer that gets initialized by
pthread_attr_init(). Explicitly clean up the attr with
pthread_attr_destroy() to avoid a leak on such platforms to avoid
unexpected test failures with lsan enabled.

This primarily affects FreeBSD; NetBSD, musl, and glibc will seemingly
all use a full-sized pthread_attr_t.
2025-01-21 16:28:33 +00:00
Ami-zhang
79231a8684
[ORC-RT][LoongArch] Add initial support for loongarch64 in ELFNixPlatform (#123575)
Enable ELFNixPlatform support for loongarch64. These are few simple
changes, but it allows us to use the orc runtime in ELF/LoongArch64
backend.

This change adds test cases targeting the LoongArch64 Linux platform to
the ORC runtime integration test suite. Since jitlink for loongarch64 is
ready for general use, and ELF-based platforms support defining multiple
static initializer table sections with differing priorities, some
relevant test cases in compiler-rt for ELFNixPlatform support can be
enabled.
2025-01-21 14:25:03 +08:00
bernhardu
57466db7a4
[win/asan] GetInstructionSize: Support some more 3 byte instructions. (#120474)
This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
                https://bugs.winehq.org/show_bug.cgi?id=50993
                https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
                https://bugs.winehq.org/show_bug.cgi?id=52386
                https://bugs.winehq.org/attachment.cgi?id=71626
```
2025-01-20 14:25:52 +01:00
David CARLIER
18d5d84d76
[compiler-rt][rtsan] intercept getpeername/recvmmsg/sendmmsg (#123484) 2025-01-20 08:11:33 +00:00
David CARLIER
02909a4046
[compiler-rt] rtsan pipe2 interception for Linux. (#123517)
completing fpurge interception for mac too.
2025-01-20 07:55:40 +00:00
David CARLIER
4aedb97009
[compiler-rt][rtsan] getsockname interception. (#123409) 2025-01-18 07:53:45 +00:00
Alexander Richardson
bbac349341
[compiler-rt] Install libc++ and libc++abi in build_symbolizer.sh (#123104)
This ensures that the directory layout of the libc++/libc++abi matches
exactly what we would get on a real installation. Currently the build
directory happens to match the install directory layout, but this will
no longer be true in the future.
2025-01-15 15:13:06 -08:00
David CARLIER
d15d410a35
[compiler-rt][rtsan] Fix fseek test build (unused variable warning). (#123116) 2025-01-15 20:33:18 +00:00
Wael Yehia
6ffc445103 [PGO][AIX] Disable multi-process continuous mode test in 32-bit
In PGO continuous mode, we mmap the profile file into shared memory, which
allows multiple processes to be updating the same memory.

The -fprofile-update=atomic option forces the counter increments to be atomic,
but the counter size is always 64-bit (in -m32 and -m64), so in 32-bit mode the
atomic operations are function calls to libatomic.a and these function calls use
locks.

The lock based libatomic.a functions are per-process, so two processes will race
on the same shared memory because each will acquire their own lock.
2025-01-15 19:21:14 +00:00
David CARLIER
c4443a1be4
[compiler-rt][rtsan] fseek api interception. (#122163) 2025-01-15 18:31:27 +00:00
David CARLIER
da4551aad0
[compiler-rt][sanitizer_common] Fix for solaris and *BSD platforms proposal. (#122956)
To fix llvm#122795 build failures for these.
2025-01-15 13:31:14 +00:00
Lang Hames
2a5281d0e0 [ORC-RT] Fix missing '\' line continuations in objc-imageinfo.S test.
These missing continuations were causing commands in this testcase to fail.
2025-01-15 13:21:28 +11:00
Paul Kirth
44d9beef7d
[rtsan][test] Prevent test check from being optimized out in LTO builds (#122524)
In LTO builds, some test checks can be optimized away, since the
compiler can
see through the memory accesses after inlining across TUs. This causes
the existing death tests to fail, since the functions are completely
optimized out and things like copying a lambda will no longer occur and
trigger the sanitizer.

To prevent that, we can use an empty inline assembly block to tell the
compiler that memory is modified, and prevent it from doing that.
2025-01-14 11:55:19 -08:00
David CARLIER
8d9dcd111e
[compiler-rt] fseek interception update. (#122795)
fseek api is POSIX.

to also address #122163
2025-01-14 16:56:32 +00:00
Zack Johnson
c33486954b
[ASan] Change strdup interceptor to allow null input on Windows (#122803)
[These are the MS
Docs](https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strdup-wcsdup-mbsdup?view=msvc-170)
regarding `strdup`, but they don't explicitly mention this. The SAL
annotations on `strdup` do, though, with the input parameter being
marked `_In_opt_z_`.
2025-01-14 11:53:01 -05:00
ChiaHungDuan
a8d2aeec87
[scudo] Fix the format of getStats() (#121608)
This is a quick fix for b71c44b9be17dc6295eb733d685b38e797f3c846

"last released" was removed by accident in primary64.h and the update of
"NumReleasesAttempted" was missing.
2025-01-13 14:17:48 -08:00
gbMattN
09a8b7cbc2
[TySan] Fix struct access with different bases (#120412)
Original pull request
[here](https://github.com/llvm/llvm-project/pull/108385)
Fixes issue https://github.com/llvm/llvm-project/issues/105960

If a member in a struct is also a struct, accessing a member partway
through this inner struct currently causes a false positive. This is
because when checking aliasing, the access offset is seen as greater
than the starting offset of the inner struct, so the loop continues one
iteration, and believes we are accessing the member after the inner
struct.

The next member's offset is greater than the offset we are looking for,
so when we subtract the next member's offset from what we are looking
for, the offset underflows.

To fix this, we check if the member we think we are accessing has a
greater offset than the offset we are looking for. If so, we take a step
back. We cannot do this in the loop, since the loop does not check the
final member. This means the penultimate member would still cause false
positives.
2025-01-13 15:28:37 +00:00
bernhardu
99612a3a18
[win/asan] GetInstructionSize: Support some more 2 byte instructions. (#120235)
This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
                https://bugs.winehq.org/show_bug.cgi?id=50993
                https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
                https://bugs.winehq.org/show_bug.cgi?id=52386
                https://bugs.winehq.org/attachment.cgi?id=71626
```

CC: @zmodem
2025-01-13 15:21:03 +01:00
bernhardu
9a9e41ca89
[win/asan] GetInstructionSize: Add test for 8D A4 24 .... (#119794)
This adds a test line and updates a comment.
2025-01-11 18:54:35 +01:00
Lang Hames
99d2ff54ab [ORC-RT] Use llvm-jitlink -num-threads=0 for objc-imageinfo.S tests.
These testcases depend on debugging output, which isn't stable under concurrent
linking.
2025-01-10 17:53:56 +11:00
Florian Hahn
e8c8543a1c
[TySan] Intercept malloc_size on Apple platforms. (#122133)
After https://github.com/llvm/llvm-project/pull/120563 malloc_size also
needs intercepting on Apple platforms, otherwise all type-sanitized
binaries crash on startup with an objc error:
realized class 0x12345 has corrupt data pointer: malloc_size(0x567) = 0

PR: https://github.com/llvm/llvm-project/pull/122133
2025-01-09 20:55:36 +00:00
Nikita Popov
4847395c54
[Clang] Adjust pointer-overflow sanitizer for N3322 (#120719)
N3322 makes NULL + 0 well-defined in C, matching the C++ semantics.
Adjust the pointer-overflow sanitizer to no longer report NULL + 0 as a
pointer overflow in any language mode. NULL + nonzero will of course
continue to be reported.

As N3322 is part of
https://www.open-std.org/jtc1/sc22/wg14/www/previous.html, and we never
performed any optimizations based on NULL + 0 being undefined in the
first place, I'm applying this change to all C versions.
2025-01-09 09:23:23 +01:00
Tristan Ross
783dc59b3b
[compiler-rt] Check codesign in path before using (#99837)
Fixes an issue discovered with Nix where codesign is executed but Nix
cannot use codesign without faults. Use `find_program` in CMake to
ensure it is in `$PATH`.

Can be tested on macOS and change your path in such a way that
`codesign` isn't in it.

Related: https://github.com/NixOS/nixpkgs/pull/329058
2025-01-08 18:57:32 -08:00
David CARLIER
7004d6815b
[compiler-rt][rtsan] adding setlinebuf/setbuffer interception. (#122018)
catering to platform differences as those calls are not posix.
2025-01-08 13:22:09 +00:00
gbMattN
20d7fa1cc3
[TySan] Added a 'print_stacktrace' flag for more detailed errors (#121756)
Raised in issue #121697
2025-01-08 10:20:20 +00:00
thetruestblue
75325c658e
[Darwin][CompilerRT] Set compiler ID to 'Clang' for Compiler RT Tests for Apple Clang (#121858)
This patch restores previous behavior. Even when the Compiler ID is set
to AppleClang, we expect Compiler RT Tests to use Clang as the compiler
ID. This impacts various make and lit commands.

Caused by: https://github.com/llvm/llvm-project/pull/117812/files

rdar://141548700
2025-01-07 13:19:55 -08:00
Caslyn Tonelli
478648e2c0
[gwp_asan] Soft-transition ZXTEST_USE_STREAMABLE_MACROS removal (#121887)
Soft-transition the removal of setting ZXTEST_USE_STREAMABLE_MACROS, by
only setting the macro if not already defined. A future PR will remove
setting the macro entirely in harness.h.
2025-01-07 10:03:31 -08:00
David CARLIER
937445365a
[compiler-rt][rtsan] Reland posix part of #121616 setbuf, setvbuf. (#121658) 2025-01-07 16:21:45 +00:00
earnol
b7a6e9da12
[ubsan] Use internal_memcpy to copy ubsan bits size (#121586)
While fetching amounts of bits used to correctly display ubsan value
reinterpret_cast was used, however as noted by Jakub Jelínek in
https://github.com/llvm/llvm-project/pull/96240 discussion it might
cause issues due to potentially unaligned memory access. The patch
addresses this problem.

Co-authored-by: Vladislav Aranov <vladislav.aranov@ericsson.com>
2025-01-07 10:59:53 -05:00
Amara Emerson
cb5d866fee [AArch64][SME] Add Darwin specific SME ABI routines.
Our platform has some constraints that allow us to make assumptions that
aren't generally applicable to other platforms. We keep an entirely separate
.s file for the routines.
2025-01-06 09:51:41 -08:00
Amara Emerson
3c8344f7ba
[AArch64][SME] Fix broken compiler check for SME2 support in compiler-rt (#121625)
This compile time test uses inline asm with `.arch` directives to set
the target feature. It is however broken and always fails, since each
`asm()` construct in LLVM sets up a new AsmParser, and therefore the
`.arch` directive has no effect on later `asm()` contents. To fix this
we need to use a single inline `asm()` call with the entire code chunk
to emit contained inside.
2025-01-06 01:37:56 -08:00
David CARLIER
d1d400372a
[compiler-rt][rtsan] fix unit tests by sanitizer-aarch64-linux report. (#121666) 2025-01-04 21:46:08 +00:00
David CARLIER
59354a865f
[compiler-rt][rtsan] intercept fflush. (#121643) 2025-01-04 20:15:05 +00:00
David CARLIER
c7fa3cf620
Revert "[compiler-rt][rtsan] intercept setbuf, setvbuf, setlinebuf an… (#121639)
…d setbuffer (#121616)"

This reverts commit 95db1116c5718004e0bd7c3b79d39987fdbbff32.
2025-01-04 11:35:31 +00:00
David CARLIER
95db1116c5
[compiler-rt][rtsan] intercept setbuf, setvbuf, setlinebuf and setbuffer (#121616) 2025-01-04 10:52:41 +00:00
David CARLIER
85849917f7
[compiler-rt][rtsan] Reland "fopencookie support." (#120864) (#121547) 2025-01-03 11:16:34 +00:00
Fangrui Song
82fecab85a [gcov] Bump default version to 11.1
The gcov version is set to 11.1 (compatible with gcov 9) even if
`-Xclang -coverage-version=` specified version is less than 11.1.

Therefore, we can drop producer support for version < 11.1.
2025-01-02 23:01:28 -08:00