Uninitialization Check
Uninitialization check is an important memory security protection mechanism designed to identify and prevent memory exceptions caused by uninitialized variables.
Supported Uninitialization Exception Types
Exception |
Description |
Location |
Address Space |
|---|---|---|---|
After memory allocation, the memory is in the uninitialized state. The memory is not written and the uninitialized value is directly read. |
kernel, host |
GM, UB, L1, L0{ABC}, stack space |
Enable Uninitialization Check
mssanitizer --tool=initcheck application // application indicates the user program.
- After the tool is started, the tool run log file mssanitizer_{TIMESTAMP}_{PID}.log is automatically generated in the current directory.
- After the user program is complete, an exception report is displayed on the GUI. For details about the exceptions, see Parsing of Uninitialization Exception Reports.
Parsing of Uninitialization Exception Reports
The uninitialization check exception report contains multiple types of exception information. The following provides some examples about simple exception information to help you understand the information in the exception report.
Abnormal scenarios where initialization is not performed are as follows: The operator reads the allocated but uninitialized memory in the GM, UB, L1, L0{ABC}, and stack space.
1 2 3 4 5 6 7 8 | ====== ERROR: uninitialized read of size 224 // Basic error information, including the number of uninitialized bytes that are read. ====== at 0x12c0c0015000 on GM // Memory location where the exception occurs, including the address space and memory address. The memory address refers to the start address in a memory access. ====== in block aiv(0) // Block index of the vector core corresponding to the exception code. ====== code in pc current 0x77c (serialNo:10) // PC pointer where the exception occurs and sequence number of the API call behavior. ====== #0 ${ASCEND_HOME_PATH}/compiler/tikcpp/tikcfw/impl/dav_c220/kernel_operator_data_copy_impl.h:58:9 // The following is the code call stack where the exception occurs, including the file name, line number, and column number. ====== #1 ${ASCEND_HOME_PATH}/compiler/tikcpp/tikcfw/inner_interface/inner_kernel_operator_data_copy_intf.cppm:58:9 ====== #2 ${ASCEND_HOME_PATH}/compiler/tikcpp/tikcfw/inner_interface/inner_kernel_operator_data_copy_intf.cppm:443:5 ====== #3 uninitialized_read/add_custom.cpp:18:5 |