-
Notifications
You must be signed in to change notification settings - Fork 36.6k
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
fuzz: Add fuzzing harness for TorController #19288
Conversation
a60eecc
to
1c96a84
Compare
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. |
1c96a84
to
38c5e21
Compare
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.
48 hour coverage with libfuzzer here: https://crypt-iq.github.io/torcontrol_cov/src/torcontrol.cpp.gcov.html
Currently two functions are coverage lacking from the above output:
authchallenge_cb
protocolinfo_cb
authchallenge_cb
coverage is a bit tricky to get coverage for because it has to pass the HMAC check. protocolinfo_cb
just needs better seeds and it should be able to hit every part but this one:
Lines 643 to 652 in 9d4b3d8
std::string torpassword = gArgs.GetArg("-torpassword", ""); | |
if (!torpassword.empty()) { | |
if (methods.count("HASHEDPASSWORD")) { | |
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n"); | |
boost::replace_all(torpassword, "\"", "\\\""); | |
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2)); | |
} else { | |
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n"); | |
} | |
} else if (methods.count("NULL")) { |
38c5e21
to
2c5f1b2
Compare
Concept ACK |
c9d1559
to
9b82584
Compare
Runs without complaint on Ubuntu 18: Will build on macOS and report back. |
Builds on macOS: Ran with Ubuntu 18 again:
|
ACK 9b82584 |
e4fcaae
to
3f3982c
Compare
3f3982c
to
bfdc60b
Compare
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.
haven't reviewed, but it would probably be good to use the new style here
bfdc60b
to
730e3de
Compare
Updated to use the excellent Should be ready for final review :) |
99e4f1e
to
9b984fb
Compare
Compared to other fuzzing PRs this PR is relatively cumbersome to keep up to date over time due to the code move from Current status: Concept ACK ACKs
|
The first commit which is move-only is best viewed dimmed 🦓 style:
|
This PR has one stale ACK and three Concept ACKs, and I believe all feedback has been addressed. Ready for merge after re-review? |
Sorry, forgot about this a bit. I'll have a look. Looks like this has a silent merge conflict on current master:
|
9b984fb
to
936cad9
Compare
Oh, thanks for noticing! Now addressed :) |
936cad9
to
10d4477
Compare
I want to say this one more time before merging: I dislike moving internal implementation details to the header for testing purposes. It kind of violates encapsulation and makes the headers larger and less usefully self-documenting. That said, I do not see any other solution in the immediate context here. A longer-term direction would be to have test-specific headers that expose internal functionality for unit testing[, benching, fuzzing] but are never included in production code. ACK 10d4477 |
Add fuzzing harness for
TorController
.See
doc/fuzzing.md
for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the Bitcoin Core fuzzing corpus repo.Happy fuzzing :)