Open
Bug 1343180
Opened 8 years ago
Updated 2 years ago
ASan build fails with libc jemalloc: memory/build/mozmemory_wrap.o: multiple definition of 'strdup'
Categories
(Core :: Memory Allocator, defect)
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox54 | --- | affected |
People
(Reporter: jbeich, Unassigned)
Details
Attachments
(2 files)
$ /usr/bin/clang++ -v
FreeBSD clang version 4.0.0 (branches/release_40 296202) (based on LLVM 4.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
Found CUDA installation: /usr/local/cuda, version 7.5
$ echo "ac_add_options --enable-address-sanitizer" >>.mozconfig
$ echo "ac_add_options --disable-replace-malloc" >>.mozconfig
$ echo "export MOZ_JEMALLOC4=1" >>.mozconfig
$ ./mach bootstrap
$ ./mach build
[...]
objdir/_virtualenv/bin/python config/expandlibs_exec.py --uselist -- /usr/bin/clang++ -std=gnu++11 -o jsapi-tests -Qunused-arguments -I/usr/local/include -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wno-unknown-warning-option -Wno-return-type-c-linkage -fsanitize=address -fno-rtti -fno-exceptions -fno-math-errno -pipe -g -O -fno-omit-frame-pointer testAssemblerBuffer.o Unified_cpp_js_src_jsapi-tests0.o Unified_cpp_js_src_jsapi-tests1.o Unified_cpp_js_src_jsapi-tests2.o Unified_cpp_js_src_jsapi-tests3.o Unified_cpp_js_src_jsapi-tests4.o Unified_cpp_js_src_jsapi-tests5.o Unified_cpp_js_src_jsapi-tests6.o -pthread -fsanitize=address -Wl,-z,noexecstack -Wl,-z,text -B objdir/js/src/build/unix/gold -Wl,-Bsymbolic -rdynamic -Wl,-rpath-link,objdir/dist/bin -Wl,-rpath-link,objdir/dist/lib -fcolor-diagnostics ../../../mozglue/build/libmozglue.a ../../../memory/build/libmemory.a ../../../memory/fallible/libfallible.a ../../../config/external/icu/data/libicudata.a ../../../js/src/libjs_static.a ../../../config/external/nspr/pr/libnspr4.so ../../../config/external/nspr/libc/libplc4.so ../../../config/external/nspr/ds/libplds4.so -lm -lm -pthread
[...]
../build/unix/gold/ld: error: objdir/js/src/jsapi-tests/../../../memory/build/mozmemory_wrap.o: multiple definition of 'strdup'
../build/unix/gold/ld: /usr/bin/../lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-x86_64.a(asan_interceptors.o): previous definition here
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Summary: AddressSanitizer fails to build with libc jemalloc: memory/build/mozmemory_wrap.o: multiple definition of 'strdup' → ASan build fails with libc jemalloc: memory/build/mozmemory_wrap.o: multiple definition of 'strdup'
$ nm objdir/js/src/jsapi-tests/../../../memory/build/mozmemory_wrap.o
U __asan_init
U __asan_report_store1
U __asan_version_mismatch_check_v8
00000000000000f0 t asan.module_ctor
U malloc
0000000000000070 T strdup
U strlen
U strncpy
0000000000000000 T strndup
$ nm --demangle /usr/bin/../lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-x86_64.a | egrep 'str.?dup'
nm: sanitizer_linux_x86_64.o: no symbols
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
0000000000000c10 T __sanitizer::internal_strdup(char const*)
0000000000000f00 T __sanitizer::internal_strndup(char const*, unsigned long)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
0000000000000080 T __sanitizer::FlagParser::ll_strndup(char const*, unsigned long)
U __sanitizer::internal_strdup(char const*)
0000000000000728 B __interception::real_strdup
0000000000047f60 T __interceptor_strdup
0000000000047f60 T strdup
U __sanitizer::internal_strdup(char const*)
U __sanitizer::internal_strdup(char const*)
Comment hidden (mozreview-request) |
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8841927 [details]
Bug 1343180 - Allow ASan to override strdup() wrapper on FreeBSD.
https://reviewboard.mozilla.org/r/115982/#review118036
It seems what you want is to change mozmemory_wrap.c, not mozmemory_wrap.h.
Attachment #8841927 -
Flags: review?(mh+mozilla) → review-
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Dimitry, why ASan interceptors are impossible to override on FreeBSD? The attached file builds fine on Linux.
$ clang test.c -fsanitize=address
/tmp/test-ddef01.o: In function `strdup':
test.c:(.text+0xb0): multiple definition of `strdup'
/usr/bin/../lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-x86_64.a(asan_interceptors.o):/usr/src/contrib/compiler-rt/lib/asan/asan_interceptors.cc:(.text+0x47f60): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Flags: needinfo?(dimitry)
Comment hidden (mozreview-request) |
Given https://svnweb.freebsd.org/changeset/base/250991 having non-weak intrcepters seems bizarre.
Comment 9•8 years ago
|
||
mozreview-review |
Comment on attachment 8841927 [details]
Bug 1343180 - Allow ASan to override strdup() wrapper on FreeBSD.
https://reviewboard.mozilla.org/r/115982/#review119506
Please add an inline comment as to why it's there. It's better if one doesn't have to look at the blame/annotate output.
Attachment #8841927 -
Flags: review?(mh+mozilla) → review+
Comment 10•2 years ago
|
||
Clear a needinfo that is pending on an inactive user.
Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE
.
For more information, please visit auto_nag documentation.
Flags: needinfo?(dimitry)
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•