17965 Commits

Author SHA1 Message Date
Enna1
bd1324113e
[MemProf][NFC] Clean up runtime code (#80581) 2024-02-07 09:55:32 +08:00
Enna1
397e91f0f3
[MemProf][NFC] Compute SHADOW_ENTRY_SIZE from MEM_GRANULARITY and SHA… (#80589)
…DOW_SCALE

As MEM_GRANULARITY represents the size of memory block mapped to a
single shadow entry, and SHADOW_SCALE represents the scale of shadow
mapping, so the single shadow entry size can be computed as
(MEM_GRANULARITY >> SHADOW_SCALE).

This patch replaces the hardcoded SHADOW_ENTRY_SIZE with
(MEM_GRANULARITY >> SHADOW_SCALE).
2024-02-06 14:25:55 +08:00
Enna1
abe102b872
[Sanitizer][NFC] Replaces a few InternalScopedString::AppendF with InternalScopedString::Append (#80574) 2024-02-06 09:18:06 +08:00
Florian Mayer
c3291253c3
Revert "[scudo] [MTE] resize stack depot for allocation ring buffer" (#80777)
Reverts llvm/llvm-project#74515

Broke build: https://lab.llvm.org/buildbot/#/builders/75/builds/42512
2024-02-05 16:56:39 -08:00
Florian Mayer
eff77d8456
[scudo] [MTE] resize stack depot for allocation ring buffer (#74515)
Co-authored-by: ChiaHungDuan <f103119@gmail.com>
2024-02-05 16:47:02 -08:00
ChiaHungDuan
8ce036d539
[scudo] Add ScopedTSD to avoid releasing TSD manually (#80061)
This makes the use of TSD be RAII style and avoid the exposing of the
type of TSDs.

Also move some thread safety analyses from static to runtime because of
its limitation. Even we mark some code path as NO_THREAD_SAFETY_ANALYSIS
but we still have the `assertLocked()` cover the correctness.
2024-02-05 14:36:04 -08:00
Zequan Wu
dd22140e21
[Profile][Windows] Drop extern for __buildid. (#80700) 2024-02-05 15:27:34 -05:00
Freddy Ye
72105605d1
[X86] Support more ISAs to enable __builtin_cpu_supports (#79086)
This patch will also expand supports for attribute/target, while
the priority of newly supported ISAs will be set to zero.
2024-02-04 21:21:12 +08:00
Martin Storsjö
248aeac1ad
[compiler-rt] Remove duplicate MS names for chkstk symbols (#80450)
Prior to 885d7b759b5c166c07c07f4c58c6e0ba110fb0c2, the builtins library
contained two chkstk implementations for each of i386 and x86_64, one
that was used in mingw environments, and one unused (with a symbol name
not matching anything that is used anywhere). Some of the functions
additionally had other, also unused, aliases.

After cleaning this up in 885d7b759b5c166c07c07f4c58c6e0ba110fb0c2, the
unused symbol names were removed.

At the same time, symbol aliases were added for the names as they are
used by MSVC; the functions are functionally equivalent, but have
different names between mingw and MSVC style environments.

By adding a symbol alias (so that one object file contains two different
symbols for the same function), users can run into problems with
duplicate definitions, if they themselves define one of the symbols (for
various reasons), but need to link in the other one.

This happens for Wine, which provides their own definition of
"__chkstk", but when built in mingw mode does need compiler-rt to
provide the mingw specific symbol names; see
https://github.com/mstorsjo/llvm-mingw/issues/397.

To avoid the issue, remove the extra MS style names. They weren't
entirely usable as such for MSVC style environments anyway, as
compiler-rt builtins don't build these object files at all, when built
in MSVC mode; thus, the effort to provide them for MSVC style
environments in 885d7b759b5c166c07c07f4c58c6e0ba110fb0c2 was a
half-hearted step towards that.

If we really do want to provide those functions (as an alternative to
the ones provided by MSVC itself), we should do it in a separate object
file (even if the function implementation is the same), so that users
who have a definition of one of them but need a definition of the other,
won't have conflicts.

Additionally, if we do want to provide them for MSVC, those files
actually should be built when building the builtins in MSVC mode as well
(see compiler-rt/lib/builtins/CMakeLists.txt).

If we do that, there's a risk that an MSVC style build ends up linking
in and preferring our implementation over the one provided by MSVC,
which would be suboptimal. Our implementation always probes the
requested amount of stack, while the MSVC one checks the amount of
allocated stack and only probes as much as really is needed.

In short - this reverts the situation to what it was in the 17.x release
series (except for unused functions that have been removed).
2024-02-03 14:52:49 +01:00
Jon Roelofs
659419ac2f
[builtins][FMV] Remove dead include from fmv/apple.inc. NFC 2024-02-02 13:41:21 -08:00
Fangrui Song
648560062a
[dfsan] Wrap glibc 2.38 __isoc23_* functions (#79958)
Fix #79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.

Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/D158943 for other sanitizers.

`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.
2024-01-30 13:58:40 -08:00
Evgenii Stepanov
c82f3caf56
[scudo] Add StackDepot lock to enable/disable. (#79670)
Scudo grabs all allocator locks in a pthread_atfork before the fork, and releases them after. This allows malloc to be used in a fork child of a multithreaded process, which is expressly forbidden by the standard, but very widely used. For example, Android's init uses std::string after fork when spawning services in android::init::EnterNamespaces and other places.

Any lock that is necessary to serve an allocator call must be handled this way. Otherwise there is a possibility that the lock is held during the call to fork, which results in it being held forever in the child process, and the next operation that needs it deadlocks.
2024-01-29 14:22:24 -08:00
Vitaly Buka
8dbedf49d7
[sanitizer] Allow *___lcxx_override symbolse in symbolizer (#79904)
We don't intercept them, and they are not called and used only as
markers anyway.

These symbols introduced with #69498.
2024-01-29 13:57:02 -08:00
Enna1
a372460538
[Sanitizer][NFC] Fix up comment in atomic_store of sanitizer_atomic_clang_*.h 2024-01-29 15:20:55 +01:00
Peter Waller
2e2b6b53f5
[AArch64][compiler-rt] Avoid use of libc header in sme-libc-routines (#79454)
The use of `#include <stdlib.h>` introduces a libc dependency. In many
build environments such a file can be found under e.g. /usr/include, but
this does not necessarily correspond to the libc in use, which may not
be available until after the builtins have been built.

So far as I understand, it's not valid to have a dependency on libc from
builtins; there are a handful of such includes in builtins, but they are
protected by ifdefs.

Instead, use <stddef.h>, which provides `size_t` and is provided by the
compiler's resource headers and so should always be available.
2024-01-29 11:07:02 +00:00
Sam James
e8f882f83a
[sanitizer] Handle Gentoo's libstdc++ path
On Gentoo, libc++ is indeed in /usr/include/c++/*, but libstdc++ is at
e.g. /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14.

Use '/include/g++' as it should be unique enough. Note that the omission of
a trailing slash is intentional to match g++-*.

See https://github.com/llvm/llvm-project/pull/78534#issuecomment-1904145839.

Reviewed by: mgorny
Closes: https://github.com/llvm/llvm-project/pull/79264

Signed-off-by: Sam James <sam@gentoo.org>
2024-01-27 06:56:12 +00:00
Jon Roelofs
9b48aa203a
[compiler-rt][builtins][FMV] Early exit in the Apple __init_cpu_features_resolver(). NFC 2024-01-26 09:22:20 -08:00
Enna1
ac6f9a785c Reland "[MemProf] Add missing header to list of installed headers. (#79413)"
This reland commit 0a3b5ece0e51b85e4674388f46a0205c4361f76e with fix.
2024-01-26 14:53:41 +08:00
Enna1
f174648b6c Revert "[MemProf] Add missing header to list of installed headers. (#79413)"
This reverts commit 0a3b5ece0e51b85e4674388f46a0205c4361f76e.
2024-01-26 14:50:49 +08:00
Enna1
0a3b5ece0e
[MemProf] Add missing header to list of installed headers. (#79413)
There were buildbot failures when running memprof tests: 
Failed Tests (12):
  MemProfiler-x86_64-linux :: TestCases/interface_test.cpp
  MemProfiler-x86_64-linux :: TestCases/log_path_test.cpp
  MemProfiler-x86_64-linux :: TestCases/memprof_merge_mib.cpp
  MemProfiler-x86_64-linux :: TestCases/memprof_profile_dump.cpp
  MemProfiler-x86_64-linux :: TestCases/profile_reset.cpp
  MemProfiler-x86_64-linux :: TestCases/unaligned_loads_and_stores.cpp
  MemProfiler-x86_64-linux-dynamic :: TestCases/interface_test.cpp
  MemProfiler-x86_64-linux-dynamic :: TestCases/log_path_test.cpp
  MemProfiler-x86_64-linux-dynamic :: TestCases/memprof_merge_mib.cpp
  MemProfiler-x86_64-linux-dynamic :: TestCases/memprof_profile_dump.cpp
  MemProfiler-x86_64-linux-dynamic :: TestCases/profile_reset.cpp
MemProfiler-x86_64-linux-dynamic ::
TestCases/unaligned_loads_and_stores.cpp

See
- https://lab.llvm.org/buildbot/#/builders/258/builds/8852
- https://lab.llvm.org/buildbot/#/builders/258/builds/12876

I suspect the failure is because when build with
-DLLVM_ENABLE_RUNTIMES=compiler-rt -DCOMPILER_RT_BUILD_SANITIZERS=OFF,
the headers sanitizer/allocator_interface.h and
sanitizer/common_interface_defs.h
are not copied to the build tree, and not installed.
But in the failed memprof tests,
sanitizer/allocator_interface.h or sanitizer/memprof_interface.h is
included.

This patch adds sanitizer/allocator_interface.h and
sanitizer/memprof_interface.h to memprof headers if
COMPILER_RT_BUILD_SANITIZERS is false.
2024-01-26 09:18:19 +08:00
Thurston Dang
720769de9f
[tsan] Lazily call 'personality' to minimize sandbox violations (#79334)
My previous patch, "Re-exec TSan with no ASLR if memory layout is incompatible on Linux (#78351)" (0784b1eefa36d4acbb0dacd2d18796e26313b6c5) hoisted the 'personality' call, to share the code between Android and non-Android Linux. Unfortunately, this eager call to 'personality' may trigger sandbox violations on non-Android Linux.

This patch fixes the issue by only calling 'personality' on non-Android Linux if the memory mapping is incompatible. This may still cause a sandbox violation, but only if it was going to abort anyway due to an incompatible memory mapping.

(The behavior on Android Linux is unchanged by this patch or the previous patch.)
2024-01-25 12:07:48 -08:00
Thurston Dang
143f71e03a [sanitizer_common] Fix type in format specifier by casting
40dcf24522af91ab22af2e69f28d1f1d2a860f5c had changed the format
specifier to fix the build for their local system. Unfortunately,
that disagrees with some other systems, such as this buildbot:
https://lab.llvm.org/buildbot/#/builders/37/builds/30440

This patch fixes the issue for all systems by casting.
2024-01-25 19:17:02 +00:00
Alexandre Ganea
40dcf24522 [compiler-rt] Silence warning when building with Clang ToT
This fixes:
```
[24/47] Generating SANITIZER_TEST_OBJECTS.sanitizer_bitvector_test.cpp.i386.o
C:/git/llvm-project/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp:74:29: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'value_type' (aka 'unsigned long') [-Wformat]
   74 |     fprintf(stderr, "%zu ", *it);
      |                      ~~~    ^~~
      |                      %lu
1 warning generated.
```
2024-01-25 09:34:18 -05:00
Jordan Rupprecht
96ec447a6a [NFC] Fix various unintentional //namespace formatting 2024-01-24 21:17:45 -08:00
David CARLIER
16a1ef86cb
[compiler-rt] remove hexdump interception. (#79378)
a freebsd dev member reported a symbol conflict and intercepting this
had little value anyway.
2024-01-24 23:07:32 +00:00
Tom Stellard
f6ca6ed528 Revert "compiler-rt: Fix FLOAT16 feature detection"
This reverts commit aaa93ce7323332d8290b8f563d4d71689c1094c5.

This commit was not properly reviewed.
2024-01-24 12:38:09 -08:00
Tom Stellard
aaa93ce732 compiler-rt: Fix FLOAT16 feature detection
CMAKE_TRY_COMPILE_TARGET_TYPE defaults to EXECUTABLE, which causes
any feature detection code snippet without a main function to fail,
so we need to make sure it gets explicitly set to STATIC_LIBRARY.

Bug: https://github.com/ROCm/rocFFT/issues/439
Bug: https://github.com/ROCm/rocBLAS/issues/1350
Bug: https://bugs.gentoo.org/916069
Closes: https://github.com/llvm/llvm-project/pull/69842

Reviewed by: thesamesam, mgorny
2024-01-24 15:09:15 +00:00
Chris Apple
c28ab62743
[NFCI] Move SANITIZER_WEAK_IMPORT to sanitizer_common (#79208)
SANITIZER_WEAK_IMPORT is useful for any call that needs to be
conditionally linked in. This is currently used for the
tsan_dispatch_interceptors, but can be used for other calls introduced
in newer versions of MacOS. (such as `aligned_alloc` in this PR
https://github.com/llvm/llvm-project/pull/79198).

This PR moves the definition to a higher level so it can be used in
other sanitizers.
2024-01-23 14:42:59 -08:00
AtariDreams
3c20e25b0c
[NFC] Size and element numbers are often swapped when calling calloc (#79081)
gcc-14 will now throw a warning if size and elements are swapped.
2024-01-23 11:13:55 -08:00
Jeremy Morse
5176df55d3 [CompilerRT] Attempt to fix a lit-config issue
This is a follow-up to 3112578597c03 -- it looks like passing the added
cmake flag to pythonize_bool also appends "_PYBOOL" to the flag name, which
this lit config file is missing. This trips up builds such as:

  https://lab.llvm.org/buildbot/#/builders/275/builds/3661
  https://lab.llvm.org/buildbot/#/builders/184/builds/9811

Where COMPILER_RT_HAS_AARCH64_SME ends up expanding to nothing.
2024-01-23 16:58:31 +00:00
Alexandros Lamprineas
179ba129f5
[AArch64][FMV] Support feature MOPS in Function Multi Versioning. (#78788)
The patch adds support for FEAT_MOPS (Memory Copy and Memory Set
instructions) in Function Multi Versioning. The bits [19:16] of the
system register ID_AA64ISAR2_EL1 indicate whether FEAT_MOPS is
implemented in AArch64 state. This information is accessible via ELF
hwcaps.
2024-01-23 15:48:12 +00:00
Qiongsi Wu
291ac25298
[PGO] Remove calls to __llvm_orderfile_dump() in instrprof-api.c test (#79150)
https://github.com/llvm/llvm-project/pull/78285 added a test which calls
`__llvm_orderfile_dump()`, a functionality that is not supported on many
platforms. This PR removes the call to `__llvm_orderfile_dump()` to
avoid it failing on unsupported platforms, and turn on the test for
Windows, so we test the rest of the API that are supported.
2024-01-23 10:26:59 -05:00
Dinar Temirbulatov
5f47687c82 Remove config.aarch64_sme from compiler-rt/unittests/lit.common.unit.configured.in 2024-01-23 15:19:36 +00:00
Dinar Temirbulatov
3112578597 [AArch64][compiler-rt] Add memcpy, memset, memmove, memchr builtins. (#77496)
Add naive implementation of memcpy, memset, memmove, memchr for SME
targets.
Co-authored-by: David Sherwood <david.sherwood@arm.com>
2024-01-23 11:26:20 +00:00
Douglas Yung
bffd80d6df Revert "[AArch64][compiler-rt] Add memcpy, memset, memmove, memchr builtins. (#77496)"
This reverts commit 3ab8d2aac7bc2dd45dda3db0b8a71fd27eefb749.

This change is causing issues running lit tests on many bots including:
- https://lab.llvm.org/buildbot/#/builders/197/builds/12119
- https://lab.llvm.org/buildbot/#/builders/184/builds/9792
- https://lab.llvm.org/buildbot/#/builders/93/builds/18455
- https://lab.llvm.org/buildbot/#/builders/231/builds/19858
- https://lab.llvm.org/buildbot/#/builders/121/builds/38426
- https://lab.llvm.org/buildbot/#/builders/230/builds/23990
- https://lab.llvm.org/buildbot/#/builders/57/builds/32391
- https://lab.llvm.org/buildbot/#/builders/247/builds/13502
- https://lab.llvm.org/buildbot/#/builders/275/builds/3601
- https://lab.llvm.org/buildbot/#/builders/269/builds/4211
- https://lab.llvm.org/buildbot/#/builders/18/builds/14161
- https://lab.llvm.org/buildbot/#/builders/19/builds/23893
- https://lab.llvm.org/buildbot/#/builders/37/builds/30295
- https://lab.llvm.org/buildbot/#/builders/77/builds/33979
2024-01-22 18:21:09 -08:00
Dinar Temirbulatov
3ab8d2aac7
[AArch64][compiler-rt] Add memcpy, memset, memmove, memchr builtins. (#77496)
Add naive implementation of memcpy, memset, memmove, memchr for SME
targets.
Co-authored-by: David Sherwood <david.sherwood@arm.com>
2024-01-22 23:40:53 +00:00
Dimitry Andric
042bb2850d
[tsan] Fix build for FreeBSD and NetBSD after 0784b1eefa36 (#79019)
In 0784b1eefa36 some code for re-execution was moved to
`ReExecIfNeeded()`, but also extended with a few Linux-only features.
This leads to compile errors on FreeBSD, or other non-Linux platforms:

compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:247:25: error: use of
undeclared identifier 'personality'
      247 |   int old_personality = personality(0xffffffff);
          |                         ^
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:249:54: error: use of
undeclared identifier 'ADDR_NO_RANDOMIZE'
249 | (old_personality != -1) && ((old_personality & ADDR_NO_RANDOMIZE)
== 0);
          |                                                      ^
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:281:46: error: use of
undeclared identifier 'ADDR_NO_RANDOMIZE'
281 | CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
          |                                              ^

Surround the affected part with a `#if SANITIZER_LINUX` block for now.
2024-01-23 00:06:07 +01:00
Qiongsi Wu
4f21fb8447
[PGO] Reland PGO's Counter Reset and File Dumping APIs #76471 (#78285)
https://github.com/llvm/llvm-project/pull/76471 caused buildbot failures
on Windows. For more details, see
https://github.com/llvm/llvm-project/issues/77546.

This PR revises the test and relands
https://github.com/llvm/llvm-project/pull/76471.
2024-01-22 14:54:58 -05:00
Jon Roelofs
c083b38007
[builtins][FMV][Apple] Use builtin atomic load/store, instead of libdispatch (#78807) 2024-01-22 09:10:16 -08:00
Fangrui Song
ebd4dc4263
[asan,test] Make alloca_loop_unpoisoning.cpp robust and fix s390x failure (#78774)
In the test from https://reviews.llvm.org/D7098, `char array[len];` is
32-byte aligned on most targets whether it is instrumented or not
(optimized by StackSafetyAnalysis), due to the the used `*FrameLowering`
being `StackRealignable`.

However, when using `SystemZELFFrameLowering`, an un-instrumented
`char array[len];` is only 8-byte aligned.

Ensure `char array[len];` gets instrumented like what we did to
`alloca_vla_interact.cpp`, to make the test pass on s390x.
2024-01-22 08:56:00 -08:00
Wu Yingcong
8bef13ef4f
[hwasan] Fix a possible null dereference problem (#77737)
This is clearly a copy-paste mistake, fix it with this patch.
After checking the `local.function_name` is not null, it should check
the len for `local.function_name`, not `local.name`. And this could lead
to possible null dereference since the second
`internal_strlen(local.name)` does not guarantee `local.name` is not
null.
2024-01-21 21:42:38 -08:00
Vitaly Buka
14ca0ac915 [fuzzer,test] Remove old debug logging 2024-01-19 23:27:32 -08:00
Vitaly Buka
3e3d74af86 Reapply "[sanitizer] Skip /include/c++/ from summary (#78534)"
Keep linux only test.

This reverts commit 4619147911c2a955bb605618bc518b45da994a81.
2024-01-19 23:25:13 -08:00
Thurston Dang
0784b1eefa
Re-exec TSan with no ASLR if memory layout is incompatible on Linux (#78351)
TSan's shadow mappings only support 30-bits of ASLR entropy on x86
Linux, and it is not practical to support the maximum of 32-bits (due to pointer compression and the overhead of shadow mappings). Instead, this patch changes TSan to re-exec without ASLR if it encounters an 
incompatible memory layout, as suggested by Dmitry in
https://github.com/google/sanitizers/issues/1716.
If ASLR is already disabled but the memory layout is still incompatible,
it will abort.

This patch involves a bit of refactoring, because the old code is:
1. InitializePlatformEarly()
2. InitializeAllocator()
3. InitializePlatform(): CheckAndProtect()

but it may already segfault during InitializeAllocator() if the memory
layout is incompatible, before we get a chance to check in
CheckAndProtect().

This patch adds CheckAndProtect() during InitializePlatformEarly(), before the allocator is initialized. Naturally, it is necessary to ensure that CheckAndProtect() does *not* allow the heap regions to be occupied  here, hence we generalize CheckAndProtect() to optionally check the heap
regions. We keep the original behavior of CheckAndProtect() in InitializePlatform() as a last line of defense.

We need to be careful not to prematurely abort if ASLR is disabled but TSan was going to re-exec for other reasons (e.g., unlimited stack size); we implement this by moving all the re-exec logic into ReExecIfNeeded().
2024-01-19 09:33:54 -08:00
trevyn
d1a2f11feb
[builtins] Mark int_lib.h builtins as static (#69305)
Mark the following symbols as `static` to prevent duplicate definitions:

`__builtin_ctz`
`__builtin_clz`
`__builtin_clzll`
`__builtin_sadd_overflow`

>Without these then all of these functions show up in all object files
which include int_lib.h on Windows. This'll help prevent duplicate
symbols by ensuring they're not exported.

See:

https://github.com/rust-lang/compiler-builtins/issues/167
https://reviews.llvm.org/D34599
2024-01-19 06:02:00 -08:00
Hans Wennborg
4619147911 Revert "[sanitizer] Skip /include/c++/ from summary (#78534)"
The test fails on Darwin, see comment on the PR.

> std:: usually is not a cause of the bug.
>
> We now display
> ```
> SUMMARY: AddressSanitizer: allocation-size-too-big path/to/allocator_returns_null.cpp:92:7 in main
> ```
> instead of
>
> ```
> SUMMARY: AddressSanitizer: allocation-size-too-big /usr/lib/../include/c++/13/bits/new_allocator.h:147:27 in std::__new_allocator<char>::allocate(unsigned long, void const*)
> ```
>
> `/include/c++/` matches both libc++ and libstdc++ include paths.

This reverts commit ecd47811b755d13357085bcd7519a66d6c4d8e5c.
2024-01-19 10:59:05 +01:00
Fangrui Song
c875567af3 [asan,test] Disable alloca_loop_unpoisoning.cpp on s390{{.*}}
The test (from https://reviews.llvm.org/D7098) is about the interaction
of VLA and alloca where the VLA causes alloca to have the same address.
This is mostly about behavior checking and less about instrumentation
correctness, so I think it is fair to disable it for a platform that
does not work after StackSafetyAnalysis is enabled by default (#77210).
2024-01-19 00:39:23 -08:00
Martin Storsjö
c6a6547798
[compiler-rt] Add a prefix on the windows mmap symbols (#78037)
For Windows, the compiler-rt profile library contains a polyfill
reimplementation of the mmap family of functions.

Previously, the runtime library exposed those symbols like, "mmap", in
the user symbol namespace. This could cause misdetections by configure
scripts that check for the "mmap" function just by linking, without
including headers.

Add a prefix on the symbols, and make an undeclared function static.

This fixes such an issue reported at
https://github.com/mstorsjo/llvm-mingw/issues/390.
2024-01-19 10:01:29 +02:00
Fangrui Song
8434e5d0a1 [dfsan] Don't clear shadow on dlopen(NULL, flags)
This ports msan https://reviews.llvm.org/D14795 to dfsan.
dfsan, like msan, clears shadow for globals in a newly opened DSO in
case the DSO occupies the address of a previously labeled/poisoned area.
The operation should not happen on the main executable.

In addition, for a DT_EXEC executable, l_addr is zero and will lead to a
null pointer dereference in ForEachMappedRegion.
2024-01-18 15:04:48 -08:00
Vitaly Buka
ecd47811b7
[sanitizer] Skip /include/c++/ from summary (#78534)
std:: usually is not a cause of the bug.

We now display 
```
SUMMARY: AddressSanitizer: allocation-size-too-big path/to/allocator_returns_null.cpp:92:7 in main
```
instead of 

```
SUMMARY: AddressSanitizer: allocation-size-too-big /usr/lib/../include/c++/13/bits/new_allocator.h:147:27 in std::__new_allocator<char>::allocate(unsigned long, void const*)
```

`/include/c++/` matches both libc++ and libstdc++ include paths.
2024-01-18 12:25:32 -08:00