[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/4] tools/fuzz: add AFL stub program for x86 insn emulator fuzzer



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.

Also, remember that AFL prefers to pass data by pipe.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.