Open Bug 1482204 Opened 2 years ago Updated 2 years ago

elfhack breaks (overlapping segments) on a cfi vcall build with clang+lld on Linux

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: tjr, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Bug 1423822 re-enabled elfhack for LTO builds.  While working on a cfi-vcall build I hit an elfhack error.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=25867174aba289dcb96a010e44d19a2ccbb1eff3&selectedJob=193100444

> [task 2018-08-09T18:16:02.855Z] 18:16:02     INFO -  test-array.so: terminate called after throwing an instance of 'std::runtime_error'
> [task 2018-08-09T18:16:02.855Z] 18:16:02     INFO -    what():  Segments overlap

A perquisite to producing this error is the following patch, which disabled CFI for the elfhack tests:

https://hg.mozilla.org/try/rev/6c18a88dee6871ae814d4d84d998d15b1c458944


I will attach the other information in a followup comment.
Attached file test-array.so
clang version 7.0.0 (trunk) (llvm/trunk 336407)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /builds/worker/workspace/build/src/clang/bin

For some reason, when I ran this in an interactive task, it may not have produced the error.  However when I copied the commands run (below), overwriting the existing .o/.so files, and ran elfhack on it, it produced the error as before.

/builds/worker/workspace/build/src/sccache2/sccache /builds/worker/workspace/build/src/clang/bin/clang -B /builds/worker/workspace/build/src/gcc/bin -std=gnu99 -o test-array.o -c -I/builds/worker/workspace/build/src/obj-firefox/dist/system_wrappers -include /builds/worker/workspace/build/src/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -I/builds/worker/workspace/build/src/build/unix/elfhack -I/builds/worker/workspace/build/src/obj-firefox/build/unix/elfhack -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss -fPIC -include /builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -Qunused-arguments -flto=thin -fsanitize=cfi-vcall -fvisibility=hidden -fsanitize-blacklist=/builds/worker/workspace/build/src/build/sanitizers/cfi_suppressions.txt -fno-sanitize-trap=cfi -fsanitize-recover=cfi -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Qunused-arguments -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wclass-varargs -Wloop-analysis -Werror=non-literal-null-conversion -Wstring-conversion -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=return-std-move -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -flto=thin -fsanitize=cfi-vcall -fvisibility=hidden -fsanitize-blacklist=/builds/worker/workspace/build/src/build/sanitizers/cfi_suppressions.txt -fno-sanitize-trap=cfi -fsanitize-recover=cfi -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -ffunction-sections -fdata-sections -fno-math-errno -pthread -pipe -g -O2 -fno-omit-frame-pointer -Werror  -MD -MP -MF .deps/test-array.o.pp  -fno-lto -fno-sanitize=cfi /builds/worker/workspace/build/src/build/unix/elfhack/test-array.c




/builds/worker/workspace/build/src/sccache2/sccache /builds/worker/workspace/build/src/clang/bin/clang++ -B /builds/worker/workspace/build/src/gcc/bin -Qunused-arguments -flto=thin -fsanitize=cfi-vcall -fvisibility=hidden -fsanitize-blacklist=/builds/worker/workspace/build/src/build/sanitizers/cfi_suppressions.txt -fno-sanitize-trap=cfi -fsanitize-recover=cfi -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Qunused-arguments -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=return-std-move -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -flto=thin -fsanitize=cfi-vcall -fvisibility=hidden -fsanitize-blacklist=/builds/worker/workspace/build/src/build/sanitizers/cfi_suppressions.txt -fno-sanitize-trap=cfi -fsanitize-recover=cfi -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-math-errno -pthread -pipe -fexceptions -g -O2 -fno-omit-frame-pointer -Werror  -fPIC -shared -Wl,-h,test-array.so -o test-array.so -lpthread -fuse-ld=lld -flto=thin -fsanitize=cfi-vcall -fvisibility=hidden -fsanitize-blacklist=/builds/worker/workspace/build/src/build/sanitizers/cfi_suppressions.txt -fno-sanitize-trap=cfi -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id -Wl,-rpath-link,/builds/worker/workspace/build/src/obj-firefox/dist/bin -Wl,-rpath-link,/usr/local/lib   test-array.o -nostartfiles
You need to log in before you can comment on or make changes to this bug.