-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Add -ftrapv to CFLAGS and CXXFLAGS when --enable-debug is used. Enable -ftrapv in Travis. #12686
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
Conversation
HOST=x86_64-unknown-linux-gnu
|
This is cool, concept ack. Looks like there are some problems:
GCC 4.8 also supports -fsanitize=address and -fsanitize=thread (and newer GCC versions have a whole plethora or really interesting options). What do you think about using those options in Travis as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a shell quoting issue with how travis is running this.
Here's an idea for another way to do this: eklitzke@635e378 . The idea is to add What do you think of this approach? |
BTW the right way to fix the quoting issue in Travis is to use a bash array. It looks like Travis doesn't support these properly. If you still wanted to use this approach instead of modifying configure.ac as in my example two options:
|
@eklitzke Thanks for reviewing. I've now cherry-picked your commit (which is the better solution) into this PR. Please re-review :-) |
@eklitzke Enabling |
It looks like this doesn't work for the MingW builds, I got timeouts in my travis runs that match the ones you just cherry-picked: https://travis-ci.org/eklitzke/bitcoin/builds/353587968 . Let's disable the option for those two builders. I added some -fsanitize support to the configure script in #12692, which is a good start since it will make using those flags easier (even if the code isn't currently clean under asan/tsan). |
@eklitzke To keep the changes as small as possible I've now enabled Please re-review :-) |
@practicalswift I don't think you've cherry-picked correctly, looks like you just swapped out the changes in your commit with @eklitzke's ? |
This looks right to me, utACK e23dfbb01df044e6d0dc65f6b9333e6547202fa7. |
@fanquake The cherry-pick was a previous version. e23dfbb01df044e6d0dc65f6b9333e6547202fa7 is correct. Please review :-) |
FYI this is going to conflict with #12695 . Should be an easy merge conflict though. |
@theuni Can you take a look? |
Rebased! Please re-review :-) |
3fc534a
to
bb2d161
Compare
Interesting – judging from the Travis testing it seems that the trap is trigged indicating that we have a signed overflow taking place when running the tests. Let's find out where! |
Concept ACK. Please put this on top of #13005 though, as it needs the same treatment. This needs to be checked with AX_CHECK_COMPILE_FLAG, the same way that -DDEBUG/-DDEBUG_LOCKORDER are checked there. |
.travis.yml
Outdated
@@ -30,7 +30,7 @@ env: | |||
# 32-bit + dash | |||
- HOST=i686-pc-linux-gnu PACKAGES="g++-multilib python3-zmq" DEP_OPTS="NO_QT=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash" | |||
# x86_64 Linux (uses qt5 dev package instead of depends Qt to speed up build and avoid timeout) | |||
- HOST=x86_64-unknown-linux-gnu PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing DEBUG=1
here should cause depends to no longer build as debug.
+1 on using --enable-debug, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated: Re-introduced DEBUG=1
:-)
Needs rebase |
Rebased! |
ACK 98d842c (that the rebase was done correctly, didn't look at anything else) |
utACK 98d842c |
…is used. Enable -ftrapv in Travis. 98d842c travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d1 Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389
14788fb [travis] Don't store debug info if --enable-debug is set (Chun Kuan Lee) Pull request description: After #12686 merged, ccache store huge size of .o files, simply get rid of those useless debug info. Fixes #13748 Tree-SHA512: fb404e2c7d52cd8266548433955c41683ede062f97c8fb7098a887f164bcde48b60e5e533a0a27c7e095fdd9ef88db018b8689adebb2c0e32c8957828629e346
./configure updates Includes code cherry-picked from the following upstream Bitcoin Core PRs: - bitcoin/bitcoin#6748 - bitcoin/bitcoin#12373 - bitcoin/bitcoin#12692 - bitcoin/bitcoin#12901 - bitcoin/bitcoin#13005 - bitcoin/bitcoin#13445 - bitcoin/bitcoin#12686 - bitcoin/bitcoin#16435 Part of #2074.
…se of uninitialized memory 870f0cd build: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory (practicalswift) Pull request description: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory. First UBSan, then ASan followed by TSan... and now: yes, the wait is over -- **MSan is finally here!** :) Some historical context: * 2017: Continuous compilation with Clang Thread Safety analysis enabled (#10866, #10923) * 2018: Continuous testing with trapping on signed integer overflows (`-ftrapv`) (#12686) * 2018: Continuous testing of use of locale dependent functions (#13041) * 2018: Continuous testing of format strings (#13705) * 2018: Continuous compilation with MSVC `TreatWarningAsError` (#14151) * 2018: Continuous testing under UndefinedBehaviorSanitizer – UBSan (#14252, #14673, #17006) * 2018: Continuous testing under AddressSanitizer – ASan (#14794, #17205, #17674) * 2018: Continuous testing under ThreadSanitizer – TSan (#14829) * 2019: Continuous testing in an unsigned char environment (`-funsigned-char`) (#15134) * 2019: Continuous compile-time testing of assumptions we're making (#15391) * 2019: Continuous testing of fuzz test cases under Valgrind (#17633, #18159, #18166) * 2020: Finally... MemorySanitizer – MSAN! :) What is the next step? What tools should we add to CI to keep bugs from entering `master`? :) ACKs for top commit: MarcoFalke: ACK 870f0cd Tree-SHA512: 38327c8b75679d97d469fe42e704cacd1217447a5a603701dd8a58ee50b3be2c10248f8d68a479ed081c0c4b254589d3081c9183f991640b06ef689061f75578
…-debug is used. Enable -ftrapv in Travis. 98d842c travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d1 Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389
…-debug is used. Enable -ftrapv in Travis. 98d842c travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d1 Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389
…-debug is used. Enable -ftrapv in Travis. 98d842c travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d1 Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389
…etect use of uninitialized memory 870f0cd build: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory (practicalswift) Pull request description: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory. First UBSan, then ASan followed by TSan... and now: yes, the wait is over -- **MSan is finally here!** :) Some historical context: * 2017: Continuous compilation with Clang Thread Safety analysis enabled (bitcoin#10866, bitcoin#10923) * 2018: Continuous testing with trapping on signed integer overflows (`-ftrapv`) (bitcoin#12686) * 2018: Continuous testing of use of locale dependent functions (bitcoin#13041) * 2018: Continuous testing of format strings (bitcoin#13705) * 2018: Continuous compilation with MSVC `TreatWarningAsError` (bitcoin#14151) * 2018: Continuous testing under UndefinedBehaviorSanitizer – UBSan (bitcoin#14252, bitcoin#14673, bitcoin#17006) * 2018: Continuous testing under AddressSanitizer – ASan (bitcoin#14794, bitcoin#17205, bitcoin#17674) * 2018: Continuous testing under ThreadSanitizer – TSan (bitcoin#14829) * 2019: Continuous testing in an unsigned char environment (`-funsigned-char`) (bitcoin#15134) * 2019: Continuous compile-time testing of assumptions we're making (bitcoin#15391) * 2019: Continuous testing of fuzz test cases under Valgrind (bitcoin#17633, bitcoin#18159, bitcoin#18166) * 2020: Finally... MemorySanitizer – MSAN! :) What is the next step? What tools should we add to CI to keep bugs from entering `master`? :) ACKs for top commit: MarcoFalke: ACK 870f0cd Tree-SHA512: 38327c8b75679d97d469fe42e704cacd1217447a5a603701dd8a58ee50b3be2c10248f8d68a479ed081c0c4b254589d3081c9183f991640b06ef689061f75578
…-debug is used. Enable -ftrapv in Travis. 98d842c travis: Build with --enable-debug (x86_64-unknown-linux-gnu) (practicalswift) 94e52d1 Add -ftrapv to DEBUG_CXXFLAGS when --enable-debug is used (practicalswift) Pull request description: By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it. Tree-SHA512: 47712da53b4ff451b8f22f16ddc3b53100a09060a3b04cda4b8fbbb74e6f666fc07a9cc7abc64cacb87a0aa3f62dc8e3c91a1a0ed12bf82bb2a5624a5d104389
By generating a trap for signed overflow on addition, subtraction, multiplication operations in the Travis testing we are more likely to identify problematic code prior to merging it.