18571 Commits

Author SHA1 Message Date
Steven Wu
16f4e85860 Revert "[sanitizer] Remove GetCurrentThread nullness checks from Allocate"
This reverts commit 4411d1e3926d67c393e6a7bdb910bbe77507ff26 for
breaking Darwin bots:
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64-calls-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64-inline-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-calls-Noinst-Test/13/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/10/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/12/16
  AddressSanitizer-Unit :: ./Asan-x86_64h-inline-Noinst-Test/13/16
2024-08-15 12:50:03 -07:00
Kirill Stoimenov
1d5c2ad4f1
Reapply "Fix prctl to handle PR_GET_PDEATHSIG. (#101749)" (#104469)
Reapply with a fix. The fix is changing the arg2 type from u64 to int. 

This reverts commit 046524e8fe425cbc86c3371f2bf29fbb39d98435.
2024-08-15 12:41:06 -07:00
earnol
75cb7de404
[ubsan] Display correct runtime messages for negative _BitInt (#96240)
Without this patch compiler-rt ubsan library has a bug displaying
incorrect values for variables of the _BitInt (previously called
_ExtInt) type. This patch affects affects both: generation of metadata
inside code generator and runtime part. The runtime part provided only
for i386 and x86_64 runtimes. Other runtimes should be updated to take
full benefit of this patch.
The patch is constructed the way to be backward compatible and int and
float type runtime diagnostics should be unaffected for not yet updated
runtimes.

This patch fixes issue
https://github.com/llvm/llvm-project/issues/64100.

Co-authored-by: Eänolituri Lómitaurë <vladislav.aranov@ericsson.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Paul Kirth <paulkirth@google.com>
2024-08-15 10:15:27 -04:00
Steven Wu
d2a8351be2
[CompilerRT][Tests] Fix profile/darwin-proof-of-concept.c (#104237)
Fix profile/darwin-proof-of-concept.c on AppleSilicon Mac where there is
a different page alignment. The previous fix to drop alignment is
actually breaking the tests on Apple Silicon Mac. Revert to the original
section alignment and requires an ARM64 target for this test to run.
2024-08-15 06:16:27 -07:00
Fangrui Song
4411d1e392
[sanitizer] Remove GetCurrentThread nullness checks from Allocate
The nullness check is unreachable.

* For the main thead and pthread_create created threads, the `*Allocate` functions must be called after `*_current_thread` is set.
set.
* For threads created by Linux's `clone`, static TLS is either reused or
  set to a new value (CLONE_SETTLS).

Make this change for asan/msan and possibly extend the change to other
sanitizers. (asan supports many platforms and I am not 100% certain that
all platforms have the property.)

Pull Request: https://github.com/llvm/llvm-project/pull/102828
2024-08-14 18:32:29 -07:00
Kirill Stoimenov
539bf49961 [Sanitizers] Disable prctl test on Android. 2024-08-14 22:39:39 +00:00
Kirill Stoimenov
d0c16a6142
Fix prctl test to execute all test cases if the first condition fails. (#102987) 2024-08-14 09:11:52 -07:00
ChiaHungDuan
fdc4955086
Revert "[scudo] Separated committed and decommitted entries." (#104045)
Reverts llvm/llvm-project#101409

This caused some memory usage regressions and it has a known bug in page
releasing.
2024-08-14 09:09:50 -07:00
Florian Mayer
f3f465ed14
Do not use dirname in test (#103395)
Suggested in
https://github.com/llvm/llvm-project/pull/95308#discussion_r1714317539
2024-08-14 09:05:35 -07:00
Piyou Chen
8bf298fa95
[RISCV][compiler-rt] create __riscv__cpu_model for vendorID, ArchID, … (#101449)
…ImplID

This patch 

1. remove the vendorId from `__riscv_vendor_feature_bits`
2. Define a new structure for vendorID, ArchID and ImplID
3. Update the relate init code
2024-08-14 18:11:54 +08:00
Piyou Chen
c4206f1ff1
[RISCV][compiler-rt] Update __init_riscv_feature_bits prototype (#101472)
This patch add `void* PlatformArgs` parameter to
`__init_riscv_feature_bits`. `PlatformArgs` allows the platform to
provide pre-computed data and access it without extra effort. For
example, Linux could pass the vDSO object to avoid an extra system call.

```
__init_riscv_feature_bits()

->

__init_riscv_feature_bits(void *PlatformArgs)
```
2024-08-14 17:30:53 +08:00
David Benjamin
bde4ffe752
Don't pass null pointers to memcmp and memcpy in libFuzzer (#96775)
In C, it is UB to call `memcmp(NULL, NULL, 0)`, `memcpy(NULL, NULL, 0)`,
etc. Unfortunately, `(NULL, 0)` is the natural representation of an
empty sequence of objects and extremely common in real world code. As a
result, all C code, and C++ code which calls into C functions, must
carefully guard all calls to `memcpy`.

This is a serious, real world usability issue in C and should be fixed
in the language (see #49459). In the meantime, pay the cost of the extra
branch to avoid tripping UBSan in libFuzzer. Once the usability problem
in C has been fixed, these checks can be removed.

Fixes #96772
2024-08-13 15:26:40 -07:00
Harini0924
643a2080ec
[llvm-lit] Fix error in compiler-rt tests when using lit internal shell with env (#102069)
When running tests in compiler-rt using the lit internal shell with the
following command:
```
LIT_USE_INTERNAL_SHELL=1 ninja check-compiler-rt
```
one common error that occurs is:
```
'XRAY_OPTIONS=patch_premain=false:verbosity=1': command not found
```
This error, along with over 50 similar "environment variable not found"
errors, appears across 35 files in complier-rt. These errors happen
because the environment variables are not being set correctly when the
internal shell is used, leading to commands failing due to unrecognized
environment variables.

This patch addresses the issue by using the `env` command to properly
set the environment variables before running the tests. By explicitly
setting the environment variables through `env`, the internal shell can
correctly interpret and apply them, allowing the tests to pass.
fixes: #102395 
[link to
RFC](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
2024-08-13 15:13:51 -07:00
Steven Wu
f0ef1d3bae
[CompilerRT][Darwin] Silence the warnings for deprecated APIs (#102977)
Silence deprecated API warnings in compiler-rt on Darwin platforms.
2024-08-13 09:57:25 -07:00
Mosè Giordano
248e885235
[compiler-rt] Define __STDC_FORMAT_MACROS to ensure PRId64 is available (#102980)
In
https://github.com/JuliaPackaging/Yggdrasil/pull/9246#issuecomment-2284894139
we ran into
```
[20:54:03] [ 65%] Building CXX object lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/timing.cpp.o
[20:54:03] cd /workspace/srcdir/compiler-rt-17.0.6.src/build/lib/scudo/standalone && /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ --sysroot=/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/  -I/workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/../.. -I/workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/include -Wall -Wno-unused-parameter -O3 -DNDEBUG -m64 -Werror=conversion -Wall -Wextra -pedantic -g -nostdinc++ -fvisibility=hidden -fno-exceptions -Wno-pedantic -fno-lto -O3 -fno-omit-frame-pointer -DGWP_ASAN_HOOKS -std=c++17 -MD -MT lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/timing.cpp.o -MF CMakeFiles/RTScudoStandalone.x86_64.dir/timing.cpp.o.d -o CMakeFiles/RTScudoStandalone.x86_64.dir/timing.cpp.o -c /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.cpp
[...]
[20:54:03] In file included from /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.cpp:9:
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h: In member function ‘void scudo::TimingManager::printImpl(scudo::ScopedString&, scudo::u32, scudo::u32)’:
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h:182:21: error: expected ‘)’ before ‘PRId64’
[20:54:03]      Str.append("%14" PRId64 ".%" PRId64 "(ns) %-11s", Integral, Fraction, " ");
[20:54:03]                ~     ^~~~~~~
[20:54:03]                      )
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h:182:16: warning: conversion lacks type at end of format [-Wformat=]
[20:54:03]      Str.append("%14" PRId64 ".%" PRId64 "(ns) %-11s", Integral, Fraction, " ");
[20:54:03]                 ^~~~~
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h:182:16: warning: too many arguments for format [-Wformat-extra-args]
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h:186:23: error: expected ‘)’ before ‘PRId64’
[20:54:03]      Str.append("%s (%" PRId64 ")\n", Timers[HandleId].Name, Occurrence);
[20:54:03]                ~       ^~~~~~~
[20:54:03]                        )
[20:54:03] /workspace/srcdir/compiler-rt-17.0.6.src/lib/scudo/standalone/timing.h:186:16: warning: spurious trailing ‘%’ in format [-Wformat=]
[20:54:03]      Str.append("%s (%" PRId64 ")\n", Timers[HandleId].Name, Occurrence);
[20:54:03]                 ^~~~~~~
```
when compiling compiler-rt with GCC 8. This was resolved by defining
`__STDC_FORMAT_MACROS`.
2024-08-13 09:22:11 -07:00
Harini0924
03d51019d0
Add REQUIRES: shell to Tests Requiring Full Shell Functionality with lit Internal Shell (#102988)
This patch adds the `REQUIRES: shell` directive to compiler-rt's fuzzer
tests that require full shell functionality when using the lit internal
shell. These tests depend on features such as background processes,
signal handling, and session management, which are not supported by
lit's internal shell. The addition of this directive ensures that these
tests are only executed in environments that provide the necessary shell
capabilities.

**Details of the Change:**
The following considerations were addressed:
- **Background Processes (`&`):** The tests run commands in the
background using the `&` operator, which allows the shell to execute
commands concurrently without waiting for each one to finish. In a
standard Unix-like shell, this is a common feature that facilitates
multitasking. However, lit's internal shell does not fully support
background job control, which can lead to unpredictable behavior or test
failures. Without proper handling of background processes, subsequent
commands that depend on the status of these processes may not function
correctly.
- **Signal Handling (`kill -SIGUSR1`, `kill -SIGUSR2`, `kill
-SIGINT`):** These tests involve sending specific signals like
`SIGUSR1`, `SIGUSR2`, and `SIGINT` to running processes. These signals
are used to trigger certain behaviors in the processes, such as pausing,
resuming, or terminating. However, lit's internal shell may not handle
these signals properly—it might not send the signal correctly, or the
process might not respond as it should. This could lead to the test
failing, not because the process is incorrect, but because the shell
didn't manage the signals as required.
- **Session Management (`setsid`):** The tests use `setsid` to create
new sessions, detaching processes from their controlling terminal and
isolating them into their own process groups. However, the internal
shell in lit does not support session management features like `setsid`,
this can't correctly isolate and manage processes as required by these
tests.

This change is relevant for enabling the lit internal shell by default,
as outlined in [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
2024-08-13 08:21:16 -07:00
Daniel Kiss
ac26c661ea
[compiler-rt][SME] Correct .variant_pcs directives. (#103047) 2024-08-13 17:03:09 +02:00
Fangrui Song
652707a645
[nsan] Use sanitizer allocator
* The performance is better than the glibc allocator.
* Allocator interface functions, sanitizer allocator options, and
  MallocHooks/FreeHooks are supported.
* Shadow memory has specific memory layout requirement. Using libc
  allocator could lead to conflicts.
* When we add a mmap interceptor for reliability (the VMA could reuse a
  previously released VMA that is poisoned): glibc may invoke an
  internal system call to call unmmap, which cannot be intercepted. We
  will not be able to return the shadow memory to the OS.

Similar to dfsan https://reviews.llvm.org/D101204 . Also intercept
operator new/delete to be similar to other sanitizers using the
sanitizer allocator. The align_val_t overload of operator new has
slightly less overhead.

Pull Request: https://github.com/llvm/llvm-project/pull/102764
2024-08-12 13:56:40 -07:00
ChiaHungDuan
8ea8f1f2fe
[scudo] Support linking with index in IntrusiveList (#101262)
The nodes of list may be managed in an array. Instead of managing them
with pointers, using the array index will save some memory in some
cases.

When using the list linked with index, remember to call init() to set up
the base address of the array and a `EndOfListVal` which is nil of the
list.
2024-08-12 12:56:24 -07:00
Florian Mayer
d4f6fcf5aa
Revert "[HWASan] symbolize stack overflows" (#102951)
Reverts llvm/llvm-project#95308

Broke buildbot https://lab.llvm.org/buildbot/#/builders/51/builds/2364
2024-08-12 11:40:05 -07:00
Florian Mayer
4afa2de59a
[HWASan] symbolize stack overflows (#95308) 2024-08-12 10:27:54 -07:00
Brad Smith
e2f9c18533
[builtins] Rename sysauxv to getauxval to reflect the function called. NFCI (#102796) 2024-08-11 19:19:45 -04:00
Alexandre Ganea
7202fe5829 [compiler-rt] Silence warnings
This fixes a few of these warnings, when building with Clang ToT on
Windows:
```
[622/7618] Building CXX object
projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommonSymbolizer.x86_64.dir\sanitizer_symbolizer_win.cpp.obj
C:\src\git\llvm-project\compiler-rt\lib\sanitizer_common\sanitizer_symbolizer_win.cpp(74,3):
warning: cast from 'FARPROC' (aka 'long long (*)()') to
'decltype(::StackWalk64) *' (aka 'int (*)(unsigned long, void *, void *,
_tagSTACKFRAME64 *, void *, int (*)(void *, unsigned long long, void *,
unsigned long, unsigned long *), void *(*)(void *, unsigned long long),
unsigned long long (*)(void *, unsigned long long), unsigned long long
(*)(void *, void *, _tagADDRESS64 *))') converts to incompatible
function type [-Wcast-function-type-mismatch]
```

This is similar to https://github.com/llvm/llvm-project/pull/97905
2024-08-11 19:01:12 -04:00
Chris Apple
0a2a319ea6
[rtsan] Make sure rtsan gets initialized on mac (#100188)
Intermittently on my mac I was getting the same nullptr crash in dlsym.

We need to make sure rtsan gets initialized on mac between when the
binary starts running, and the first intercepted function is called.
Until that point we should use the DlsymAllocator.
2024-08-11 15:58:49 -07:00
Fangrui Song
1d0d1f20e7 [msan] Remove unneeded nullness CHECK
The pointer will immediate be dereferenced.
2024-08-11 12:35:34 -07:00
Fangrui Song
2438f41bc4 Make msan_allocator.cpp more conventional. NFC
nsan will port msan_allocator.cpp.
2024-08-11 12:30:01 -07:00
Fangrui Song
249db518e3
[nsan] Add NsanThread and clear static TLS shadow
On thread creation, asan/hwasan/msan/tsan unpoison the thread stack and
static TLS blocks in case the blocks reuse previously freed memory that
is possibly poisoned. glibc nptl/allocatestack.c allocates thread stack
using a hidden, non-interceptable function.

nsan is similar: the shadow types for the thread stack and static TLS
blocks should be set to unknown, otherwise if the static TLS blocks
reuse previous shadow memory, and `*p += x` instead of `*p = x` is used
for the first assignment, the mismatching user and shadow memory could
lead to false positives.

NsanThread is also needed by the next patch to use the sanitizer
allocator.

Pull Request: https://github.com/llvm/llvm-project/pull/102718
2024-08-11 10:53:18 -07:00
Fangrui Song
fe31363a68 [dfsan] Use namespace qualifier. NFC 2024-08-10 12:17:11 -07:00
Fangrui Song
80eea015ba [dfsan] Use namespace qualifier and internalize accidentally exported functions. NFC 2024-08-10 11:35:14 -07:00
Fangrui Song
c27415ff86 [sanitizer,test] Restore -fno-sized-deallocation coverage
-fsized-deallocation was recently made the default for C++17 onwards
(#90373). While here, remove unneeded -faligned-allocation.
2024-08-10 11:02:07 -07:00
Fangrui Song
e0ddd42735 [msan] Use namespace qualifier. NFC
nsan will port msan_allocator.cpp and msan_thread.cpp. Clean up the two
files first.
2024-08-09 20:45:39 -07:00
Fangrui Song
6c8d479609 [nsan] GetShadowAddrFor: Use (const) void * to decrease the number of casts 2024-08-09 20:29:21 -07:00
Mingming Liu
51a3bc1217
[ThinLTO]Clean up 'import-assume-unique-local' flag. (#102424)
While manual compiles can specify full file paths and build automation
tools use full, unique paths in practice, it's not clear whether it's a
general good practice to enforce full paths (fail a build if relative
paths are used).

`NumDefs == 1` condition [1] should hold true for many internal-linkage
vtables as long as full paths are indeed used to salvage the marginal
performance when local-linkage vtables are imported due to indirect
reference.
https://github.com/llvm/llvm-project/pull/100448#discussion_r1692068402
has more details.

[1]
https://github.com/llvm/llvm-project/pull/100448/files#diff-e7cb370fee46f0f773f2b5429dfab36b75126d3909ae98ee87ff3d0e3f75c6e9R215
2024-08-09 16:48:05 -07:00
Fangrui Song
93a31cdf7a [nsan] Make #include more conventional 2024-08-09 16:47:05 -07:00
Harini0924
c69b8c445a
[compiler-rt][NFC] Replace environment variable with %t (#102197)
Certain tests within the compiler-rt subproject encountered "command not
found" errors when using lit's internal shell, particularly when trying
to use the `DIR` environment variable. When checking with the command
`LIT_USE_INTERNAL_SHELL=1 ninja check-compiler-rt`, I encountered the
following error:
```
********************
Testing: 
FAIL: SanitizerCommon-ubsan-i386-Linux :: sanitizer_coverage_trace_pc_guard-init.cpp (146 of 9570)
******************** TEST 'SanitizerCommon-ubsan-i386-Linux :: sanitizer_coverage_trace_pc_guard-init.cpp' FAILED ********************
Exit Code: 127

Command Output (stdout):
--
# RUN: at line 5
DIR=/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/ubsan-i386-Linux/Output/sanitizer_coverage_trace_pc_guard-init.cpp.tmp_workdir
# executed command: DIR=/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/ubsan-i386-Linux/Output/sanitizer_coverage_trace_pc_guard-init.cpp.tmp_workdir
# .---command stderr------------
# | 'DIR=/usr/local/google/home/harinidonthula/llvm-project/build/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/ubsan-i386-Linux/Output/sanitizer_coverage_trace_pc_guard-init.cpp.tmp_workdir': command not found
# `-----------------------------
# error: command failed with exit status: 127
```
In this patch, I resolved these issues by removing the use of the `DIR`
environment variable. Instead, the tests now directly utilize
`%t_workdir` for managing temporary directories. Additionally, I
simplified the tests by embedding the clang command arguments directly
into the test scripts, which avoids complications with environment
variable expansion under lit's internal shell.

This fix ensures that the tests run smoothly with lit's internal shell
and prevents the "command not found" errors, improving the reliability
of the test suite when executed in this environment.

fixes: #102395
[link to
RFC](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
2024-08-09 14:56:52 -07:00
Joshua Baehring
9f3ff8d28a
[scudo] Separated committed and decommitted entries. (#101409)
Initially, the LRU list stored all mapped entries with no distinction
between the committed (non-madvise()'d) entries and decommitted
(madvise()'d) entries. Now these two types of entries re separated into
two lists, allowing future cache logic to branch depending on whether or
not entries are committed or decommitted. Furthermore, the retrieval
algorithm will prioritize committed entries over decommitted entries.
Specifically, committed entries that satisfy the MaxUnusedCachePages
requirement are retrieved before optimal-fit, decommitted entries.

This commit addresses the compiler errors raised
[here](https://github.com/llvm/llvm-project/pull/100818#issuecomment-2261043261).
2024-08-09 10:56:07 -07:00
Thurston Dang
7ede1c4973
[asan] Switch allocator to dynamic base address (#98511)
This ports a fix from memprof (https://github.com/llvm/llvm-project/pull/98510), which has a shadow mapping that is similar to ASan (8 bytes of shadow memory per 64 bytes of app memory). This patch changes the allocator to dynamically choose a base address, as suggested by Vitaly for memprof. This simplifies ASan's #ifdef's and avoids potential conflict in the event that ASan were to switch to a dynamic shadow offset in the future [1].

[1] Since shadow memory is mapped before the allocator is mapped:
- dynamic shadow and fixed allocator (old memprof): could fail if
"unlucky" (e.g., https://lab.llvm.org/buildbot/#/builders/66/builds/1361/steps/17/logs/stdio)
- dynamic shadow and dynamic allocator (HWASan; current memprof): always works
- fixed shadow and fixed allocator (current ASan): always works, if
constants are carefully chosen
- fixed shadow and dynamic allocator (ASan with this patch): always works
2024-08-09 10:36:50 -07:00
Vitaly Buka
689700439a
Fix test on Windows 2024-08-08 20:50:27 -07:00
Kirill Stoimenov
046524e8fe Revert "Fix prctl to handle PR_GET_PDEATHSIG. (#101749)"
Broke the build.

This reverts commit d46c26b8102dee763d72bf98341bc95b21767196.
2024-08-08 22:41:53 +00:00
Kirill Stoimenov
d46c26b810
Fix prctl to handle PR_GET_PDEATHSIG. (#101749) 2024-08-08 14:19:56 -07:00
Joshua Baehring
373d35d1e1
[scudo] Added test fixture for cache tests. (#102230)
The test fixture simplifies some of the logic for allocations and
mmap-based allocations
are separated from the cache to allow for more direct cache tests.
Additionally, a couple
of end to end tests for the cache and the LRU algorithm are added.
2024-08-08 13:44:27 -07:00
Martin Storsjö
5ea9dd8c70
[compiler-rt] Support building runtimes for Windows on arm32 (#101462)
In these environments, the architecture name is armv7; recognize that
and enable the relevant runtimes.

Fix building the sanitizer_common library for this target, by using the
right registers for the architecture - this is similar to what
0c391133c9201ef29273554a1505ef855ce17668 did for aarch64.

(Still, address sanitizer doesn't support hooking functions at runtime
on armv7 or aarch64 - but other runtimes such as ubsan do work.)
2024-08-08 13:51:07 +03:00
Vitaly Buka
22897855c8 [asan] Fix Windows tests
Fix Windows after #101853.
2024-08-08 00:17:19 -07:00
Piyou Chen
82f52d9c42
[RISCV] Support new groupid/bitmask for cpu_model (#101632)
The spec can be found at
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74.

1. Add the new extension GroupID/Bitmask with latest hwprobe key.
2. Update the `initRISCVFeature `
3. Update `EmitRISCVCpuSupports` due to not only group0 now.
2024-08-08 14:42:41 +08:00
Vitaly Buka
29e849bfd3
[asan] Optimize initialization order checking (#101837)
The pair `__asan_before_dynamic_init` and `__asan_after_dynamic_init` is
executed for each TU. `__asan_after_dynamic_init` unpoisons all globals,
which
makes the time complexity O(N^2), where N is the maximum of the global
count and
the TU count. This is expensive for large binaries.

This patch decreases the time complexity to O(N), when lld and static
runtime is
used on SANITIZER_CAN_USE_PREINIT_ARRAY platforms. This requires:

Enabling incremental poisoning (`__asan_before_dynamic_init` since
https://github.com/llvm/llvm-project/pull/101597). Making most
`__asan_after_dynamic_init` calls do nothing.
2024-08-07 23:17:14 -07:00
Fangrui Song
65b4a7704b
[sanitizer] Optimize DenseMap::{find,erase}
Port the ADT optimization #100517. In addition, add `contains`
(https://reviews.llvm.org/D145895) while changing `count`.

Pull Request: https://github.com/llvm/llvm-project/pull/101785
2024-08-07 22:02:32 -07:00
Christopher Ferris
a753c9921e
[scudo] Die when store is called on MapAllocatorNoCache objects. (#102403) 2024-08-07 18:50:22 -07:00
ChiaHungDuan
e9c9fde3b7
[scudo] Avoid accessing inaccessible pages in unmap() in secondary (#102367) 2024-08-07 15:42:11 -07:00
Vitaly Buka
89c8d68eb7
[NFC] Fix typo in REAL(pthread_join(th, ret)) (#102393)
Looks like the macro expands to the same,
but usually we do `REAL(pthread_join)(th, ret)`.
2024-08-07 15:25:55 -07:00
Florian Mayer
5e5cce5643 [NFC] [sanitizers] leave BufferedStackTrace uninit in tests
This is for consistency with the production code

Pull Request: https://github.com/llvm/llvm-project/pull/102251
2024-08-07 15:19:28 -07:00