Repository navigation
fuzz: Stop nodes in process_message* fuzzers - #18875
Merged
Merged
Conversation
maflcko
force-pushed
the
2005-fuzzStopNodes
branch
from
May 10, 2020 11:44
fa987e3 to
fa55e9b
Compare
Member
Author
|
Rebased. This can be tested with the following diff (observing a failure on master and a pass with this pull applied): diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index a4d4953281..d68df49d34 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -804,6 +804,7 @@ void PeerLogicValidation::InitializeNode(CNode *pnode) {
NodeId nodeid = pnode->GetId();
{
LOCK(cs_main);
+ assert(mapNodeState.find(nodeid) == mapNodeState.end());
mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(addr, std::move(addrName), pnode->fInbound, pnode->m_manual_connection));
}
if(!pnode->fInbound) |
Contributor
|
Thanks for addressing this! With this make-it-easy-to-reproduce patch applied … diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index a4d495328..afa60d2e0 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -397,7 +397,7 @@ struct CNodeState {
m_is_manual_connection (is_manual)
{
fCurrentlyConnected = false;
- nMisbehavior = 0;
+ nMisbehavior = std::numeric_limits<int>::max() - 1000;
fShouldBan = false;
pindexBestKnownBlock = nullptr;
hashLastUnknownBlock.SetNull();… I'm still getting … … even with the suggested fix applied. What am I doing wrong? :) |
maflcko
force-pushed
the
2005-fuzzStopNodes
branch
from
May 11, 2020 18:38
fa16353 to
fa17e3e
Compare
Member
Author
|
@practicalswift That is a separate issue in |
maflcko
force-pushed
the
2005-fuzzStopNodes
branch
from
May 12, 2020 11:28
fa17e3e to
fab860a
Compare
Member
Author
|
@practicalswift Any chance you could test this again? 🙏 |
Contributor
|
Sure! Confirming that I'm no longer able to reproduce the issue. ACK fab860a Thanks for fixing this issue! |
deadalnix
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Dec 21, 2020
Summary: ``` Background is that I saw an integer overflow in net_processing #30629113 REDUCE cov: 25793 ft: 142917 corp: 3421/2417Kb lim: 4096exec/s: 89 rss: 614Mb L: 1719/4096 MS: 1 EraseBytes... net_processing.cpp:977:25: runtime error: signed integer overflow: 2147483624 + 100 cannot be represented in type 'int' UndefinedBehaviorSanitizer: undefined-behavior net_processing.cpp:977:25 in net_processing.cpp:985:9: runtime error: signed integer overflow: -2147483572 - 100 cannot be represented in type 'int' SUMMMARY: UndefinedBehaviorSanitizer: undefined-behavior net_processing.cpp:985:9 in ``` Telling from the line numbers, it looks like nMisbehavior wrapped around. Fix that by calling StopNodes after each exec, which should clear the node state and thus nMisbehavior. Backport of core [[bitcoin/bitcoin#18875 | PR18875]] Test Plan: ninja bitcoin-fuzzers ./test/fuzz/test_runner.py <path_to_corpus> Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8710
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background is that I saw an integer overflow in net_processing
Telling from the line numbers, it looks like
nMisbehaviorwrapped around.Fix that by calling
StopNodesafter each exec, which should clear the node state and thusnMisbehavior.