This patch enabled lsan for loongarch64 with 47-bit VMA layout.
Depends on D139619
Differential D139686
[lsan] Add lsan support for loongarch64 tangyouling on Dec 8 2022, 6:08 PM. Authored by
Details
This patch enabled lsan for loongarch64 with 47-bit VMA layout. Depends on D139619
Diff Detail
Event TimelineComment Actions $ cat memory-leak.c #include <stdlib.h> void *p; int main() { p = malloc(7); p = 0; // The memory is leaked here. return 0; } $ ./build/bin/clang -fsanitize=address -g memory-leak.c ; ASAN_OPTIONS=detect_leaks=1 ./a.out ================================================================= ==636379==ERROR: LeakSanitizer: detected memory leaks Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x555557bac158 in __interceptor_malloc /home/loongson/llvm-work/llvm-project-test3/llvm-project1/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3 #1 0x555557beb03c in main /home/loongson/llvm-work/llvm-project-test3/llvm-project1/memory-leak.c:4:7 #2 0x7ffff23b1678 (/usr/lib64/libc.so.6+0x25678) SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). $ ./build/bin/clang -fsanitize=leak -g memory-leak.c && ./a.out ================================================================= ==636372==ERROR: LeakSanitizer: detected memory leaks Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x555556a5a94c in __interceptor_malloc /home/loongson/llvm-work/llvm-project-test3/llvm-project1/compiler-rt/lib/lsan/lsan_interceptors.cpp:75:3 #1 0x555556a5db0c in main /home/loongson/llvm-work/llvm-project-test3/llvm-project1/memory-leak.c:4:7 #2 0x7ffff11c5678 (/usr/lib64/libc.so.6+0x25678) SUMMARY: LeakSanitizer: 7 byte(s) leaked in 1 allocation(s). $ make check-lsan Testing Time: 38.19s Unsupported : 13 Passed : 93 Expectedly Failed: 2 4 warning(s) in tests Built target check-lsan
|
Since our VM layout is actually flexible, would it be better to document this, like "Support only the most common VM layout on LoongArch that allows 47 bits of user-space VMA"? Exact wording could be optimized, I'm only describing the gist here.