aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
AgeCommit message (Collapse)AuthorFilesLines
2023-07-10[scudo] Support partial concurrent page release in SizeClassAllocator64Chia-hung Duan1-41/+105
After extracting memory groups, it's safe to do 1. markFreeBlocks 2. releaseFreeMemoryToOS concurrently with pushBlocks() and popBatches(). This will improve the throughput of Scudo. Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D153608
2023-07-10[Profile] Remove duplicate file locks when enabled continuous mode and ↵Zequan Wu3-9/+159
online merging. In `initializeProfileForContinuousMode`, we have already locked the profile file when merging is enabled, so there's no need to lock the same file second time in `openFileForMerging`. On Linux/Darwin, the locking the same file twice doesn't cause any problem. But on Windows, it causes the problem to hang forever. With this minor fix, continuous mode seems working with online merging on Windows. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D154748
2023-07-07[ASAN] Moved mmap/munmap test to posix.Kirill Stoimenov1-1/+0
2023-07-07[scudo] Explicit casting for u16 arithmetic operationChia-hung Duan2-2/+2
This fixes the werror from https://lab.llvm.org/buildbot/#/builders/165/builds/38829 Reviewed By: enh Differential Revision: https://reviews.llvm.org/D154733
2023-07-07[ASAN] Disable mmap test on Windows.Kirill Stoimenov1-0/+1
2023-07-07[scudo] Allow pushing single block to the freelist of BatchClassChia-hung Duan2-211/+302
This CL removes the restriction that pushing blocks into BatchClassId can only be done when freelist is not empty. Without this constraint, BatchClassId is also available for gathering blocks into groups. Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D153492
2023-07-07[ASAN] Add mmap and munmap interceptor in ASANKirill Stoimenov2-0/+88
Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D154659
2023-07-07[compiler-rt][xray] Disable fdr-single-thread test on ArmDavid Spickett1-0/+2
For unknown reasons this casues a bus error. See: https://lab.llvm.org/buildbot/#/builders/178/builds/5157
2023-07-07[compiler-rt][RISCV] Fix __fe_getround and __fe_raise_inexact for ZfinxKito Cheng1-2/+2
Zfinx extension also provide floating point environment like F extension, so enable that on `__fe_getround` and `__fe_raise_inexact` too. Reviewed By: asb Differential Revision: https://reviews.llvm.org/D154570
2023-07-07Revert "Reland '[msan] Intercept dladdr1, and refactor dladdr'"Thurston Dang5-203/+13
This reverts my commit 015dabd7672f936cdb5bdcad20fe80b17f05c9ca due to breaking non-glibc builds.
2023-07-06[msan] Fix -Wcast-qual error in msan_dl.cppThurston Dang1-1/+1
Attempt 2 at fixing a buildbot error https://lab.llvm.org/buildbot#builders/57/builds/28143 that I had introduced in D154272
2023-07-06[scudo] Try to release pages after unlocking the TSDsChia-hung Duan4-16/+36
This increases the parallelism and the usage of TSDs Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D152988
2023-07-06[scudo] Verify the size of free blocks in primary allocatorChia-hung Duan3-3/+82
When all the blocks (local caches are included) are freed, the size of free blocks should be equal to `AllocatedUser`. Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D152769
2023-07-06Reland '[msan] Intercept dladdr1, and refactor dladdr'Thurston Dang5-13/+203
Reland with -Wcast-qual issue fixed Original commit message: This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D154272
2023-07-06[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSDMarco Elver1-0/+4
Current FreeBSD has increased size of cpuset. Match it to not break the build on newer FreeBSD. Patch by John F. Carr Fixes: https://github.com/llvm/llvm-project/issues/63485
2023-07-05[XRay][test] Remove unneeded REQUIRES: x86_64-target-archFangrui Song12-18/+8
fdr-thread-order.cpp can be very slow when the thread contention is large. Enable it for AArch64 and x86-64 for now. fdr-mode.cpp fails on a ppc64le machine. Unsupport it on ppc64le for now. The remaining modified tests pass on AArch64, ppc64le, and x86-64.
2023-07-05[XRay][AArch64] Implement __xray_ArgLoggerEntryFangrui Song5-15/+41
2023-07-06[profile] Enable loongarch64zhanglimin1-1/+1
Mark loongarch64 as supported for profile. All tests passed. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D154405
2023-07-05[XRay][test] Replace some XFAIL with more appropriate REQUIRESFangrui Song3-11/+6
2023-07-05[Sanitizers][Darwin][Test] Mark symbolize_pc test unsupported in Darwin/LSan ↵Mariusz Borsa1-0/+2
context LSan is unsupported on Darwin anyway, and this test fals on public Darwin bots Differential Revision: https://reviews.llvm.org/D154389
2023-07-05[scudo] Extract steps releaseToOSMaybe into functions inChia-hung Duan2-131/+186
This refactor helps us identify which steps need FLLock so that we can reduce the holding time of FLLock in SizeClassAllocator64. Also move the data members to the end of class to align the style in SizeClassAllocator32. Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D152596
2023-07-05[scudo] SCUDO_FUCHSIA uses ReservedMemoryDefaultCaslyn Tonelli1-1/+1
Some Fuchsia zx tests failed from https://reviews.llvm.org/D153888: https://turquoise-internal-review.git.corp.google.com/c/integration/+/729619 Use `ReservedMemoryDefault` for `SCUDO_FUCHSIA` to use the default MemMap API, while test failures are debugged. Differential Revision: https://reviews.llvm.org/D154538
2023-07-05[scudo] Implement Fuchsia backend for the new MemMap APIFabio D'Urso4-1/+332
Reviewed By: Caslyn, Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153888
2023-07-04[ASanAbi][Darwin] Build ios stable ABI libraryBlue Gaston2-10/+44
In the initially commit, we limited the static archive to osx. This patch removes that limitation. Differential Revision: https://reviews.llvm.org/D153789
2023-07-03[dfsan] Support Linux loongarch64zhanglimin2-2/+2
Make minor changes to enable DFSAN and its tests on loongarch64. And port Linux loongarch64 memory mappings from msan. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D140690
2023-07-02[sanitizer_common][test] Fix huge_malloc.c UNSUPPORTED syntaxRainer Orth1-1/+1
`lit` doesn't accept arbitrary substrings of the target triple any longer, so d5a779b5a39b655ed9fafedaacbb017c46f5dbfe <https://reviews.llvm.org/rGd5a779b5a39b655ed9fafedaacbb017c46f5dbfe> has no effect. Instead, this patch uses the `target=` syntax as all other tests in `compiler-rt`. Tested on `amd64-pc-solaris2.11`. Differential Revision: https://reviews.llvm.org/D154298
2023-07-01Revert "[msan] Intercept dladdr1, and refactor dladdr"Thurston Dang5-202/+13
Reverting my commit because of buildbot breakage. This reverts commit d0b0dbeae17756f7ba99e0867cfb867fcb375066.
2023-07-01[msan] Intercept dladdr1, and refactor dladdrThurston Dang5-13/+202
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo. Differential Revision: https://reviews.llvm.org/D154272
2023-06-30[scudo] Improve Secondary Cache Dumpfernandosalas1-1/+3
Exclude cached blocks with invalid start address. Mainly concerned with cached blocks that are still available/unused. Reviewed By: Chia-hungDuan, cferris Differential Revision: https://reviews.llvm.org/D154148
2023-06-30[scudo] Restore Freelist when we fail on PageMap creationChia-hung Duan1-49/+48
Differential Revision: https://reviews.llvm.org/D154041
2023-06-30[msan] Add lit test for dladdrThurston Dang1-0/+47
This adds a simple lit test for dladdr. (There is currently a dladdr testcase in compiler-rt/lib/msan/tests/msan_test.cpp, but not a stand-alone lit test.) This is an incremental step towards adding a test case (and, eventually, an interceptor) for the more complicated dladdr1 function. Differential Revision: https://reviews.llvm.org/D154255
2023-06-30[UBSan] Fix shared library linking in test for Darwin.usama hameed1-2/+2
Without rpath information, the test fails on some Darwin platforms since the binary fails to find the shared library. rdar://110010041 Differential Revision: https://reviews.llvm.org/D154003
2023-06-30[dfsan] Add missing functions to done_abilist.txtJin Xin Ng1-0/+4
__sanitizer_get_allocated_begin and __sanitizer_get_allocated_size_fast were introduced recently in D147005 and D151360, but not added here, leading to linker errors. Differential Revision: https://reviews.llvm.org/D153680
2023-06-30[scudo] SizeClassAllocator64: dispatch all the classes in init()Fabio D'Urso1-6/+4
This will make it easier to verify in a future patch that the ReservedMemory object has been fully dispatched. Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153019
2023-06-29[scudo] Use getMonotonicTimeFast for tryLock.Christopher Ferris1-3/+3
In tryLock, the Precedence value is set using the fast time function now. This should speed up tryLock calls slightly. This should be okay even though the value is used as a kind of random value in getTSDAndLockSlow. The fast time call still sets enough bits to avoid getting the same TSD on every call. Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D154039
2023-06-29[MSan] Enable MSAN for loongarch64zhanglimin10-12/+64
This patch adds basic memory sanitizer support for loongarch64 with 47-bit VMA, which memory layout is based on x86_64. The LLVM part of the LoongArch memory sanitizer implementation will be done separately, which will fix failing tests in check-msan. These failing tests fail with the following same error: "error in backend: unsupported architecture". Reviewed By: #sanitizers, vitalybuka, MaskRay Differential Revision: https://reviews.llvm.org/D140528
2023-06-28[scudo] Use fast get time in secondary.Christopher Ferris1-1/+1
When I moved the primary to use the faster get time syscall, I missed the secondary use. Now fix the secondary to use this function too. Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D154012
2023-06-28[lsan] Be more conservative in SuspendedThreadsListMac::GetRegistersAndSPLeonard Grey1-4/+2
Currently, we only return REGISTERS_UNAVAILABLE_FATAL if we receive KERN_INVALID_ARGUMENT from thread_status. In reality, there are other possible return values (MACH_SEND_INVALID_DEST for example) that make it dangerous to read memory. This can be demonstrated by running create_thread_leak.cpp in standalone mode where it will appear to hang due to a EXC_BAD_ACCESS while scanning the stack. This change reverses the current logic to treat MIG_ARRAY_TOO_LARGE as non-fatal, and all other errors as fatal. Differential revision: https://reviews.llvm.org/D153072
2023-06-27sanitizer_allocator_test: guard SpecialSizeClassMap test with ↵Fangrui Song1-3/+3
!ALLOCATOR64_SMALL_SIZE This artificial size class map uses a very large kMaxSize (1<<34) which is not suitable for small kAddressSpaceSize systems (aarch64-*-linux-android, riscv64). Exposed by D153664.
2023-06-27[sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSizeFangrui Song1-2/+2
Commit 278ccdacdcbde3399f1fa4b3ab929212e4e0322c says that kAllocatorSize must be >= (1<<32), but this is not accurate. This static_assert causes 128GiB kAllocatorSize to be unable to select DefaultSizeClassMap (kRegionSize is 1<<31). Relax the restriction to be able to satisfy the largest size class. This allows DefaultSizeClassMap to be usable with 128GiB kAllocatorSize, with check-{asan,lsan,sanitizer} passing. Reviewed By: #sanitizers, vitalybuka, kstoimenov Differential Revision: https://reviews.llvm.org/D153664
2023-06-27[builtins] Avoid using floating point q suffix. NFCIAlex Richardson3-345/+381
The q floating point suffix is not supported by all compilers configurations (e.g. GCC only supports it for some targets), so use a macro (much like UINT64_C) instead. As this touches almost all lines in the two tests also run them through clang-format.
2023-06-27[test][sanitizer] Disable D153500 test on solarisVitaly Buka1-0/+3
The test causes unexpectedly high RSS usage there.
2023-06-27[builtins] Fix __floattitf and __floatuntitf on x86Alex Richardson5-99/+100
These conversion functions were using LDBL_MANT_DIG (which is the 80-bit extended float on x86) instead of the appropriate macro for the 128-bit floating point type expected by the *tf* softfloat library calls. This was discovered while testing D98261 (which allows building the *tf* functions on x86). This also changes the constants used in the two tests to use 128-bit floating-point literals instead of long double ones to ensure that the comparison succeeds on platforms with smaller long double (e.g. x86_64) Reviewed By: scanon Differential Revision: https://reviews.llvm.org/D131787
2023-06-27[ASan] Remove sanity checks during annotation of contiguous containerAdvenam Tacet1-3/+3
This revision removes sanity checks in `__sanitizer_annotate_contiguous_container`. (Changed them to `DCHECK_EQ`.) Those checks may be problematic, if someone manually unpoisoned memory block. Manual unpoisoning may be used if part of the program is not instrumented. Those checks are helpful while confirming correctness of ASan annotations implementation. Originally suggested here: https://reviews.llvm.org/D136765#4174546 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D145482
2023-06-26[scudo] Secondary Cache Dumpfernandosalas1-2/+22
Dumped some basic info about what is being cached and about the cache itself. Output of test below: ... Stats: MapAllocatorCache: EntriesCount: 33, MaxEntriesCount: 64, MaxEntrySize: 1048576 StartBlockAddress: 0x6d342c1000, EndBlockAddress: 0x6d342d2000, BlockSize: 69632 StartBlockAddress: 0x6fc45ff000, EndBlockAddress: 0x6fc462f000, BlockSize: 196608 ... Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153483
2023-06-26[scudo] Fix data leak in wrappers_c_test.cppRiley1-4/+15
In SmallAlign implemented deallocation for the pointers Reviewed By: cferris, Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153480
2023-06-26[scudo] Fix insufficient blocks when pushing BatchClass blocksChia-hung Duan1-0/+15
`populateFreeListAndPopBatch` may return batch with single block. Merge it with the reported free blocks and enqueue them together. Reviewed By: cferris, fabio-d Differential Revision: https://reviews.llvm.org/D153787
2023-06-26[compiler-rt] Stop using system ldd to detect libc versionAlex Brachet1-12/+30
The system libc may be different from the libc passed in CMAKE_SYSROOT. Instead of using the ldd in PATH to detect glibc version, use the features.h header file. Differential Revision: https://reviews.llvm.org/D151678
2023-06-26sanitizer: enable getentropy interception on Linux/GLIBC 2.25 and onwardsDavid CARLIER1-1/+2
https://man7.org/linux/man-pages/man3/getentropy.3.html Reviewers: melver Reviewed-By: melver Differential Revision: https://reviews.llvm.org/D153723
2023-06-23[test][MSAN] Fix test by printing action before execution itVitaly Buka1-3/+3
We expect log messages from enother thread triggered by actions.