Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste 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. |
85a5464 to
82bed57
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
See the generated coverage report after fuzzing the IPC target for a while using the qa-assets corpus. Also included in the pr description |
82bed57 to
a37b99d
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
427daa7 to
1ea3507
Compare
| fuzzed_data_provider.ConsumeRandomLengthString(512)); | ||
| }, | ||
| [&] { | ||
| ipc.receiveTransactionPayload(ConsumeRandomLengthByteVector<uint8_t>(fuzzed_data_provider, 512)); |
There was a problem hiding this comment.
Use ConsumeTransaction in src/test/fuzz/util.cpp to create a random tx from a FuzzedDataProvider instead of using a random lenght byte vector.
There was a problem hiding this comment.
We intentionally return arbitrary transaction bytes from the raw server so the client deserialization is exercised with malformed responses.
Using ConsumeTransaction would only generate valid transactions and duplicate the existing passTransaction coverage.
I’ve added a comment clarifying the purpose of this branch.
There was a problem hiding this comment.
the chances of a randomly generated byte vector deserialising to a CTransaction are slim.
FWIW I tried to measure this and found raw bytes to reach a real tx in only under a minute, and a witness tx within a 10-minute duration of my run. I think the fuzzer does learn from coverage to build valid txs,
| ipc.receiveTransactionPayload(ConsumeRandomLengthByteVector<uint8_t>(fuzzed_data_provider, 512)); | ||
| }, | ||
| [&] { | ||
| ipc.receiveUniValuePayload(fuzzed_data_provider.ConsumeRandomLengthString(512)); |
There was a problem hiding this comment.
Most of the generated data will be invalid JSON; this means the fuzzer will hit the "invalid JSON received over IPC" error most of the time. I think it's much better to construct a valid JSON payload, the same way we construct valid TXs with ConsumeTransaction.
There was a problem hiding this comment.
Invalid json is intentional here because it tests client side rejection of malformed ipc responses.
Valid json round trips are covered separately by passUniValue, which parses arbitrary input and proceeds when it is valid.
I’ve added a comment clarifying the distinction.
| }, | ||
| [&] { | ||
| ipc.sendTransactionPayload( | ||
| ConsumeRandomLengthByteVector<uint8_t>(fuzzed_data_provider, 512)); |
There was a problem hiding this comment.
You should use ConsumeTransaction from src/test/fuzz/util.cpp. Most of the vectors produced will be invalid.
There was a problem hiding this comment.
Same rationale as #35916 (comment): this intentionally bypasses normal serialization to exercise malformed transaction payload handling.
| ConsumeRandomLengthByteVector<uint8_t>(fuzzed_data_provider, 512)); | ||
| }, | ||
| [&] { | ||
| ipc.sendUniValuePayload( |
There was a problem hiding this comment.
Same as in my previous UniValue comment.
1ea3507 to
84e54a4
Compare
84e54a4 to
20ba949
Compare
|
Thanks for the review @frankomosh. Added local deserialization checks for transaction and UniValue payloads on both the request and response sides, so the fuzz target now fails when ipc accepts malformed data or rejects locally decodable data. |
Keep a reference to the IPC fuzz implementation so fuzz inputs can be compared directly with values deserialized by the proxy server. This ensures serialization errors are detected on the client to server path instead of potentially being hidden by the return trip.
Add a callback interface to the IPC fuzz target so requests exercise communication from the server back to the client. Check the callback argument and return value on both sides.
20ba949 to
deb462d
Compare
Use the underlying capnp client to send arbitrary transaction data and JSON text to the libmultiprocess server. Accept normal transaction deserialization failures while surfacing unexpected IPC errors.
Connect a normal libmultiprocess client to a manual capnp server. Return arbitrary transaction data and json text to exercise client side deserialization.
deb462d to
966457f
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
friendly ping @marcofleon @Crypt-iQ |
|
@enochaz sorry, I can't meaningfully review. I have no idea how ipc works at all at the code level. I haven't reviewed marco's ipc-mining approach but I think we both had some moderate success in fuzzamoto by simply calling random ipc methods with random values. There's currently no merged support for IPC in fuzzamoto, though I'd be happy to review a fuzzamoto IPC PR assuming it simply did something like this (calling random methods like this is really the limit of my understanding here). |
Thanks @Crypt-iQ, no worries. This target is a bit lower level than calling random ipc methods. It runs a libmultiprocess client and server in process and sends malformed transaction and json payloads in both directions, checking that ipc accepts only what decodes locally and rejects the rest. If you have time, the accept/reject checks in |
|
Concept ACK (966457f) on focusing this on the types the Mining and Chain interfaces actually pass. The type-conversion layer is where in-process fuzz tests are most useful: several real IPC bugs were values the C++ side could never produce arriving over the wire, like a For each type the Mining and Chain interfaces pass, I think it would be good to cover:
|
|
cross-ref to #37063 |

This PR follows up on #35118 and continues the IPC fuzzing work proposed in #23015.
The initial ipc fuzz target exercised normal calls through a libmultiprocess client and server. This PR extends the target with
UniValuepayloads, which are deserialized by a normal libmultiprocess server.UniValuepayloads, which are deserialized by a normal libmultiprocess client.The raw request and response cases allow the fuzz target to exercise deserialization with data that was not first produced by libmultiprocess serialization.
The ipc setup and callback handling closely follow the existing
libmultiprocesstests, particularly their use ofEventLoop,ProxyClient,ProxyServer, two-way pipes, andinitThreadMap.The transaction and UniValue payload cases exercise the serialization hooks defined in
common-types.h.These files may provide useful background when reviewing the changes.
Generated coverage report after fuzzing the IPC target for a while using the qa-assets corpus.