Skip to content
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 testing #2662

Closed
jb55 opened this issue May 22, 2019 · 5 comments
Closed

fuzz testing #2662

jb55 opened this issue May 22, 2019 · 5 comments

Comments

@jb55
Copy link
Collaborator

jb55 commented May 22, 2019

fuzz testing the linux kernel has cropped thousands of bugs, mostly in interfaces where you are encoding and decoding stuff. rust-lightning has been building fuzzers for lightning. It would be interesting to see how badly we can break c-lightning with these kinds of tests.

@niftynei
Copy link
Collaborator

@ZmnSCPxj
Copy link
Collaborator

What fuzz framework is easy to integrate with a networking application written in C?

@jb55
Copy link
Collaborator Author

jb55 commented Jun 13, 2019

The go-to appears to be afl (american fuzzy loop), I haven't tried it yet.

@ZmnSCPxj
Copy link
Collaborator

american fuzzy lop, not loop.
It seems, named after a dog breed, whatever a "dog" is, I am sure most humans find it delicious.

From what I understand, it requires that a program input a file.
Possibly we can compile the individual channel-level daemons with some way of forcing their inputs to arrive from a file rather than from "real" lightningd or other peers.
Though I admit I have not investigated much.

@ZmnSCPxj
Copy link
Collaborator

For the individual channel-level daemons, possibly we can add a --afl-fuzz flag that causes them to instead read messages from STDIN_FILENO and throw any output messages to /dev/null.

Possibly we can have messages from STDIN_FILENO mode to include whether the message is supposed to come from lightningd or from the network, then have an internal forwarder emulate the sockets. Not sure how to emulate forwarding of fds, maybe just close them when transferring out, and have a special code byte in STDIN_FILENO to feed a faked fd in.

onchaind is probably simplest as it only interacts with lightningd.

For the more complex daemons such as gossipd, connectd, and lightningd itself..................

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants