Open Isabel0715 opened 6 months ago
oh you are right this is a bug. fixed it in the dev branch, thanks for reporting!
Thanks for your quick reply!
However, I copyed the changes made in dev branch and reran the code, the bug was still there.
It doesn't try to unlink nl[0] (".")
and nl[1] ("..")
anymore, but still only the nl[2]
can be unlinked.
I'm not sure this is the expected behavior.
Is it correct that I suppose all the files except for . and .. should be processed and unlinked?
no the _fuzz function only returns a single testcase input. that is why only one may be removed.
and now that you point it out - there was never a bug, so I reverted my "fix", because the previous state was better than what I did.
OK. So, are there any possible solutions to limit the number of files in out_dir? The upper limit for me is up to 20000, which is easy to exceed in ~3 hours.
Then this is a different bug. Because the _fuzz function is as often called as files are in there - that is what the _count custom mutator function returns in the step before running the _fuzz loop
Thanks again for your explanation. However, I'm still a bit confused about how it is supposed to work exactly. I wonder if you are going to fix this.
I will fix it - when I have the time
Describe the bug When using the custom_mutator symcc, a large number of files are generated in the data->out_dir folder during execution. I suspect this is due to the assignment of the
done
variable in theafl_custom_fuzz
function in fileAFLplusplus/custom_mutators/symcc/symcc.c
.Each time
scandir
is called, it iterates through the elements undernl
. Ifdone == 0
, it processes the file (Lines 292-306) and then unlinks it (Line 308). However, during execution, ifafl_custom_fuzz
finds 10,000 items in out_dir byscandir
, only the file corresponding tonl[2]
gets unlinked. This is becausenl[0]
andnl[1]
usually haved_name
values of"."
and".."
, respectively, which do not trigger the assignmentdone = 1
. Once the file corresponding tonl[2]
is accessed and processed,done
is set to 1. Consequently, the subsequent 9997 files are not processed or unlinked due todone == 1
, resulting in them not executing the logic from Lines 292-310.This seems problematic as hundreds even thousands of files are added to
out_dir
every second, but the deletion rate is much slower, leading to a rapid increase in the number of files inout_dir
. This quickly exceeds the file count limit allowed by my supercomputer account. I'm unsure ifafl_custom_fuzz
is intended to process and delete only one file per call. If so, is there a way to limit the number of files inout_dir
?I attempted to remove the
done==0
check (Lines 290 and 310) and reran the code. In this case, all files were processed and unlinked quickly, keeping the file count in out_dir below 3000. However, I'm unsure about the original purpose of thedone
variable and whether this modification aligns with the design principles of AFL++ and custom_mutator. I really need your assistance.To Reproduce Steps to reproduce the behavior:
make
command inAFLplusplus/custom_mutators/symcc
.SYMCC_TARGET
andAFL_CUSTOM_MUTATOR_LIBRARY
.afl-fuzz
to test alongwith symcc.Expected behavior Limit the number of files in symcc out_dir (The upper limit for me is up to 20000).
Screen output/Screenshots I modified the
afl_custom_fuzz
function by adding some logging statements as following.And parts of the corresponding log are as follows.