[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 ```
Loading
Please sign in to comment