-
Notifications
You must be signed in to change notification settings - Fork 37.7k
build: use BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
when debugging
#24395
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
Concept ACK |
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.
Tested ACK fe565fb
FWIW, executing the unit tests for debug builds doesn't take significantly longer with this patch on my machine:
--with-debug build on master branch:
$ time ./src/test/test_bitcoin
15m05.76s real 12m11.82s user 6m03.60s system
--with-debug build on PR branch:
$ time ./src/test/test_bitcoin
15m11.04s real 12m05.47s user 6m43.91s system
(I didn't execute more than once each, i.e. the results have to be taken with a grain of salt)
is there a failing example test case that we can run to verify it is enabled in debug mode? Or should these invariants be unreachable for extenral users? |
Partial Tested ACK fe565fb (can't say anything about the configure.ac flag details, which I don't know anything about )
I tried to dereference an iterator to an entry of an empty mempool:
This fails for me on this branch with
and passes on master. Triggering other codes from
The benchmark ComplexMemPool is slower by a factor of roughly 3 compared to a
Master:
|
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.
Would it make sense to enable this also for fuzzing, or do the existing sanitizers already cover these error conditions anyway?
@MarcoFalke any thoughts? |
I think google oss-fuzz has |
you should turn it on for fuzzing, i can think of some implementations that might not be caught in existing sanitizers (e.g., imagine as an optimization deleting a key puts the cleared object in a valid but not initialized 'orphanage' for a future allocation to use -- the iter might be invalid but not a memory fault to access afterwards). i dont think the code actually does this, but the internal safe mode would catch these things. |
Oh, I was wrong. OSS-Fuzz does not run with It only runs with I am running Though that also fails currently due to a boost bug (:smiling_face_with_tear: ): https://cirrus-ci.com/task/6626378031300608?logs=fuzz_run#L947 If you enable it for fuzzing in this repo, the mempool test might take three times as long. (https://cirrus-ci.com/task/4976712239808512?logs=ci#L4448) From 30 minutes to 90 minutes. Not sure if this will push us over the 120 minute timeout. |
fe565fb
to
821e5b0
Compare
Rebased this given #24558 has been merged. |
821e5b0
to
d581ee0
Compare
Rebased and simplified. |
Use of this macro enables precondition checks for iterators and functions of the library. It's use is recommended in debug builds. See: https://www.boost.org/doc/libs/1_78_0/libs/multi_index/doc/tutorial/debug.html.
d581ee0
to
06e18e0
Compare
Looks like this doesn't affect the fuzz runtime too much, so should be fine. |
Concept and code review ACK 06e18e0 |
…when debugging 06e18e0 build: use BOOST_MULTI_INDEX_ENABLE_SAFE_MODE when debugging (fanquake) Pull request description: Use of this macro enables precondition checks for iterators and functions of the library. It's use is recommended in debug builds. See https://www.boost.org/doc/libs/1_78_0/libs/multi_index/doc/tutorial/debug.html for more info. There is also a `BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING` macro: > When this mode is in effect, all public functions of Boost.MultiIndex will perform post-execution tests aimed at ensuring that the basic internal invariants of the data structures managed are preserved. ACKs for top commit: laanwj: Concept and code review ACK 06e18e0 Tree-SHA512: 7ee489eccda81c7dbca9210af6d3007d5b2c704b645139d2714c077af157789dd9478c29d0d212e210e96686ea83713aaf3d458e879122b3cde64f3e3e3789d2
Use of this macro enables precondition checks for iterators and functions of the library. It's use is recommended in debug builds. See https://www.boost.org/doc/libs/1_78_0/libs/multi_index/doc/tutorial/debug.html for more info.
There is also a
BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
macro: