Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
474f5d2aefb44430b89ed72774a3c1d26a0adfb1 removed the last
bits reading from system registers so remove the last bits
utilizing MRS and rename the file to hwcap as the
code is now only decoding the hwcap flags.
|
|
### Summary
Stabilize ASan wchar tests across Darwin and Android. NFC: test-only.
Follow-up to PR #160493 (adds wchar interceptors/tests).
### Motivation
- Darwin: The top frame often resolves to `libclang_rt.asan_*` rather
than a source file, so strict checks that include file/line can fail.
See Chromium issue
[448631142](https://g-issues.chromium.org/issues/448631142).
- Android: The “ERROR:” header can go to logcat instead of stderr, so
FileCheck may not see it; stdout/stderr reordering also makes pre-crash
markers racy. See Android Buildbot
[186/12821](https://lab.llvm.org/buildbot/#/builders/186/builds/12821).
### Changes
- Android:
- Force reports to stderr via `%env_asan_opts=log_to_stderr=1`, avoiding
the “ERROR:” header going to logcat.
- Print the pre-crash “Good so far.” to stderr and `fflush(stderr)` to
avoid stdout/stderr reordering.
- Darwin:
- Relax the stack-frame check to only require the function name
(`wcscpy/wcsncpy/wcscat/wcsncat`) to tolerate `libclang_rt.asan_*`
frames.
- Common:
- Reuse FileCheck var `[[ADDR]]` instead of redefining.
- Make wide string literals `const wchar_t*` to silence
`-Wwritable-strings`.
### Risk
- NFC: test-only; no change to runtime behavior.
### References
- Follow-up to PR #160493.
- Chromium: [448631142](https://g-issues.chromium.org/issues/448631142)
(Darwin failures).
- Android Buildbot:
[186/12821](https://lab.llvm.org/buildbot/#/builders/186/builds/12821).
Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
|
|
The `__c_longjmp` and `__cpp_exceptions` tags are used internally by
llvm to implement setjmp/longjmp and C++ exception handling
respectively.
These symbols were previously defined weakly in each object file but
were recently converted to external references in #159143. They now need
to be defined somewhere in the runtime libraries. I think compiler-rt is
likely the most sensible place for them.
|
|
(#160493)
Summary
- Add ASan interceptors for wcscpy/wcsncpy on all platforms.
- Enable wcscat/wcsncat on Windows (already enabled on POSIX via
sanitizer_common).
Motivation
- Use of wchar string APIs is common on Windows; improve parity with
char* string checks.
Changes
- Implement wcscpy/wcsncpy in asan_interceptors.cpp; check overlap and
mark read/write ranges in bytes.
- wcsncpy: compute write size in bytes (size * sizeof(wchar_t)) to avoid
missed overflows when sizeof(wchar_t) != 1.
- Use MaybeRealWcsnlen when available to bound reads.
- Register Windows static thunk for wcscpy/wcsncpy/wcscat/wcsncat; rely
on sanitizer_common interceptors for wcscat/wcsncat.
- Tests: add wcscpy/wcsncpy/wcscat/wcsncat; flush stdout before crash;
use resilient FileCheck patterns (reuse [[ADDR]], wildcard for function
suffixes and paths, flexible line numbers).
Testing
- AArch64 Linux: new tests pass with check-asan locally.
Follow-up to and based on prior work in PR #90909 (author: branh,
Microsoft); builds on that work and addresses review feedback. Thanks!
---------
Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
|
|
(#160824)
### Summary
This PR resolves https://github.com/llvm/llvm-project/issues/160562
|
|
The builtins `__fixunstfdi` and `__multc3` may be removed by the
preprocessor depending on configuration flags. When this happens, the
corresponding tests fail at link time due to missing definitions.
Disable these tests when the builtins are not available.
Also remove the XFAILs for aarch64 windows. As this test now became a
no-op on platforms that lack CRT_HAS_128BIT or CRT_HAS_F128 (aarch64
windows lacks the latter), it no longer fails.
This reapplies e9e166e54354330c474457711a8e7a7ca2efd731 and
656707086e5f6fccd2eb57f5aaf987c328c0f4f1 after fixing declarations of
the builtins in the tests in b54250940c2cd70f911386b02239b50c165e5354.
rdar://159705803
rdar://159705705
---------
Co-authored-by: Martin Storsjö <martin@martin.st>
|
|
Replace `long double` and `long double _Complex` with `fp_t` and
`Qcomplex` in the test files.
This prepares for reapplying 656707086e5f6fccd2eb57f5aaf987c328c0f4f1
and running tests on targets where `fp_t` is not `long double`.
|
|
Changes to initial PR (#140068):
- Mark failing test as unsupported for powerpc64le, as test failure is
unrelated to PR changes. See
https://github.com/llvm/llvm-project/issues/141598
---
Original description (from #140068)
The XRay interface header uses no C++ specific features aside from using
the std namespace and including the C++ variant of C headers. Yet, these
changes prevent using `xray_interface.h` in external tools relying on C
for different reasons. Make this header C compliant by using C headers,
removing the std namespace from std::size_t and guard `extern "C"`.
To make sure that further changes to not break the interface
accidentially, port one test from C++ to C. This requires the C23
standard to officially support the attribute syntax used in this test
case.
Note that this only resolves this issue for `xray_interface.h`.
`xray_records.h` is also not C compliant, but requires more work to
port.
Fixes #139902
Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
|
|
Instead of directly instantiating scudo::Allocator, using the test
TestAllocator wrapper class ensures that unmapTestOnly is called at the
end of the test.
This fixes the issue of QuarantineIterateOverChunks failing on Fuchsia
because of a clobbered TLS pointer left by QuarantineEnabled.
|
|
fix typos
|
|
Reverts llvm/llvm-project#160728
That appeared to be causing a buildbot failure; reverting this change
while I investigate.
https://lab.llvm.org/buildbot/#/builders/174/builds/25130
|
|
This is part of our work to migrate lit tests to use internal shell by
default (performance improvements).
|
|
This reverts commit e9e166e54354330c474457711a8e7a7ca2efd731,
and the follow-up fix 656707086e5f6fccd2eb57f5aaf987c328c0f4f1.
These changes unlocked tests to run on architectures where they
didn't run before, showing up as test failures like in
https://lab.llvm.org/buildbot/#/builders/66/builds/19787.
|
|
(#160740)
Currently `memcpy` and `memset` intrinsics map through to the library
implementations if ASan has been inited, whereas `memmove` always calls
`internal_memmove`.
This patch changes `memmove` to use the library implementation if ASan
has been inited.
|
|
This fixes the ifdefs added in
e9e166e54354330c474457711a8e7a7ca2efd731; we need to include int_lib.h
first before we can expect these defines to be set.
Also remove the XFAILs for aarch64 windows. As this test now became a
no-op on platforms that lack CRT_HAS_128BIT or CRT_HAS_F128 (aarch64
windows lacks the latter), it no longer fails.
|
|
fix typos
|
|
Before this change, if large amounts of memory are deallocated within a
release interval, the release is put off until the release interval
occurs. Unfortunately, for larger class sizes, this could mean that a
lot of this memory accumulates and is never released since no more
deallocations occur in that size class.
To fix this, if `RegionPushedBytesDelta` grows larger than a group size,
immediately do a release.
This work was originally done by ChiaHungDuan.
|
|
This ports https://github.com/llvm/llvm-project/pull/142821 from TSan.
Although MSan doesn't segfault the way TSan did, the failure message was
nonetheless cryptic. The improved error message will prepare MSan for
the upcoming AppArmorpocalypse.
|
|
When relanding a previous patch I had accidentally left this patched to
tee output into a file rather than run FileCheck. This patch fixes that
so the test actually tests what it is supposed to.
|
|
The builtins `__fixunstfdi` and `__multc3` may be removed by the
preprocessor depending on configuration flags. When this happens, the
corresponding tests fail at link time due to missing definitions.
Disable these tests when the builtins are not available.
rdar://159705803
rdar://159705705
|
|
If a quarantine block is allocated, it will be passed through to a user
who calls iterateOverChunks. Make these special block allocations state
Quarantined so they are not passed to iterateOverChunks.
Remove the FIXME in the combined tests for quarantine since this fixes
those tests too.
Also add a specific new test that fails without this fix.
|
|
Currently this test is flaky. I believe that it may be because the logs
have not flushed to disk before the `log show` command is run.
This patch allows the test to retry reading the log twice more with a 5
second sleep inbetween.
|
|
(#160171)
This fixes a typo introduced in #158665.
|
|
Add the santizier option `log_fallback_to_stderr` which will set the
logpath to `stderr` if there is an error with the provided logpath.
We've seen this happen when process A has write permission to the
logpath, but process B does not. In this case, we'd like process B to
fallback to writing to `stderr`, rather than being killed.
|
|
This reverts commit 05e31438ac9491cfc72c48664480796de874c860.
There was quite a bit of churn with this patch, everytime related to the executable
no longer being in the same directory as the shared objects. This reland ensures
that all of the executables in the tests touched are in the same directory as the
shared objects in the substitutions.
|
|
Summary:
The AMDGPU hack can be removed, and we no longer need to skip 90% of the
`HandleLLVMOptions` if we work around NVPTX earlier. Simplifies the
interface by removing duplicated logic and keeps the GPU targets from
being weirdly divergent on some flags.
|
|
The following assertion was being triggered:
```
assert.h assertion failed at llvm-project/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:237 in void fuzzer::TracePC::UpdateObservedPCs(): M.Size() == (size_t)(ModulePCTable[i].Stop - ModulePCTable[i].Start)
```
# The bug
When built with `-fsanitize=fuzzer`, each “module” (.so file, or the
binary itself) will be instrumented, and when loaded into the process
will make a call to these two functions:
- `__sanitizer_cov_8bit_counters_init`
- `__sanitizer_cov_pcs_init`
Each of these is called with start and end pointers defining an array.
In libFuzzer, these functions are implemented with
`HandleInline8bitCountersInit` and `HandlePCsInit`. Each of them pushes
back the provided pointers into a separate array, `Modules` and
`ModulePCTable` respectively. These arrays are meant to be kept in-sync;
index i into Modules should refer to the same `.so` as index i into
ModulePCTable. The assertion was triggering because these lists got
out-of-sync.
The problem is that the 8bit handler contains this line:
```
if (Start == Stop) return;
```
but the PC handler contains no such corresponding line. This meant that
if a module was ever instrumented but “empty” (its 8bit counter and PC
arrays were both of length 0), then its PC array would still be added
but its 8bit counter array would not.
# Why this issue was never seen before
The circumstances to trigger this issue are unusual:
- You need a compilation unit that doesn't contain any code (though it
may contain global variable declarations and similar). That doesn't
happen very often.
- That compilation unit must be dynamically linked, not statically
linked. If statically linked, it’ll be merged into a single “module”
with the main binary, and the arrays will be merged as well; you won’t
end up with length-0 arrays.
- To notice the issue, assertions must be enabled. If disabled,
libFuzzer will be buggy (it may have worse coverage), but it won't
crash, and "worse coverage" is extremely unlikely to be noticed.
# This change
This change solves the issue by adding the same `if (Start == Stop)
return;` check to `HandlePCsInit`. This prevents the arrays from getting
out-of-sync. This change also adds a test that identifies the previous
issue when compiled with assertions enabled, but now passes with the
fix.
|
|
|
|
If an empty path is passed, the internal_strlen -1 below will loop round
to become uptr max. Adding this check ensures that this would be caught
|
|
(#158670)
Some sanitizers use mach_vm_region_recurse on macOS to find a
sufficiently large gap to allocate shadow memory. Some sandboxes do not
allow this.
When we get KERN_DENIED, we suggest to the user that it may have been
blocked by the sandbox.
For error codes other than KERN_INVALID_ADDRESS and KERN_DENIED, we make
sure to log a message and not use the address.
rdar://160625998
|
|
Move the trace point until right before the mark free blocks call for
the primary. This avoids adding extra calculations on a fast path.
|
|
on Apple platforms (#158665)
An existing log message is triggered in InitializePlatformEarly if the
address space max is not as sufficient for TSAN.
Some Apple platforms expand the address space limit, but reserve much of
the space TSAN needs. Therefore, we now check that the kernel has not
mapped over the address space that we intend to use.
IsAddressInMappedRegion is added to sanitizer_common. This introduces a
new dependency on mach_vm_region_recurse during TSAN startup, so this
intentionally fails softly (to avoid breaking current users who may be
in a sandbox that doesn't allow this).
rdar://135265279
|
|
- cpuid bit for prefetchi is different from Intel
(https://docs.amd.com/v/u/en-US/24594_3.37)
- Fix cpu family model numbers
|
|
(#159097)
Fix below buildbot failure.
```
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:172:42: error: use of undeclared identifier 'uint'
172 | Printf("Flag: %s %u\n", Name, (uint)Val);
```
Replace uint with uint32_t cast.
This reverts commit 8062b166762b51f1c3a9168e7031babde3e330a8.
|
|
This will be used to build hexagon-builtins for baremetal.
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
|
|
(#158378)
Sometimes we are unable to find a sufficiently large gap to allocate the
dynamic ASAN shadow.
If a gap is not found, we will now output a (consolidated) memory map to
show the user what regions were unavailable and how much memory we need.
rdar://159142896
|
|
GCC 14 also made this an error by default, so we’re following suit.
Fixes #74605
|
|
Alternative to #158236 without requiring external packages
|
|
`enable_execute_stack` is not supported on arm64 Darwin because:
- It calls mprotect with `PROT_WRITE | PROT_EXEC`, which is rejected on
this platform.
- It assumes a fixed 4K page size, which is not guaranteed.
This change disables building `enable_execute_stack` on arm64 Darwin and
fixes the failing test:
`compiler-rt/test/builtins/Unit/enable_execute_stack_test.c`.
rdar://159705691
|
|
(#158522)
Simulator environments run only atos symbolizer rather than falling back
to dladdr.
Because sanitizer-common does not target simulators, move this test into
asan and simulator only to make it predicatable test.
Original change sha: 0f9bfe0a02ffff077a1a98065069b52744e31723
rdar://108003900
|
|
The AAPCS recommends avoiding the use of x18 as it may be used for other
purposes such as a shadow call stack.
In this particular case it could just as well use x16 instead.
|
|
versions" (#158230)
Reverts llvm/llvm-project#142596
Got reports that some tests previously skipped are running again and
failing.
|
|
Add a methodology to allow tracing. By default, this is disabled, but it
can be enabled for any OS that supports it.
Currently, only releaseToOSXXX functions have trace points added.
|
|
As part of our migration for making lit internal shell be the default,
this updates binary-id-offset.c to no longer require shell (at the cost
of duplicating some code).
|
|
Also update os_unfair_lock tsan test to check this function on platforms
where it is available.
rdar://158294950
|
|
(#142596)
Instead of distutils.LooseVersion. distutils was depracated
(https://peps.python.org/pep-0632/) and has been removed in Python 3.12
(https://docs.python.org/3/whatsnew/3.12.html)
> Of note, the distutils package has been removed from the standard library.
packaging's version is able to handle glibc's major.minor:
https://packaging.pypa.io/en/latest/version.html#packaging.version.Version
> For these modules or types, use the standards-defined Python Packaging
Authority packages specified:
> distutils.version — use the packaging package
Relates to https://github.com/llvm/llvm-project/issues/54337
|
|
Replace sub-shell for-loops with python calls so this test can run in
the lit internal shell. This is part of our work migrating to use the
internal shell as the default for lit tests.
|
|
Update sig-trap.test to work with the lit internal shell, as part of our
migration to make the internal shell the default for lit tests.
|
|
PR157951 removed 'REQUIRES: shell' from several tests, which (among
other things) caused them to start running on some Windows builders --
the 'REQUIRES: shell' prevented that. Some of those tests fail on
Windows. This PR marks those failing tests as UNSUPPORTED on Windows.
|