• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Address Sanitizer Event Overview
2
3## Overview
4
5An address sanitizer error refers to an invalid memory access that causes application exceptions or crashes.
6
7You can subscribe to address sanitizer events using the HiAppEvent APIs. Currently, the ArkTs and C/C++ APIs are provided. For details, see the following topics.
8
9- [Subscribing to Address Sanitizer Events (ArkTS)](hiappevent-watcher-address-sanitizer-events-arkts.md)
10
11- [Subscribing to Address Sanitizer Events (C/C++)](hiappevent-watcher-address-sanitizer-events-ndk.md)
12
13## Detection Principles
14
15For details, see [Address Sanitizer Detection](address-sanitizer-guidelines.md).
16
17## Event Fields
18
19### params
20
21
22
23| Name| Type| Description|
24| -------- | -------- | -------- |
25| time | number | Event triggering time, in ms.|
26| bundle_version | string | Application version.|
27| bundle_name | string | Application name.|
28| pid | number | Process ID of the application.|
29| uid | number | User ID of the application.|
30| type | string | Type of the address sanitizer error. For details, see the description of **type**.|
31| external_log | string[] | Path of the error log file. If the directory files exceed the threshold (for details, see **log_over_limit**), new log files may fail to be written. Therefore, delete the log files immediately after they are processed.|
32| log_over_limit | boolean | Whether the size of generated fault log files and existing log files exceeds the upper limit (5 MB). The value **true** indicates that the upper limit is exceeded and logs fail to be written. The value **false** indicates that the upper limit is not exceeded.|
33
34### type
35
36
37
38| Value| Description|
39| -------- | -------- |
40| GWP-ASAN | Error triggered by [GWP-ASan](https://developer.huawei.com/consumer/en/doc/best-practices/bpta-stability-gwpasan-detection).|
41| UBSAN | Error triggered by [UBSan](https://developer.huawei.com/consumer/en/doc/best-practices/bpta-stability-ubsan-detection).|
42| TSAN | Error triggered by [TSan](https://developer.huawei.com/consumer/en/doc/best-practices/bpta-stability-tsan-detection).|
43| stack tag-mismatch | Stack tag mismatch detected by [HWASan](https://developer.huawei.com/consumer/en/doc/best-practices/bpta-stability-hwasan-detection), possibly due to stack use-after-return, out-of-scope access, or out-of-bounds access.|
44| alloc-dealloc-mismatch | The memory allocation and release modes do not match.|
45| allocation-size-too-big | The heap memory is too large.|
46| calloc-overflow | **calloc()** fails to allocate memory.|
47| container-overflow | The container overflows.|
48| double-free | The memory is repeatedly released.|
49| dynamic-stack-buffer-overflow | The buffer access exceeds the boundary of a stack-allocated object.|
50| global-buffer-overflow | The global buffer overflows.|
51| heap-buffer-overflow | The heap buffer overflows.|
52| heap-use-after-free | The released heap memory is used.|
53| invalid-allocation-alignment | The alignment mode specified in memory allocation is invalid.|
54| memcpy-param-overlap | **memcpy()** does not support overlapping memory regions.|
55| new-delete-type-mismatch | The released memory size does not match the allocated memory size.|
56| stack-buffer-overflow | The stack buffer overflows.|
57| stack-buffer-underflow | The stack buffer underflow occurs.|
58| stack-use-after-return | The stack memory is used after the function has returned.|
59| stack-use-after-scope | The stack memory is out of range.|
60| strcat-param-overlap | The source and destination buffers used for string concatenation overlap.|
61| use-after-poison | The memory address is used after being poisoned.|
62