https://reviews.llvm.org/D95835 implements origin tracking for DFSan.
It reuses the chained origin depot of MSan.
This change moves the utility to sanitizer_common to share between
MSan and DFSan.
Differential D96319
[sanitizer] Move MSan's chained_origin_depot to sanitizer_common Authored by stephan.yichao.zhao on Feb 8 2021, 9:53 PM.
Details https://reviews.llvm.org/D95835 implements origin tracking for DFSan. This change moves the utility to sanitizer_common to share between
Diff Detail
Event Timeline
Comment Actions I'd rather create a ChainedOriginDepot class, turn all the global functions into methods, turn the global variable into a member and then instantiate it in dfsan and msan separately. Comment Actions changed origin chain to a class. But we still keep the wrappers in msan_chained_origin_depot.h|cpp, because sanitizer_chained_origin_depot includes sanitizer_stackdepotbase and sanitizer_stackdepotbase includes sanitizer_internal_defs. sanitizer_internal_defs has types and functions conflicting with msan_interceptors Comment Actions LGTM
Comment Actions This one breaks "check-memprof" 'RUN: at line 9'; env MEMPROF_OPTIONS=log_path=stderr /usr/local/google/home/vitalybuka/src/llvm.git/out/z/projects/compiler-rt/test/memprof/X86_64LinuxConfig/TestCases/Output/test_malloc_load_store.c.tmp 2>&1 | FileCheck /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c
--
Exit Code: 1
Command Output (stderr):
--
clang-13: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c:20:16: error: CHECK-NEXT: expected string not found in input
// CHECK-NEXT: #0 {{.*}} in malloc
^
<stdin>:37:2: note: scanning from here
#0 0x44a71d in __interceptor_malloc /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:127:3
^
<stdin>:37:20: note: possible intended match here
#0 0x44a71d in __interceptor_malloc /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:127:3
^
Input file: <stdin>
Check file: /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c
-dump-input=help explains the following input dump.
Input was:
<<<<<<
.
.
.
32: Stack for id 1090519041:
33: #0 0x44a71d in __interceptor_malloc /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:127:3
34: #1 0x7fb446b078b0 in _dl_exception_create_format elf/dl-exception.c:146:21
35:
36: Stack for id 1342177281:
37: #0 0x44a71d in __interceptor_malloc /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:127:3
next:20'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
next:20'1 ? possible intended match
38: #1 0x46a58d in main /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/test/memprof/TestCases/test_malloc_load_store.c:27:19
next:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39: #2 0x7fb4465b5d09 in __libc_start_main csu/../csu/libc-start.c:308:16
next:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40:
next:20'0 ~
41: Stack for id 1686110209:
next:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~
42: #0 0x44a71d in __interceptor_malloc /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:127:3
next:20'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
.
.
>>>>>>
--
********************
********************
Failed Tests (1):
MemProfiler-x86_64-linux :: TestCases/test_malloc_load_store.cComment Actions I cannot reproduce this error by ninja check-memprof from my sandbox. This change, although related to StackDepot, does not use the one in compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp. It creates a new instance of StackDepotBase used by only Msan. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Looks like accidental line break here.