Closed GoogleCodeExporter closed 9 years ago
I can reproduce it.
ASAN_OPTIONS=report_globals=2 out/Release/pdfium_test a
==25590==Added Global: beg=0x7f08feeb8360 size=15/64 name=.str
module=../../third_party/libc++abi/trunk/src/exception.cpp dyn_init=0
==25590==Added Global: beg=0x7f08feeb83a0 size=19/64 name=.str1
module=../../third_party/libc++abi/trunk/src/exception.cpp dyn_init=0
==25590==Added Global: beg=0x7f08feedc100 size=40/96 name=_ZTVSt9exception
module=../../third_party/libc++abi/trunk/src/exception.cpp dyn_init=0
==25590==Added Global: beg=0x000001d03b01 size=13/64 name=_ZTSSt9exception
module=../../third_party/libc++abi/trunk/src/exception.cpp dyn_init=0
==25590==AddressSanitizer CHECK failed:
/usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/as
an/asan_globals.cc:93 "((AddrIsAlignedByGranularity(g->beg))) != (0)" (0x0, 0x0)
The address of _ZTSSt9exception is clearly wrong.
% nm out/Release/pdfium_test | grep _ZTSSt9exception
0000000001d03b01 V _ZTSSt9exception
We force alignment of instrumented variables to 8, but this one ends with ...01
bo_xu@, as a temporary workaround, please try
ASAN_OPTIONS=report_globals=0 out/Release/pdfium_test a
Original comment by konstant...@gmail.com
on 28 Jul 2014 at 7:17
Here're three modules that declare _ZTSSt9exception (aside from libc++.so in
which _ZTSSt9exception is aligned):
obj/third_party/pdfium/fpdfsdk/src/javascript/javascript.Field.o:
0000000000000000 V _ZTSSt9exception
obj/third_party/pdfium/fpdfsdk/src/javascript/javascript.PublicMethods.o:
0000000000000000 V _ZTSSt9exception
obj/third_party/pdfium/fpdfsdk/src/javascript/javascript.util.o:
0000000000000000 V _ZTSSt9exception
Original comment by ramosian.glider@gmail.com
on 28 Jul 2014 at 8:42
When I build third_party/libc++abi/trunk/src/exception.cpp without ASan,
@_ZTSSt9exception is declared as regular constant:
@_ZTSSt9exception = constant [13 x i8] c"St9exception\00"
, and is thus instrumented.
Whereas for third_party/pdfium/fpdfsdk/src/javascript/Field.cpp w/o ASan
@_ZTSSt9exception is a linkonce_odr constant:
@_ZTSSt9exception = linkonce_odr constant [13 x i8] c"St9exception\00"
There must be a mismatch between the declaration of std::exception in the
header and in exception.cpp
Original comment by ramosian.glider@gmail.com
on 28 Jul 2014 at 8:59
Any update on this one? What we can do to remedy this issue at this moment?
Thanks!
Original comment by bo...@foxitsoftware.com
on 4 Aug 2014 at 6:20
Sorry, no update yet (we've been distracted by vacations and travel).
As a workaround please use
ASAN_OPTIONS=report_globals=0 out/Release/pdfium_test a
Original comment by konstant...@gmail.com
on 4 Aug 2014 at 7:54
Reduced test case:
% cat a1.cc
struct AAA {
public:
#if DTOR
virtual ~ AAA ();
#endif
};
#if DTOR
AAA::~AAA() { }
#endif
void foo () { throw AAA (); }
% clang++ a1.cc -std=c++11 -S -o - -emit-llvm -DDTOR=0 | grep _ZTI3AAA.=
@_ZTI3AAA = linkonce_odr constant { i8*, i8* } { i8* bitcast (i8**
getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to
i8*), i8* getelementptr inbounds ([5 x i8]* @_ZTS3AAA, i32 0, i32 0) }
% clang++ a1.cc -std=c++11 -S -o - -emit-llvm -DDTOR=1 | grep _ZTI3AAA.=
@_ZTI3AAA = constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds
(i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr
inbounds ([5 x i8]* @_ZTS3AAA, i32 0, i32 0) }
%
So, depending on whether the DTOR is inlined or not, the symbol is either ODR
or nor, which makes asan behave differently.
Time to ask clang folks for help.
Original comment by konstant...@gmail.com
on 5 Aug 2014 at 8:49
bo_xu, can you still reproduce the problem with the fresh trunk?
I can't:
ASAN_OPTIONS=report_globals=2 ./out/Release/pdfium_test a 2>&1 | grep
_ZTSSt9exception
==6265==Added Global[0x7f5e8e46dba8]: beg=0x7f5e8e433bc0 size=13/64
name=_ZTSSt9exception
module=../../third_party/libc++abi/trunk/src/exception.cpp dyn_init=0
Note: 0x7f5e8e433bc0 is properly aligned.
Original comment by konstant...@gmail.com
on 15 Aug 2014 at 9:25
I cannot reproduce either. Seems this is fixed.
Original comment by bo...@foxitsoftware.com
on 16 Aug 2014 at 8:14
I am not convinced this is fixed, but since we can't repro I am closing it now.
Please reopen if you see this again.
Also, if you used the workaround to disable asan checks for globals, please
remove it.
Original comment by konstant...@gmail.com
on 21 Aug 2014 at 3:54
Thanks for the info!
Original comment by bo...@foxitsoftware.com
on 21 Aug 2014 at 4:01
Original issue reported on code.google.com by
bo...@foxitsoftware.com
on 26 Jul 2014 at 6:45