Skip to content
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

"scons --sanitize=address clang" fails #1668

Closed
MarkusTeufelberger opened this issue Apr 27, 2016 · 5 comments
Closed

"scons --sanitize=address clang" fails #1668

MarkusTeufelberger opened this issue Apr 27, 2016 · 5 comments

Comments

@MarkusTeufelberger
Copy link
Collaborator

/usr/bin/clang -o build/clang.debug/src/ripple/unity/ed25519.o -c -Wall -fsanitize=address -fno-omit-frame-pointer -pthread -Wno-sign-compare -Wno-char-subscripts -Wno-format -g -Wno-redeclared-class-member -DOPENSSL_NO_SSL2 -DDEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER -DHAVE_USLEEP=1 -DSOCI_CXX_C11=1 -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -DBOOST_NO_AUTO_PTR -DDEBUG -D_DEBUG -DSANITIZER=ASAN -DBOOST_ASIO_HAS_STD_ARRAY -D_FILE_OFFSET_BITS=64 -Isrc/ed25519-donna -Isrc -Isrc/beast -Isrc/beast/include -Ibuild/proto -Isrc/soci/src -Isrc/soci/include src/ripple/unity/ed25519.c
In file included from src/ripple/unity/ed25519.c:24:
In file included from src/ed25519-donna/ed25519.c:17:
In file included from src/ed25519-donna/ed25519-donna.h:101:
src/ed25519-donna/ed25519-donna-64bit-x86.h:14:3: error: inline assembly
      requires more registers than available
                "movq %0, %%rax                  ;\n"
                ^
1 error generated.
scons: *** [build/clang.debug/src/ripple/unity/ed25519.o] Error 1
scons: building terminated because of errors.

A workaround is to manually exclude this function via a blacklist from being instrumented (see for example https://gitweb.torproject.org/tor.git/plain/contrib/clang/sanitize_blacklist.txt) e.g. by adding "fun:ge25519_scalarmult_base_choose_niels" to a blacklist file. Alternatively you can add this as a hint in the code too, but this might interfere with further pulls from upstream.

@MarkusTeufelberger
Copy link
Collaborator Author

[foo@bar rippled]$ cat Builds/sanitize_blacklist.txt 
fun:ge25519_scalarmult_base_choose_niels
[foo@bar rippled]$ CLANG_CC="clang -fsanitize-blacklist=Builds/sanitize_blacklist.txt" CLANG_CXX="clang++ -fsanitize-blacklist=Builds/sanitize_blacklist.txt" CLANG_LINK="clang++" scons --sanitize=address clang

Works until the linker step, then there's another error:
/usr/bin/ld: cannot find -lasan

This is normal, since clang does NOT need to be told to link libasan, it just needs the -fsanitize=address switch. Also SConstruct tries to link this library statically(!?).

MarkusTeufelberger added a commit to MarkusTeufelberger/rippled that referenced this issue Dec 10, 2016
ge25519_scalarmult_base_choose_niels leads to errors (XRPLF#1668) when compiled with address sanitizer.
@vinniefalco
Copy link
Contributor

Is this still a problem?

@seelabs
Copy link
Collaborator

seelabs commented Feb 3, 2017

This is no longer an issue.

@seelabs seelabs closed this as completed Feb 3, 2017
@MarkusTeufelberger
Copy link
Collaborator Author

I'll verify with the build-all script, but I hope that it works now. The "-lasan" part is still an issue probably, I'll report back.

@MarkusTeufelberger
Copy link
Collaborator Author

Found a few breaking builds, mostly centered around google/sanitizers#189 and boost 1.58 being available in most current distros. Should fix itself once boost or ASAN get updated downstream.

Other issues were ninja builds not generating protobuf headers (I submitted a pull request for that), fedora rawhide seems to have already OpenSSL 1.1 in their repo which apparently breaks their 1.60 boost build currently and they still have to update to a more recent boost version.

I can commit my test setup (pull base images of various distros from dockerhub, install rippled build dependencies from upstream and run build_all.sh) if you are interested in this, however I'm not even sure which platforms are currently officially supported (even your RPM gets built using packages from various fedora releases...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants