On Tue, Jan 24, 2017 at 05:25:29PM +0000, Andrew Cooper wrote: > On 24/01/17 17:22, Ian Jackson wrote: > > Wei Liu writes ("Re: [PATCH 2/4] tools/fuzz: add AFL stub program for x86 > > insn emulator fuzzer"): > >> On Tue, Jan 24, 2017 at 05:05:16PM +0000, Ian Jackson wrote: > >>> If you use read you ought to put it in a loop to cope with potential > >>> partial reads. > >> Does fread have better properties than read? > > Yes. fread is not allowed to give a short read for no particular > > reason, nor to return with EINTR. > > > >> I think to deal with short read we would need to stat the file to > >> get actual size for both fread and read, right? > > No. In both cases, it is possible to detect whether a short read is > > due to EOF. With read, that would have to be in a loop. With fread > > you can test feof. > > > > You don't need to test with stat unless you want to support files > > bigger than your static buffer. > > It is expected that AFL data will eventually become longer than the > fuzzer wishes. You should ignore extraneous data. >
That's not necessarily true. It depends on how you run the fuzzer. But yes, ignoring extraneous data is sensible. > Also, remember that AFL prefers to pass data by pipe. It supports both using file or STDIN. Using file would be easier for manual retest. Wei. > > ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel