-
Notifications
You must be signed in to change notification settings - Fork 536
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
A small problem about calibrate_case #159
Comments
Interesting, thanks for the analysis! Let's try to figure out the root cause, and some more help with this would be greatly appreciated. It looks like in some cases an extra basic block is encountered and it might be useful to know which one it is. Could you add some extra logging to figure out what its offset in trace_bits is? I'm not sure why trace_bits would change once the iteration is already over. One possible explanation would be that another thread is hitting a basic block in the coverage module. If this is the case, the problem should vanish when the coverage is collected only from a single thread. Could you test again with |
I don't think that " in some cases an extra basic block is encountered ", becausee I did the following try:
After run_target() function, I get two times cksum, once before sleep(50), once after sleep(50) , the log is following:
so i think the key is "time" |
Yes, but the question is, why is trace_sum 17 before and 18 after sleep in some cases, and my thinking is that something must have written to trace_bits in the meantime, which only happens in winafl.dll when an instrumented basic block is hit. Either that or afl-fuzz is reading stale data from the cpu cache, which would be odd IMHO. |
when i debug afl-fuzz.c with test.exe, I find that i can't trim input file successfully , Because the cksum(come from hash32 function) is always different with q->exec_cksum。q->exec_cksum is set in function calibrate_case 。 My input file is “abcdefghijklmnopqrsuvwxyz123456789123456789abcdefghijklmnopqrsuvwxyz123456789123456789”。Note that there is not a character 't' in the input file, so no matter how i trim it , the execution path and the cksum should be the same as q->exec_cksum. But the truth is not what I thought it would be.
In order to find the reason , i record some data in my log.txt. And in order to determine if trace_bits is all the same , I wirite a trace_bit_sum() function like this:
here's my log.txt: (trace_sum is the return value of trace_bit_sum() )
look :
perform_dry_run function start, calibrate_case function start,
the cksum I get in function calibrate_case has alwys been 3897125560 , and the trace_sum is 17。so the q->exec_cksum is 3897125560 .
But when I trim the input file, most of the cksum are 675120926 , which caused that i can't successfully cut the input file.
I've made a lot of attempts to solve this problem. Eventually, I found out that i need to add a delay between run_target() and hash32() in calibrate_case() function. like this:
my new log.txt like this:
look , I trim the input fiel successfully.
So do you know what caused this?
The text was updated successfully, but these errors were encountered: