Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@make.sh
CXX_FLAGS="-fsanitize=
on g++ / clang++
Includes most of https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind https://clang.llvm.org/docs/MemorySanitizer.html , such as ``` CXX_FLAGS="-fsanitize=address -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment" export ASAN_OPTIONS=abort_on_error=1:fast_unwind_on_malloc=0:detect_leaks=0 UBSAN_OPTIONS=print_stacktrace=1 CXX_FLAGS+="-fno-omit-frame-pointer" #/* from https://clang.llvm.org/docs/MemorySanitizer.html */ CXX_FLAGS+="-g" #/* gives variables+linenums to stacktraces */ ``` which produces stackktraces such as ``` ~/SubStack $ ./a.out cxx/Macros.hxx: pass cxx/VirusAnalysis.hxx: pass AddressSanitizer:DEADLYSIGNAL ================================================================= ==355==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x007958880050 bp 0x007fed4ad6f0 sp 0x007fed4acee0 T0) ==355==The signal is caused by a READ memory access. ==355==Hint: address points to the zero page. libunwind: unsupported .eh_frame_hdr version: 127 at 795cd30000 #0 0x7958880050 in __strlen_aarch64 libc_init_dynamic.cpp #1 0x795a4be864 in strlen out/lib/compiler-rt-aarch64/out/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc #2 0x59a56172b0 in std::__ndk1::__constexpr_strlen[abi:v170000](char const*) /data/data/com.termux/files/usr/include/c++/v1/cstring:114:10 #3 0x59a5617270 in std::__ndk1::char_traits<char>::length(char const*) /data/data/com.termux/files/usr/include/c++/v1/__string/char_traits.h:220:12 #4 0x59a55e0c8c in std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::basic_string[abi:v170000]<std::nullptr_t>(char const*) /data/data/com.termux/files/usr/include/c++/v1/string:882:17 #5 0x59a5639018 in Susuwu::questionsResponsesFromHosts(Susuwu::ResultList&, Susuwu::ResultList&, std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>> const&) /data/data/com.termux/files/home/SubStack/./cxx/ConversationCns.cxx:54:68 #6 0x59a5638870 in Susuwu::conversationCnsTestsThrows() /data/data/com.termux/files/home/SubStack/./cxx/ConversationCns.cxx:32:2 #7 0x59a56431bc in Susuwu::testHarnesses() /data/data/com.termux/files/home/SubStack/./cxx/main.cxx:21:5 #8 0x59a56431f8 in main /data/data/com.termux/files/home/SubStack/./cxx/main.cxx:28:9 #9 0x795887ee18 in __libc_init (/apex/com.android.runtime/lib64/bionic/libc.so+0x56e18) (BuildId: 33ad5959e2b38fc822cda3c642e16c94) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV libc_init_dynamic.cpp in __strlen_aarch64 ==355==ABORTING Aborted ~/SubStack $ ``` `GXX` -> `CXX` for compiler executable (more consistant) @posts/VirusAnalysis.md "callgraphs" -> "stacktraces". Give comparisons of `-fsanitize` vs _static analysis_
- Loading branch information