14540 Commits

Author SHA1 Message Date
Nico Weber
30d3bb598f [compiler-rt] Tweak cmake formatting
No behavior change. For easier extraction of sources by grepping
(such as done by llvm/utils/gn/build/sync_source_lists_from_cmake.py).
2025-07-22 09:22:47 -04:00
Zack Johnson
7cfd32a1d5
[compiler-rt][MSVC] Conditionally remove emupac.cpp for msvc (#149823)
#148094 introduces logic for emulated PAC, which utilizes language
extensions not available on MSVC.
2025-07-22 08:54:36 -04:00
Fabio D'Urso
fcdcc4ea7a
[scudo] Make Ptr volatile so that the malloc and free calls are not optimized out (#149944)
This fixes the test failure seen in the discussion about
https://github.com/llvm/llvm-project/pull/148066.
2025-07-22 03:31:35 +02:00
Jens Reidel
a5d6fa68e3
[compiler-rt][Mips] Fix stat size check on mips64 musl (#143301)
The sizes of the struct stat on MIPS64 differ in musl vs glibc.

See https://godbolt.org/z/qf9bcq8Y8 for the proof. Prior to this change,
compilation for MIPS64 musl would fail.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-07-18 20:01:44 -04:00
Jake Egan
4e6b843cf5
[asan] Revert global check for non-AIX (#149245)
287b24e1899eb6ce62eb9daef5a24faae5e66c1e moved the
`GetGlobalAddressInformation` call earlier, but this broke a chromium
test, so make this workaround for AIX only.
2025-07-17 15:50:44 -04:00
Peter Collingbourne
3fa07ed5b3
Rename config.host_os to config.target_os.
config.host_os is derived from CMAKE_SYSTEM_NAME
which specifies the target. See:
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html

To reduce confusion, rename it to config.target_os.

The variable name config.target_os was already being used by the Orc
tests. Rename it to config.orc_test_target_os with a FIXME to remove.

Reviewers: JDevlieghere, MaskRay

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/149015
2025-07-17 11:12:29 -07:00
Christopher Ferris
34b3ea367c
[scudo] Make release to OS test more specific. (#147852)
The original version of ResidentMemorySize could be a little flaky.
Replace the test with a version that verifies exactly how much of the
map is resident.
2025-07-16 19:25:57 -07:00
Peter Collingbourne
de31584001
Reapply "compiler-rt: Introduce runtime functions for emulated PAC."
This reverts commit 0c0aa56cdcf1fe3970a5f3875db412530512fc07.

This time with the following fixes for buildbot failures:
- Add underscore prefixes to symbol names on Apple platforms.
- Modify the test so that it skips the crash tests on platforms where
  they are not expected to pass:
  - Platforms that implement FEAT_PAuth but not FEAT_FPAC (e.g.
    Apple M1, Cortex-A78C)
  - Platforms where DA key is disabled (e.g. older Linux kernels,
    Linux kernels with PAC disabled, likely Windows)

Original commit message follows:

The emulated PAC runtime functions emulate the ARMv8.3a pointer
authentication instructions and are intended for use in heterogeneous
testing environments. For more information, see the associated RFC:
https://discourse.llvm.org/t/rfc-emulated-pac/85557

Reviewers: mstorsjo, pawosm-arm, atrosinenko

Reviewed By: atrosinenko

Pull Request: https://github.com/llvm/llvm-project/pull/148094
2025-07-14 13:13:32 -07:00
Christopher Ferris
309bb1ed68
[scudo] Fix c wrappers double free test. (#148066)
The previous test simply tried to double free the pointer in the
EXPECT_DEATH macro. Unfortunately, the gtest infrastructure can allocate
a pointer that happens to be the previously freed pointer. Thus the free
doesn't fail since the spawned process does not attempt to free all of
the pointers allocated in the original test.

NOTE: Scudo should be checked to make sure that the TSD is not always
returning pointers in the same order they are freed. Although this
appears to be a problem with a program that only does a small number of
allocations.
2025-07-14 11:15:10 -07:00
Jake Egan
a742ee6a43
[sanitizer_common][NFC] Fix sanitizer_platform_limits_posix.h formatting (#147864)
From running `clang-format` on the whole file.
2025-07-11 21:15:57 -04:00
Peter Collingbourne
0c0aa56cdc Revert "compiler-rt: Introduce runtime functions for emulated PAC."
As well as followup "builtins: Speculative MSVC fix."

This reverts commits 5b1db59fb87b4146f827d17396f54ef30ae0dc40 and
f1c4df5b7bb79efb3e9be7fa5f8176506499d0a6.

Needs fixes for failing tests which will take time to implement.
2025-07-10 13:16:36 -07:00
Jessica Clarke
9320d1d484
[compiler-rt] Don't handle Linux-specific shmctl commands in sanitizer (#143116)
Despite being defined in the system headers, these commands are not in
fact part of the FreeBSD system call interface. They exist solely for
the Linuxulator, i.e. running Linux binaries on FreeBSD, and any attempt
to use them from a FreeBSD binary will return EINVAL. The fact we needed
to define _KERNEL (which, as the name implies, means we are compiling
the kernel) to even get the definition of shminfo should have been a
strong indicator that IPC_INFO at least was not a userspace interface.
2025-07-10 19:33:24 +01:00
Hervé Poussineau
34f49aa2e9
[compiler-rt][sanitizer] Add Windows MIPS32 support (#145110)
As LLVM supports mipsel-windows-gnu and mipsel-windows-msvc triples,
also support this configuration in compiler-rt
2025-07-10 17:52:19 +01:00
Takuto Ikuta
f7cdff7bdd
[compiler-rt] Include missing headers for libFuzzer (#146828)
This is to fix modules build errors in chromium like
*
https://ci.chromium.org/ui/p/chromium/builders/try/linux-libfuzzer-asan-rel/2292144/overview
*
https://ci.chromium.org/ui/p/chromium/builders/try/linux-libfuzzer-asan-rel/2292444/overview

---------

Co-authored-by: Petr Hosek <phosek@google.com>
2025-07-10 10:56:08 +02:00
Peter Collingbourne
f1c4df5b7b builtins: Speculative MSVC fix.
Attempt to fix these build failures:
https://lab.llvm.org/buildbot/#/builders/107/builds/12601

The suspected cause is that #133530 caused us to start
passing -std:c11 to MSVC, which activated this code path
that uses _Complex, which MSVC does not support. See:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support

Fix it by also checking _MSC_VER.
2025-07-09 18:32:41 -07:00
Jake Egan
d286540734
[sanitizer_common] Introduce SANITIZER_MMAP_BEGIN macro (#147645)
To prepare for other platforms, such as 64-bit AIX, that have a non-zero
mmap beginning address.

---------

Co-authored-by: David Justo <david.justo.1996@gmail.com>
2025-07-09 20:14:23 -04:00
Peter Collingbourne
5b1db59fb8
compiler-rt: Introduce runtime functions for emulated PAC.
The emulated PAC runtime functions emulate the ARMv8.3a pointer
authentication instructions and are intended for use in heterogeneous
testing environments. For more information, see the associated RFC:
https://discourse.llvm.org/t/rfc-emulated-pac/85557

Reviewers: llvm-beanz, petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/133530
2025-07-09 16:18:37 -07:00
ChiaHungDuan
4ea0ef2e94
[scudo] Move out the definitions of member functions in primary allocators (#147601)
This greatly improves the readability so that we are able to tell the
design by the concise class definition.
2025-07-09 13:42:02 -07:00
Justin King
64453c802e
rtsan: Support free_sized and free_aligned_sized from C23 (#145085)
Adds support to RTSan for `free_sized` and `free_aligned_sized` from
C23.

Other sanitizers will be handled with their own separate PRs.

For https://github.com/llvm/llvm-project/issues/144435

Signed-off-by: Justin King <jcking@google.com>
2025-07-09 10:36:59 -07:00
Justin King
5cf4537fe1
hwasan: refactor new/delete interceptor macros (#146698)
Same as #146696 but for #145357.

---------

Signed-off-by: Justin King <jcking@google.com>
2025-07-08 15:19:04 -07:00
ChiaHungDuan
8b65c9d1ed
[scudo] Make block storage in TransferBatch trailing objects (#144204)
This allows us to change the number of blocks stored according to the
size of BatchClass.

Also change the name `TransferBatch` to `Batch` given that it's never
the unit of transferring blocks.
2025-07-08 11:07:05 -07:00
Jake Egan
875581b3ca
[asan][AIX] Move import/export lists to an AIX-specific subdirectory (#145936)
This makes it more clear that these lists are AIX-specific.
2025-07-08 10:06:54 -04:00
Brad Smith
18292a4ea2
[sanitizer_common] Drop remaining support for Android 5 or older (#146187)
Dependent on https://github.com/llvm/llvm-project/pull/145227
2025-07-07 22:01:44 -04:00
Brad Smith
fe56f69810
[sanitizer_common] Drop support for Android 5 (#145227) 2025-07-07 21:06:07 -04:00
David Justo
0d7e64f5d2
[ASan][Windows] Honor asan config flags on windows when set through the user function (#122990)
**Related to:** https://github.com/llvm/llvm-project/issues/117925 
**Follow up to:** https://github.com/llvm/llvm-project/pull/117929

**Context:**
As noted in the linked issue, some ASan configuration flags are not
honored on Windows when set through the `__asan_default_options` user
function. The reason for this is that `__asan_default_options` is not
available by the time `AsanInitInternal` executes, which is responsible
for applying the ASan flags.

To fix this properly, we'll probably need a deep re-design of ASan
initialization so that it is consistent across OS'es.
In the meantime, this PR offers a practical workaround.

**This PR:** refactors part of `AsanInitInternal` so that **idempotent**
flag-applying steps are extracted into a new function `ApplyOptions`.
This function is **also** invoked in the "weak function callback" on
Windows (which gets called when `__asan_default_options` is available)
so that, if any flags were set through the user-function, they are
safely applied _then_.

Today, `ApplyOptions` contains only a subset of flags. My hope is that
`ApplyOptions` will over time, through incremental refactorings
`AsanInitInternal` so that **all** flags are eventually honored.

Other minor changes:
* The introduction of a `ApplyAllocatorOptions` helper method, needed to
implement `ApplyOptions` for allocator options without re-initializing
the entire allocator. Reinitializing the entire allocator is expensive,
as it may do a whole pass over all the marked memory. To my knowledge,
this isn't needed for the options captured in `ApplyAllocatorOptions`.
* Rename `ProcessFlags` to `ValidateFlags`, which seems like a more
accurate name to what that function does, and prevents confusion when
compared to the new `ApplyOptions` function.
2025-07-02 15:37:28 -07:00
Justin King
e3edc1bd87
asan: refactor new/delete interceptor macros (#146696)
Refactors new/delete interceptor macros per the discussion in #145087.

Signed-off-by: Justin King <jcking@google.com>
2025-07-02 11:18:55 -07:00
Kunqiu Chen
0aafeb8ba1
Reland [TSan] Clarify and enforce shadow end alignment (#146676)
#144648 was reverted because it failed the new sanitizer test
`munmap_clear_shadow.c` in IOS's CI.
That issue could be fixed by disabling the test on some platforms, due
to the incompatibility of the test on these platforms.

In detail, we should disable the test in FreeBSD, Apple, NetBSD,
Solaris, and Haiku, where `ReleaseMemoryPagesToOS` executes
`madvise(beg, end, MADV_FREE)`, which tags the relevant pages as 'FREE'
and does not release them immediately.
2025-07-02 20:28:30 +08:00
Kunqiu Chen
9eac5f72f6
Revert "[TSan] Clarify and enforce shadow end alignment" (#146674)
Reverts llvm/llvm-project#144648 due to a test failure of the new added
test case `munmap_clear_shadow.c` in IOS .
2025-07-02 20:11:11 +08:00
Vitaly Buka
233078fd8d [nfc][asan] clang-format for #145087 2025-06-30 11:34:04 -07:00
Justin King
b2b20eeb54
tsan: Support free_sized and free_aligned_sized from C23 (#144531)
Adds support to TSan for `free_sized` and `free_aligned_sized` from C23.

Other sanitizers will be handled with their own separate PRs.

For https://github.com/llvm/llvm-project/issues/144435

Signed-off-by: Justin King <jcking@google.com>
2025-06-30 11:09:46 -07:00
Sterling-Augustine
23f1ba3ee4
Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) (#146112)
Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#…
(#145959)
    
This reapplies cbf781f0bdf2f680abbe784faedeefd6f84c246e, with fixes for
the shared-library build and the unconventional sanitizer-runtime build.

Original Description:

This is the culmination of a series of changes described in [1].
    
Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.
    
1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-27 11:05:49 -07:00
John Brawn
ec1c73b2ec
[compiler-rt][ARM] Only use bxaut when the target has pacbti (#146057)
Most pacbti instructions are a nop when the target does not have pacbti,
and thus safe to execute, but bxaut is an undefined instruction. When we
don't have pacbti (e.g. if we're compiling compiler-rt with
-mbranch-protection=standard in order to be forward-compatible with
pacbti while still working on targets without it) then we need to use
separate aut and bx instructions.
2025-06-27 13:26:09 +01:00
Kunqiu Chen
bc90166a50
[TSan] Clarify and enforce shadow end alignment (#144648)
In TSan, every `k` bytes of application memory (where `k = 8`) maps to a
single shadow/meta cell. This design leads to two distinct outcomes when
calculating the end of a shadow range using `MemToShadow(addr_end)`,
depending on the alignment of `addr_end`:

- **Exclusive End:** If `addr_end` is aligned (`addr_end % k == 0`),
`MemToShadow(addr_end)` points to the first shadow cell *past* the
intended range. This address is an exclusive boundary marker, not a cell
to be operated on.
- **Inclusive End:** If `addr_end` is not aligned (`addr_end % k != 0`),
`MemToShadow(addr_end)` points to the last shadow cell that *is* part of
the range (i.e., the same cell as `MemToShadow(addr_end - 1)`).

Different TSan functions have different expectations for whether the
shadow end should be inclusive or exclusive. However, these expectations
are not always explicitly enforced, which can lead to subtle bugs or
reliance on unstated invariants.


The core of this patch is to ensure that functions ONLY requiring an
**exclusive shadow end** behave correctly.

1.  Enforcing Existing Invariants:
For functions like `MetaMap::MoveMemory` and `MapShadow`, the assumption
is that the end address is always `k`-aligned. While this holds true in
the current codebase (e.g., due to some external implicit conditions),
this invariant is not guaranteed by the function's internal context. We
add explicit assertions to make this requirement clear and to catch any
future changes that might violate this assumption.

2.  Fixing Latent Bugs:
In other cases, unaligned end addresses are possible, representing a
latent bug. This was the case in `UnmapShadow`. The `size` of a memory
region being unmapped is not always a multiple of `k`. When this
happens, `UnmapShadow` would fail to clear the final (tail) portion of
the shadow memory.

This patch fixes `UnmapShadow` by rounding up the `size` to the next
multiple of `k` before clearing the shadow memory. This is safe because
the underlying OS `unmap` operation is page-granular, and the page size
is guaranteed to be a multiple of `k`.

Notably, this fix makes `UnmapShadow` consistent with its inverse
operation, `MemoryRangeImitateWriteOrResetRange`, which already performs
a similar size round-up.

In summary, this PR:

- **Adds assertions** to `MetaMap::MoveMemory` and `MapShadow` to
enforce their implicit requirement for k-aligned end addresses.
- **Fixes a latent bug** in `UnmapShadow` by rounding up the size to
ensure the entire shadow range is cleared. Two new test cases have been
added to cover this scenario.
  - Removes a redundant assertion in `__tsan_java_move`.
- Fixes an incorrect shadow end calculation introduced in commit
4052de6. The previous logic, while fixing an overestimation issue, did
not properly account for `kShadowCell` alignment and could lead to
underestimation.
2025-06-27 14:43:34 +08:00
Jake Egan
60285d98ef
[asan] Implement address sanitizer on AIX: build configuration (#139583)
Update asan build configuration for AIX:
- Adds import lists
- Guards shared library code

Issue: #138916

---------

Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
2025-06-25 11:26:39 -04:00
Jake Egan
287b24e189
[asan] Implement address sanitizer on AIX: address descriptions (#138891)
Adapt address description logic for AIX. 

Issue: https://github.com/llvm/llvm-project/issues/138916
2025-06-25 11:18:15 -04:00
Thurston Dang
c85466dcd4
Reapply "[msan] Automatically print shadow for failing outlined checks" (#145611) (#145615)
This reverts commit 5eb5f0d8760c6b757c1da22682b5cf722efee489 i.e.,
relands 1b71ea411a9d36705663b1724ececbdfec7cc98c.

Test case was failing on aarch64 because the long double type is
implemented differently on x86 vs aarch64. This reland restricts the
test to x86.

----

Original CL description:
    
A commonly used aid for debugging MSan reports is
`__msan_print_shadow()`, which requires manual app code annotations
(typically of the variable in the UUM report or nearby). This is in
contrast to ASan, which automatically prints out the shadow map when a
check fails.
    
This patch changes MSan to print the shadow that failed an outlined
check (checks are outlined per function after the
`-msan-instrumentation-with-call-threshold` is exceeded) if verbosity >=
1. Note that we do not print out the shadow map of "neighboring"
variables because this is technically infeasible; see "Caveat" below.
    
This patch can be easier to use than `__msan_print_shadow()` because
this does not require manual app code annotations. Additionally, due to
optimizations, `__msan_print_shadow()` calls can sometimes spuriously
affect whether a variable is initialized.
    
As a side effect, this patch also enables outlined checks for
arbitrary-sized shadows (vs. the current hardcoded handlers for
{1,2,4,8}-byte shadows).
    
Caveat: the shadow does not necessarily correspond to an individual user
variable, because MSan instrumentation may combine and/or truncate
multiple shadows prior to emitting a check that the mangled shadow is
zero (e.g., `convertShadowToScalar()`,
`handleSSEVectorConvertIntrinsic()`, `materializeInstructionChecks()`).
OTOH it is arguably a strength that this feature emit the shadow that
directly matters for the MSan check, but which cannot be obtained using
the MSan API.
2025-06-24 20:33:11 -07:00
Thurston Dang
5eb5f0d876
Revert "[msan] Automatically print shadow for failing outlined checks" (#145611)
Reverts llvm/llvm-project#145107

Reason: buildbot breakage
(https://lab.llvm.org/buildbot/#/builders/51/builds/18512)
2025-06-24 15:53:19 -07:00
Thurston Dang
1b71ea411a
[msan] Automatically print shadow for failing outlined checks (#145107)
A commonly used aid for debugging MSan reports is `__msan_print_shadow()`, which requires manual app code annotations (typically of the variable in the UUM report or nearby). This is in contrast to ASan, which automatically prints out the shadow map when a check fails.

This patch changes MSan to print the shadow that failed an outlined check (checks are outlined per function after the `-msan-instrumentation-with-call-threshold` is exceeded) if verbosity >= 1. Note that we do not print out the shadow map of "neighboring" variables because this is technically infeasible; see "Caveat" below.

This patch can be easier to use than `__msan_print_shadow()` because this does not require manual app code annotations. Additionally, due to optimizations, `__msan_print_shadow()` calls can sometimes spuriously affect whether a variable is initialized.

As a side effect, this patch also enables outlined checks for arbitrary-sized shadows (vs. the current hardcoded handlers for {1,2,4,8}-byte shadows).

Caveat: the shadow does not necessarily correspond to an individual user variable, because MSan instrumentation may combine and/or truncate multiple shadows prior to emitting a check that the mangled shadow is zero (e.g., `convertShadowToScalar()`, `handleSSEVectorConvertIntrinsic()`, `materializeInstructionChecks()`). OTOH it is arguably a strength that this feature emit the shadow that directly matters for the MSan check, but which cannot be obtained using the MSan API.
2025-06-24 15:09:44 -07:00
Kunqiu Chen
74aab3045d
[TSan, NFC] Eliminate useless calculations in TSan (#145283)
Previously, TSan repeatedly calculated some values in some cases, and
this change eliminates these duplicate calculations.
2025-06-23 15:24:03 +08:00
Camsyn
20c04a646b
[NFC][Sanitizer] Fix incorrect desc of [beg, end] to [beg, end)
Correct the interval desc of ReleaseMemoryPagesToOS from [beg, end] to
[beg, end), as it actually does.

The previous incorrect description of [beg, end] might cause an
incorrect invoke as follows: `ReleaseMemoryPagesToOS(0, kPageSize - 1);`
2025-06-23 15:21:34 +08:00
Kunqiu Chen
99af99c665
[TSan] Fix p == end == ShadowMem::end in ShadowSet (#144994)
In `ShadowSet`, when `p == end == ShadowMem::end`, it triggered an
assertion fail previously.

Now we do not allow `p == end` anymore in `ShadowSet`.
2025-06-21 23:02:41 +08:00
Iris Shi
fa117715ca
[RISCV] Implement Feature Bit for Q (#145001) 2025-06-21 11:32:28 +08:00
Justin King
bfef8732be
msan: Support free_sized and free_aligned_sized from C23 (#144529)
Adds support to MSan for `free_sized` and `free_aligned_sized` from C23.

Other sanitizers will be handled with their own separate PRs.

For https://github.com/llvm/llvm-project/issues/144435

Signed-off-by: Justin King <jcking@google.com>
2025-06-20 09:16:40 -07:00
Justin King
f780955e1d
lsan: fix macos build after #144604 (#144818)
Fixes build failures on macOS, including

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/

llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:579:3: error: use of undeclared identifier 'LSAN_MAYBE_INTERCEPT_FREE_SIZED'
13:23:58    579 |   LSAN_MAYBE_INTERCEPT_FREE_SIZED;
13:23:58        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13:23:58  /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:580:3: error: use of undeclared identifier 'LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED'
13:23:58    580 |   LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED;
13:23:58        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13:23:58  2 errors generated.
2025-06-19 18:38:45 +01:00
Kunqiu Chen
681db064d2
[TSan] Make Shadow/Meta region inclusive-exclusive (#144647)
This commit changes the interval shadow/meta address check from
inclusive-inclusive ( $[\mathrm{start}, \mathrm{end}]$ ) to
inclusive-exclusive ( $[\mathrm{start}, \mathrm{end})$ ), to resolve the
ambiguity of the end point address. This also aligns the logic with the
check for `isAppMem` (i.e., inclusive-exclusive), ensuring consistent
behavior across all memory classifications.

1. The `isShadowMem` and `isMetaMem` checks previously used an
inclusive-inclusive interval, i.e., $[\mathrm{start}, \mathrm{end}]$,
which could lead to a boundary address being incorrectly classified as
both Shadow and Meta memory, e.g., 0x3000_0000_0000 in
`Mapping48AddressSpace`.
- What's more, even when Shadow doesn't border Meta, `ShadowMem::end`
cannot be considered a legal shadow address, as TSan protects the gap,
i.e., `ProtectRange(ShadowEnd(), MetaShadowBeg());`

2. `ShadowMem`/`MetaMem` addresses are derived from `AppMem` using an
affine-like transformation (`* factor + bias`). This transformation
includes two extra modifications: high- and low-order bits are masked
out, and for Shadow Memory, an optional XOR operation may be applied to
prevent conflicts with certain AppMem regions.
- Given that all AppMem regions are defined as inclusive-exclusive
intervals, $[\mathrm{start}, \mathrm{end})$, the resulting Shadow/Meta
regions should logically also be inclusive-exclusive.

Note: This change is purely for improving code consistency and should
have no functional impact. In practice, the exact endpoint addresses of
the Shadow/Meta regions are generally not reached.
2025-06-19 16:25:51 +08:00
Muhammad Omair Javaid
7b6963ea67 [compiler-rt] [Fuzzer] Fix tests linking buildbot failure (#144495)
Fix for #144495 by 6f4add3 broke sanitizer-aarch64-linux buildbot.

compiler-rt/lib/fuzzer/tests build failed because the linker was
looking gcc_s without '-l' appended.

The CMake script was adding the library name without the required
'-l' prefix. This patch adds the -l prefix changing gcc_s to -lgcc_s
and gcc to -lgcc.

https://lab.llvm.org/buildbot/#/builders/51/builds/18170
2025-06-19 03:21:20 +05:00
Justin King
22a69a266d
lsan: Support free_sized and free_aligned_sized from C23 (#144604)
Adds support to LSan for `free_sized` and `free_aligned_sized` from C23.

Other sanitizers will be handled with their own separate PRs.

For https://github.com/llvm/llvm-project/issues/144435

This is attempt number 2.

Signed-off-by: Justin King <jcking@google.com>
2025-06-18 12:57:49 -07:00
Christopher Ferris
a2cee05449
[scudo] Make report pointers const. (#144624)
Mark as many of the reportXX functions that take pointers const. This
avoid the need to use const_cast when calling these functions on an
already const pointer.

Fix reportHeaderCorruption calls where an argument was passed into an
append call that didn't use them.
2025-06-18 09:12:53 -07:00
Omair Javaid
6f4add3480
[compiler-rt] [Fuzzer] Fix ARMv7 test link failure by linking unwinder (#144495)
compiler-rt/lib/fuzzer/tests build was failing on armv7, with undefined
references to unwinder symbols, such as __aeabi_unwind_cpp_pr0.

This occurs because the test is built with `-nostdlib++` but `libunwind`
is not explicitly linked to the final test executable.

This patch resolves the issue by adding CMake logic to explicitly link
the required unwinder to the fuzzer tests, inspired by the same solution
used to fix Scudo build failures by https://reviews.llvm.org/D142888.
2025-06-18 19:23:54 +05:00
Kunqiu Chen
10f29a6072
[MSan] Fix wrong unpoison size in SignalAction (#144071)
MSan should unpoison the parameters of extended signal handlers. 
However, MSan unpoisoned the second parameter with the wrong size 
`sizeof(__sanitizer_sigaction)`, inconsistent with its real type 
`siginfo_t`.

This commit fixes this issue by correcting the size to 
`sizeof(__sanitizer_siginfo)`.
2025-06-18 14:53:33 +08:00