-
Notifications
You must be signed in to change notification settings - Fork 81
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
AFL++ communication error - Pipe read returns 0 #60
Comments
It seems that KF/x doesn't complete the PT decoding before AFL++ quits: https://github.com/intel/kernel-fuzzer-for-xen-project/blob/master/src/ptcov.c#L166 I thought that this must be a timing issue, so I tried moving
Scratch that, |
Moving |
Yeah I know, I just wanted to test if it's the decoding delay thas is causing this. |
I don't think I can help you much here, the read should never return 0 and as far as I can see, this should only happen when the pipe gets closed /EOF - so not timing related. |
Would be good to understand where the communication gets stuck. If |
Also, btw, usually when I see "Unable to communicate with fork server" that just means KF/x exited early. Always verify that kfx runs fine first standalone and that it doesn't report a crash. Just replace |
It is a segfault in libxdc :P As I understand writes don't block the sender, so KF/x can send whatever, then by the time AFL++ tries to read the data the fork either crashed or not. It's interesting why this happens non-deterministically (sometimes libxdc can decode all traces, but during most startups it can't). Closing this for now, thanks for your help! |
I ran into an annoying non-deterministic bug when using KF/x with AFL++. I traced back the issue to the fact that sometimes the pipe read by AFL++ here returns 0 (but not -1, that would indicate an error):
https://github.com/AFLplusplus/AFLplusplus/blob/stable/src/afl-forkserver.c#L172
Retrying here instead of returning doesn't improve the situation, because all subsequent reads also return 0.
This results in
read_s32_timed
returning 0, that ultimately ends up killing the setup phase with the well known "Unable to communicate with fork server" message:https://github.com/AFLplusplus/AFLplusplus/blob/stable/src/afl-forkserver.c#L191
https://github.com/AFLplusplus/AFLplusplus/blob/stable/src/afl-forkserver.c#L1299
I'm not entirely sure which write this should be on KF/x's side, but I could confirm, that
afl_wait
successfully writes the 4 expected bytes to the pipe. As far as I understand, the next communication should be byafl_report
, so I suspect that something must go wrong between these two lines:https://github.com/intel/kernel-fuzzer-for-xen-project/blob/master/src/main.c#L93
https://github.com/intel/kernel-fuzzer-for-xen-project/blob/master/src/main.c#L123
Interestingly, it feels that running KF/x improves the success rate, but I don't have the data to support this.
Tagging in @domenukk, hoping he can shed some light on the expected behavior at AFL++ side.
The text was updated successfully, but these errors were encountered: