Stay organized with collections
Save and categorize content based on your preferences.
The sanitizers are a group of dynamic analysis tools that find mistakes in
programs at runtime through additional instrumentation that was inserted by the
compiler. This includes detecting
memory safety issues. Android supports
and strongly recommends usage of the following sanitizers:
Hardware-assisted AddressSanitizer (HWASan)
HWASan is the main sanitizer to provide detection
for memory safety problems. It requires ARM64 and can detect:
Stack and heap buffer overflow or underflow
Heap use after free
Stack use after scope
Stack use after return
Double free or wild free
Address sanitizer (ASan)
ASan is a tool similar to HWASan. It works on more
platforms, but is unsupported on Android.
KernelAddress sanitizer (KASan)
KASan is the kernel counterpart of the userspace
tools above. It shares the same compiler implementation. KASan and ASan/HWASan
are complementary as one tool applies to the kernel and another to userspace.
We recommend enabling both at the same time to reduce the number of build
configurations and to reduce the testing matrix.
UndefinedBehavior sanitizer (UBSan)
UBSan performs compile-time instrumentation to
check for various types of (non memory-safety) undefined behavior. This includes
signed and unsigned integer overflow checking (IntSan), bounds checks for
statically-sized arrays (BoundsSan), and lots of other types of undefined
behavior. IntSan and BoundsSan are also suitable for enabling in production as a
security mitigation.
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 2024-08-26 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-08-26 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 2024-08-26 UTC."]]