[all-commits] [llvm/llvm-project] ee7d41: [asan] Report executable/DSO name for report_globa...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Nov 10 13:12:41 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ee7d41d179a974dcf49d3bc08d850268e9b06f20
https://github.com/llvm/llvm-project/commit/ee7d41d179a974dcf49d3bc08d850268e9b06f20
Author: Fangrui Song <i at maskray.me>
Date: 2023-11-10 (Fri, 10 Nov 2023)
Changed paths:
M compiler-rt/lib/asan/asan_descriptions.cpp
M compiler-rt/lib/asan/asan_errors.cpp
M compiler-rt/lib/asan/asan_globals.cpp
M compiler-rt/lib/asan/asan_report.h
M compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp
M compiler-rt/test/asan/TestCases/Linux/odr_indicators.cpp
Log Message:
-----------
[asan] Report executable/DSO name for report_globals=2 and odr-violation checking (#71879)
For an odr-violation error due to a source file linked into two DSOs, or
one DSO and the main executable, it can be difficult to identify the DSO
name. Let's print the module name in the error report.
```
echo 'extern long var; int main() { return var; }' > a.cc
echo 'long var;' > b.cc
clang++ -fpic -fsanitize=address -shared b.cc -o b.so
clang++ -fsanitize=address a.cc b.cc ./b.so -o a
```
w/o this patch:
```
==1375386==ERROR: AddressSanitizer: odr-violation (0x56067cb06240):
[1] size=8 'var' b.cc
[2] size=8 'var' b.cc
...
```
w/ this patch:
```
==1375386==ERROR: AddressSanitizer: odr-violation (0x56067cb06240):
[1] size=8 'var' b.cc in /tmp/c/a
[2] size=8 'var' b.cc in ./b.so
```
In addition, update the `report_globals=2` message to include the module
name
```
==1451005==Added Global[0x7fcfe59ae040]: beg=0x7fcfe59ae140 size=8/32 name=var source=b.cc module=./b.so dyn_init=0 odr_indicator=0x55754f939260
```
More information about the All-commits
mailing list