-
Notifications
You must be signed in to change notification settings - Fork 38.6k
log: Fix UB with bench on genesis block #15283
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
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.
| return error("%s: ConnectBlock %s failed, %s", __func__, pindexNew->GetBlockHash().ToString(), FormatStateMessage(state)); | ||
| } | ||
| nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2; | ||
| assert(nBlocksTotal > 0); |
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.
I'd avoid this, I think it is noise as there is already a "divide by nBlocksTotal" which implies this assertion.
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.
Not a fan of silently committing UB.
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 are 11 occurrences of / nBlocksTotal.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
ACK |
|
This is already fixed in #14239 which was submitted back in September and is scheduled for 0.18.0 :-) @promag @MarcoFalke @instagibbs Would you mind reviewing #14239? |
|
@practicalswift sure |
|
Close in favour of #14239? |
|
Yes this exact change is included in #14239. |
|
SGTM. Closing. |
|
@practicalswift you ended up closing that PR ;P d'oh |
|
@instagibbs Please re-open this PR :) |
|
ACK ec30a79 |
|
Concept ACK |
|
Ok, this PR doesn't resolve all the UBSan issues that #17208 does, only the one involving As has been noted several times previously, |
|
@jonatack Feel free to attack the remaining ones -- I'd be glad to review :) |
|
utACK ec30a79 |
ec30a79 Fix UB with bench on genesis block (Gregory Sanders) Pull request description: During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock. ACKs for top commit: practicalswift: ACK ec30a79 sipa: utACK ec30a79 promag: ACK ec30a79, `nBlocksTotal` is only used in logging. Tree-SHA512: b3bdbb58d10d002a2293d7f99196b227ed9f4ca8c6cd08981e95cc964be47efed98b91fad276ee6da5cf7e6684610998ace7ce9bace172dd6c51c386d985b83c
- doc: fix git add argument bitcoin#18513 - build: Fix libevent linking for bench_bitcoin binary bitcoin#18397 - script: fix SCRIPT_ERR_SIG_PUSHONLY error string bitcoin#18412 - doc: Comment fix merkle.cpp bitcoin#18379 - log: Fix UB with bench on genesis block bitcoin#15283 - test: Fix mining to an invalid target + ensure that a new block has the correct hash internally bitcoin#18350 - Fix missing header in sync.h bitcoin#18357 - refactor: Fix implicit value conversion in formatPingTime bitcoin#18260 - Fix .gitignore policy in build_msvc directory bitcoin#18108 - build: Fix behavior when ALLOW_HOST_PACKAGES unset bitcoin#18051 - test: Fix p2p_invalid_messages failing in Python 3.8 because of warning bitcoin#17931 - qa: Fix double-negative arg test bitcoin#17893 - build: Fix configure report about qr bitcoin#17547 - log: Fix log message for -par=1 bitcoin#17325 - bench: Fix negative values and zero for -evals flag bitcoin#17267 - depends: fix boost mac cross build with clang 9+ bitcoin#17231 - doc: Fix broken bitcoin-cli examples bitcoin#17119 - doc: fix Makefile target in benchmarking.md bitcoin#17081 - contrib: fix minor typos in makeseeds.py bitcoin#17042 - test: Fix Python Docstring to include all Args. bitcoin#17030 - doc: Fix some misspellings bitcoin#17351 - doc: Doxygen-friendly script/descriptor.h comments bitcoin#16947 - doc: Fix doxygen errors bitcoin#17945 - doc: Doxygen-friendly CuckooCache comments bitcoin#16986 - doc: Add to Doxygen documentation guidelines bitcoin#17873 - depends: Consistent use of package variable bitcoin#17928 - init: Replace URL_WEBSITE with PACKAGE_URL bitcoin#18503 - doc: Add missed copyright headers bitcoin#17691
ec30a79 Fix UB with bench on genesis block (Gregory Sanders) Pull request description: During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock. ACKs for top commit: practicalswift: ACK ec30a79 sipa: utACK ec30a79 promag: ACK ec30a79, `nBlocksTotal` is only used in logging. Tree-SHA512: b3bdbb58d10d002a2293d7f99196b227ed9f4ca8c6cd08981e95cc964be47efed98b91fad276ee6da5cf7e6684610998ace7ce9bace172dd6c51c386d985b83c
… divide-by-zero in validation.cpp) 0ccb3ad tests: Remove no longer needed UBSan suppression (float-divide-by-zero in validation.cpp) (practicalswift) Pull request description: Remove no longer needed UBSan suppression. The float divide-by-zero in `validation.cpp` was fixed by instagibbs in ec30a79 (#15283). ACKs for top commit: MarcoFalke: ACK 0ccb3ad Tree-SHA512: 89a4f4b7371fa5725d9f801cee7ebbd17523f66017c9acfa813657dcb8d837f42209eff44ce9e5d48296a630bab9599d75f10024a0c7da7defb228f4eae3392a
… (float divide-by-zero in validation.cpp) 0ccb3ad tests: Remove no longer needed UBSan suppression (float-divide-by-zero in validation.cpp) (practicalswift) Pull request description: Remove no longer needed UBSan suppression. The float divide-by-zero in `validation.cpp` was fixed by instagibbs in ec30a79 (bitcoin#15283). ACKs for top commit: MarcoFalke: ACK 0ccb3ad Tree-SHA512: 89a4f4b7371fa5725d9f801cee7ebbd17523f66017c9acfa813657dcb8d837f42209eff44ce9e5d48296a630bab9599d75f10024a0c7da7defb228f4eae3392a
Summary: > During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock. Increment `nBlocksTotal` before returning in ConnectBlock This is a backport of Core [[bitcoin/bitcoin#15283 | PR15283]] Test Plan: `ninja && ./src/bitcoind -debug=bench | grep "Connect total:"` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8857
Summary: > During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock. Increment `nBlocksTotal` before returning in ConnectBlock This is a backport of Core [[bitcoin/bitcoin#15283 | PR15283]] Test Plan: `ninja && ./src/bitcoind -debug=bench | grep "Connect total:"` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8857
During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock.