15 Commits

Author SHA1 Message Date
Christopher Ferris
4634a480e0
[scudo] Add a method to use a hard-coded page size (#106646)
Currently, only Android supports using a hard-code page size. Make this
a bit more generic so any platform that wants to can use this.

In addition, add a getPageSizeLogCached() function since this value is
used in release.h and can avoid keeping this value around in objects.

Finally, change some of the release.h page size multiplies to shifts
using the new page size log value.
2024-09-05 13:43:34 -07:00
Florian Mayer
3da0166331 Reland^2 "[scudo] resize stack depot for allocation ring buffer"
Fix some warnings by matching types.

This reverts commit e1164d063558b1e89f20109d83c079caae1825d8.
2024-02-16 22:59:53 -08:00
Florian Mayer
e1164d0635
Revert "Reland "[scudo] resize stack depot for allocation ring buffer"" (#82088)
Reverts llvm/llvm-project#81028
2024-02-16 17:58:54 -08:00
Florian Mayer
aff6cb4957
Reland "[scudo] resize stack depot for allocation ring buffer" (#81028)
First commit of the stack is a clean reland, second is  the fix.

There was a typo in the `static_assert` that meant we were asserting the
size of the pointer, not the struct.

Also changed `alignas` to be more intuitive, but that is NFC.

Ran builds in Android here: https://r.android.com/2954411
2024-02-16 17:10:54 -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
Chia-hung Duan
88852964ec [scudo] Add SCUDO_ENABLE_HOOKS to enable hooks at compilation time
Accessing the PLT entries of hooks can lead a certain amount of
performance overhead. This is observed on certain tasks which will do a
bunch of malloc/free and their throughputs are impacted by the null
check of hooks.

Also add SCUDO_ENABLE_HOOKS_TESTS to select if we want to run the hook
tests. On some platforms they may have different ways to run the
wrappers tests (end-to-end tests) and test the hooks along with the
wrappers tests may not be feasible. Provide an option to turn it ON/OFF.

By default, we only verify the hook behavior in the scudo standalone
tests if SCUDO_ENABLE_HOOKS is defined or COMPILER_RT_DEBUG is true.

Reviewed By: cferris, fabio-d

Differential Revision: https://reviews.llvm.org/D158784
2023-08-28 22:11:18 +00:00
Christopher Ferris
41a275321f [scudo] Fix definition of SCUDO_SMALL_STACK_DEPOT.
The SCUDO_FUZZ macro is either defined or not defined. The previous
code assumed it had a one or zero value, so change the setting of
SCUDO_SMALL_STACK_DEPOT based on defined(SCUDO_FUZZ).

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D158459
2023-08-21 15:17:56 -07:00
Andrei Homescu
2dc5862cfe [scudo] Limit stack depot size on Trusty
The stack depot uses several megabytes of memory
which is a lot for Trusty.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D156392
2023-08-21 18:32:34 +00:00
Marco Nelissen
146f4c26ac [scudo] Enable MTE in Trusty
Trusty now has MTE support.
Back-ported from https://r.android.com/2332745.

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D152219
2023-06-07 00:15:04 +00:00
Caslyn Tonelli
96005d75b2 [scudo] Tune FuchsiaConfig for RiscV
Reduce `PrimaryRegionSizeLog` to 28U to be compatible with a 38bit user
address space on the fuchsia-riscv platform. `PrimaryGroupSizeLog` is
reduced to 19 to preserve 512 BatchGroups per region.

This change can be tested on Fuchsia with:

```
fx set --auto-dir bringup.riscv64 --with //bundles:boot_tests \
fx build bundles:boot_tests \
fx run-boot-test --args={-s,1} boot-libc-unittests \
--cmdline='--gtest_filter=-*DeathTest*:PthreadGetSet*:ScudoSecondaryTest*'
```
The gtest filter ignores pthread and death tests due to non-scudo
related issues on fuchsia-riscv (ScudoSecondaryTest includes a death
check).

Related Ticket: https://fxbug.dev/125263

Differential Revision: https://reviews.llvm.org/D148475
2023-04-17 20:15:55 +00:00
Dominic Chen
26a5f9bd03 [scudo] Don't assume preprocessor macro is defined
Differential Revision: https://reviews.llvm.org/D121857
2022-03-18 12:52:18 -07:00
Daniel Michael
2551053e8d [scudo] Add Scudo support for Trusty OS
trusty.cpp and trusty.h define Trusty implementations of map and other
platform-specific functions. In addition to adding Trusty configurations
in allocator_config.h and size_class_map.h, MapSizeIncrement and
PrimaryEnableRandomOffset are added as configurable options in
allocator_config.h.
Background on Trusty: https://source.android.com/security/trusty

Differential Revision: https://reviews.llvm.org/D103578
2021-06-08 14:02:10 -07:00
Kostya Kortchinsky
0fd6f19025 [scudo][standalone] Support __BIONIC__
Summary:
Some Android builds that we are interested in define `__BIONIC__`
but not `__ANDROID__`, so expand `SCUDO_ANDROID` to encompass those.

Reviewers: cferris, hctim, pcc, eugenis, morehouse

Subscribers: krytarowski, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D71772
2019-12-20 12:59:33 -08:00
Kostya Kortchinsky
47f0d136f1 [scudo] Initial standalone skeleton check-in
Summary:
This is the initial check-in for the Standalone version of Scudo.

The project is initially going to live in scudo/standalone then will
replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html
for details.

This initial CL is meant to lay out the project structure, of both
code & tests, providing a minimal amount of functionalities, namely
various definitions, some atomic helpers and an intrusive list.
(empty.cc is just here to have a compilation unit, but will go away
in the upcoming CLs).

Initial support is restricted to Linux i386 & x86_64 in make files
and will be extended once things land & work.

We will grow organically from here, adding functionalities in limited
amounts.

Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack

Reviewed By: morehouse, vitalybuka

Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D57412

llvm-svn: 353055
2019-02-04 16:25:40 +00:00