-
Notifications
You must be signed in to change notification settings - Fork 942
fuzz-tests: add a test for handle_peer_error_or_warning()
#8304
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
base: master
Are you sure you want to change the base?
Conversation
The FUZZ_COMMON_OBJS list roughly follows lexicographic order. Make it adhere strictly to the order. This makes adding and reviewing changes to the file easier.
@morehouse , I think this test has exposed a bug, although I'm not 100% confident. We're injecting the fuzzer input as
and that works without any breakage. |
Hey @morehouse, like we discussed earlier, I investigated the breakage caused by this test:
And it looks like the breakage occurs due to I've faced this issue in a couple of other targets that I'm working on as well, and it doesn't take a lot of fuzzing time to pop up so I'm not sure if this is an actual bug or if I'm missing something in the target setup. I'd appreciate it if you could take a look. |
I ran the fuzz target with common/daemon_conn.c:161:18: runtime error: member access within null pointer of type 'struct daemon_conn'
#0 in daemon_conn_send common/daemon_conn.c:161:18
#1 in status_vfmt common/status.c:154:2
#2 in status_fmt common/status.c:165:2
#3 in handle_peer_error_or_warning common/read_peer_msg.c:29:3
#4 in run tests/fuzz/fuzz-error-warning.c:14:5 From this it's clear the initialized global is I think probably you need to add the following lines to the target's lightning/tests/fuzz/connectd_handshake.h Lines 73 to 75 in ad2dc97
|
This test is now ready to review. |
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.
Looking closer at this target, I'm not sure how much benefit it really provides.
handle_peer_error_or_warning
seems like a relatively simple function. I'm not sure it's worth adding ~200 new files to test it... WDYT?
tests/fuzz/fuzz-error-warning.c
Outdated
void peer_failed_connection_lost(void) | ||
{ longjmp(exit_jmp, 1); } |
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 can't find any place where peer_failed_connection_lost
is called from this fuzz target. Perhaps we can just abort if it does get called?
Right, makes me wonder why this happens though. Shouldn't the corpus for a relatively simpler target like this be smaller as well? |
Changelog-None: `handle_peer_error_or_warning()` in `common/read_peer_message.{c, h}` is responsible for parsing any incoming `error` or `warning` messages as defined in BOLT ElementsProject#1. Add a test for it.
Add a minimal input set as a seed corpus for the newly introduced test. This leads to discovery of interesting code paths faster.
handle_peer_error_or_warning()
incommon/read_peer_message
is responsible for parsing any incomingerror
orwarning
messages as defined in BOLT #1. Add a test for it.Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: