On Thu, Aug 31, 2017 at 12:46:50PM -0700, Kostya Serebryany wrote:
> On Thu, Aug 31, 2017 at 12:41 PM, Ben Pfaff <[email protected]> wrote:
> 
> > What's the issue with file I/O?  If you can help me understand why you
> > want to get rid of it, maybe I can suggest what to do instead.
> >
> 
> The file IO takes more time than direct access to memory.
> Even if the actual IO happens on tmpfs, this is still slower, because the
> accesses to the data require syscalls.
> using fmemopen instead of fopen in the fuzz target
> (LLVMFuzzerTestOneInput()) should reduce the overhead.

I didn't look at the actual code before, but now that I have, I don't
understand at all why it was doing file I/O just to write a packet to
disk and then read it back.

Here is a more natural way to do this:

int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
    struct dp_packet packet;
    dp_packet_use_const(&packet, data, size);

    struct flow flow;
    flow_extract(&packet, &flow);

    return 0;
}
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to