-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASAN build is broken in 1.5.0-DEV #35338
Comments
Seels like they renamed it to |
I've tried cd usr/tools
ln -s clang clang++
cd -
make clean
make CC=$PWD/usr/tools/clang CXX=$PWD/usr/tools/clang++ \
LLVM_CONFIG=$PWD/usr/tools/llvm-config USECLANG=1 SANITIZE=1 but I get
Or am I doing something wrong? |
No that should work, but ASAN is not a tested configuration so you are likely running into the fact that the declaration moved from |
Thanks! So I just added one more include diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
index 15623efe5a..c33010ccb0 100644
--- a/src/aotcompile.cpp
+++ b/src/aotcompile.cpp
@@ -23,6 +23,7 @@
#include <llvm/Transforms/Vectorize.h>
#if defined(JL_ASAN_ENABLED)
#include <llvm/Transforms/Instrumentation.h>
+#include <llvm/Transforms/Instrumentation/AddressSanitizer.h>
#endif
#include <llvm/Transforms/Scalar/GVN.h>
#include <llvm/Transforms/IPO/AlwaysInliner.h> then now root@459e9488a96a:/julia# make CC=$PWD/usr/tools/clang CXX=$PWD/usr/tools/clang++ LLVM_CONFIG=$PWD/usr/tools/llvm-config USE
CLANG=1 SANITIZE=1
CC src/aotcompile.o
CC src/debuginfo.o
CC src/disasm.o
CC src/llvm-simdloop.o
CC src/llvm-muladd.o
CC src/llvm-final-gc-lowering.o
CC src/llvm-pass-helpers.o
CC src/llvm-late-gc-lowering.o
CC src/llvm-lower-handlers.o
CC src/llvm-gc-invariant-verifier.o
CC src/llvm-propagate-addrspaces.o
CC src/llvm-multiversioning.o
CC src/llvm-alloc-opt.o
CC src/cgmemmgr.o
CC src/llvm-api.o
LINK usr/lib/libjulia.so.1.5
clang-9: warning: argument unused during compilation: '-mllvm -asan-stack=0' [-Wunused-command-line-argument]
CC ui/repl.o
LINK usr/bin/julia
clang-9: warning: argument unused during compilation: '-mllvm -asan-stack=0' [-Wunused-command-line-argument]
/julia/usr/lib/libjulia.so: undefined reference to `llvm::cfg::Update<llvm::BasicBlock*>::dump() const'
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:86: recipe for target '/julia/usr/bin/julia' failed
make[1]: *** [/julia/usr/bin/julia] Error 1
Makefile:78: recipe for target 'julia-ui-release' failed
make: *** [julia-ui-release] Error 2 ...but it stops with a different error. |
I added root@459e9488a96a:/julia# make clean
...
root@459e9488a96a:/julia# cat Make.user
CXXFLAGS += -DNDEBUG
root@459e9488a96a:/julia# make CC=$PWD/usr/tools/clang CXX=$PWD/usr/tools/clang++ LLVM_CONFIG=$PWD/usr/tools/llvm-config USECLANG=1 SANITIZE=1
PERL base/pcre_h.jl
PERL base/errno_h.jl
...
JULIA usr/libcorecompiler.ji
==18597==LeakSanitizer has encountered a fatal error.
==18597==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==18597==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
sysimage.mk:61: recipe for target '/julia/usr/lib/julia/corecompiler.ji' failed
make[1]: *** [/julia/usr/lib/julia/corecompiler.ji] Error 1
Makefile:81: recipe for target 'julia-sysimg-ji' failed
make: *** [julia-sysimg-ji] Error 2 |
This was because I was using docker (#35341 (comment)). Now I get:
Does it mean |
1 similar comment
This was because I was using docker (#35341 (comment)). Now I get:
Does it mean |
https://docs.julialang.org/en/latest/devdocs/sanitizers/#Address-Sanitizer-(ASAN)-1 says
So I guess that's actually expected? Maybe it was removed by accident or something? With
It' not the failure mode I expect from ASAN-enabled |
I ran the same command again and then somehow now it works: root@919704e44cd5:/julia# ASAN_OPTIONS=detect_leaks=0:allow_user_segv_handler=1 make CC=$PWD/usr/tools/clang CXX=$PWD/usr/tools/clang++ LLVM_CONFIG=$PWD/usr/tools/llvm-config USECLANG=1 SANITIZE=1
JULIA usr/libsys-o.a
Generating precompile statements... 1718 generated in 481.379059 seconds (overhead 297.103823 seconds)
LINK usr/libsys.so
CC usr/lib/libccalltest.so
CC usr/lib/libllvmcalltest.so I re-built it after |
Yeah, most the leaks are expected (when I last looked at them), I don't know why the default ASAN options aren't picked up anymore. You should put them there manually, as you did. |
This is 0xbb repeated, which is what the GC fills memory it frees with in MEMDEBUG mode. Looks like this found an actual bug. |
That said, I don't really see show this can happen. That variable should never be a boxed GC value. If you can reproduce it again, I'll take an rr trace ;). |
Re Lines 53 to 60 in c973ad8
but
I guess this is supposed to return |
Yes, that looks wrong... |
I think the issue may be that that function moved from from the executable to the library. Perhaps we need to move it back into the executable. |
Also, we should annotate |
Initial title: BUILD_LLVM_CLANG=1 does not work with LLVM 9
I'm trying to build Julia with ASAN as described in https://docs.julialang.org/en/latest/devdocs/sanitizers/ (Context: I'm trying to debug a deadlock problem with my parallel quicksort which may be related to a very rare segfault.)
But it seems
BUILD_LLVM_CLANG=1
does not work:Looking at LLVM 9.0.1 release it looks like there is no file named
cfe-9.0.1.src.tar.xz
. LLVM 8.0.1 release does containcfe-8.0.1.src.tar.xz
, though.The text was updated successfully, but these errors were encountered: