[ Web Proxy ]
URL:
Viewing: https://source.android.com/docs/security/test/scudo [Back]  [Original]

Scudo  |  Android Open Source Project Skip to main content
Android Open Source Project [Android Open Source Project]

Scudo Stay organized with collections Save and categorize content based on your preferences.

Scudo is a dynamic user-mode memory allocator, or heap allocator, designed to be resilient against heap-related vulnerabilities (such as heap-based buffer overflow, use after free, and double free) while maintaining performance. It provides the standard C allocation and deallocation primitives (such as malloc and free), as well as the C++ primitives (such as new and delete).

Scudo is more of a mitigation than a fully fledged memory error detector like AddressSanitizer (ASan).

Since the Android 11 release, scudo is used for all native code (except on low-memory devices, where jemalloc is still used). At runtime, all native heap allocations and deallocations are serviced by Scudo for all executables and their library dependencies, and the process is aborted if a corruption or suspicious behavior is detected in the heap.

Scudo is open source and part of LLVM's compiler-rt project. Documentation is available at https://llvm.org/docs/ScudoHardenedAllocator.html. The Scudo runtime ships as part of the Android toolchain and support was added to Soong and Make to allow for easy enabling of the allocator in a binary.

You can enable or disable extra mitigation within the allocator using the options described below.

Customization

Some parameters of the allocator can be defined on a per-process basis through several ways:

The following options are available.

Note: Frontend options have a different name format than backend options.
Option 64-bit default 32-bit default Description
QuarantineSizeKb 256 64 The size (in KB) of quarantine used to delay the actual deallocation of chunks. A lower value may reduce memory usage but decrease the effectiveness of the mitigation; a negative value falls back to the defaults. Setting both this and ThreadLocalQuarantineSizeKb to zero disables the quarantine entirely.
QuarantineChunksUpToSize 2048 512 The size (in bytes) up to which chunks can be quarantined.
ThreadLocalQuarantineSizeKb 64 16 The size (in KB) of per-thread cache use to offload the global quarantine. A lower value may reduce memory usage but might increase contention on the global quarantine. Setting both this and QuarantineSizeKb to zero disables the quarantine entirely.
DeallocationTypeMismatch false false Enables error reporting on malloc/delete, new/free, new/delete[]
DeleteSizeMismatch true true Enables error reporting on mismatch between sizes of new and delete.
ZeroContents false false Enables zero chunk contents on allocation and deallocation.
allocator_may_return_null false false Specifies that the allocator can return null when a recoverable error occurs, instead of terminating the process.
hard_rss_limit_mb 0 0 When the process's RSS reaches this limit, the process terminates.
soft_rss_limit_mb 0 0 When the process's RSS reaches this limit, further allocations fail or return null (depending on the value of allocator_may_return_null), until the RSS goes back down to allow for new allocations.
allocator_release_to_os_interval_ms 5000 N/A Only affects a 64-bit allocator. If set, tries to release unused memory to the OS, but not more often than this interval (in milliseconds). If the value is negative, memory isn't released to the OS.
abort_on_error true true If set, the tool calls abort() instead of _exit() after printing the error message.

Validation

Currently, there are no CTS tests specifically for Scudo. Instead, make sure that CTS tests pass with or without Scudo enabled for a given binary to verify that it doesn't impact the device.

Troubleshooting

If a non-recoverable issue is detected, the allocator displays an error message to the standard error descriptor and then terminates the process. Stack traces that lead to the termination are added in the system log. The output usually starts with Scudo ERROR: followed by a short summary of the problem along with any pointers. Note: Again, Scudo is meant to be a mitigation. Consider using ASan to determine the root cause of the issue.

Here is a list of the current error messages and their potential causes:

If you're debugging a crash in the OS itself, you can use a HWASan OS build. If you're debugging a crash in an app, it's possible to use a HWASan app build too.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-07-13 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-13 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page