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

Re: [Xen-devel] [PATCH VERY RFC 3/5] tools/fuzz: introduce x86 instruction emulator target



>>> On 08.12.16 at 18:57, <wei.liu2@xxxxxxxxxx> wrote:
> On Thu, Dec 08, 2016 at 08:03:04AM -0700, Jan Beulich wrote:
>> >>> On 08.12.16 at 14:54, <wei.liu2@xxxxxxxxxx> wrote:
>> > Instruction emulator fuzzing code is from code previous written by
>> > Andrew and George. Adapted to llvm fuzzer and hook up the build system.
>> 
>> With this, how much of the new code could be shared between
>> Google's fuzzer and AFL, for which George had put this together
>> originally afaik? Or are we now no longer planning on having an
>> AFL target?
>> 
>> > --- /dev/null
>> > +++ b/tools/fuzz/x86_instruction_emulator/Makefile
>> > @@ -0,0 +1,33 @@
>> > +XEN_ROOT=$(CURDIR)/../../..
>> > +include $(XEN_ROOT)/tools/Rules.mk
>> > +
>> > +x86-instruction-emulator-fuzzer-all: x86-insn-emulator.a 
>> > x86-insn-emulator-fuzzer.o
>> > +
>> > +x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
>> > +  [ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
>> > +
>> > +x86_emulate.c:
>> > +  [ -L x86_emulate.c ] || ln -sf 
>> > $(XEN_ROOT)/tools/tests/x86_emulator/x86_emulate.c
>> > +
>> > +x86_emulate.h:
>> > +  [ -L x86_emulate.h ] || ln -sf 
>> > $(XEN_ROOT)/tools/tests/x86_emulator/x86_emulate.h
>> 
>> I think these two could easily be a single (pattern) rule, with (slightly
>> unusually) the file extension being the stem.
> 
> I think it is better to have them explicitly spelled out, because using
> something like
> 
> x86_emulate.%:
>       [ -L x86_emulate.$* ] || ln -sf 
> $(XEN_ROOT)/tools/tests/x86_emulator/x86_emulate.$*
> 
> would cause the x86_emulate.o compiled in tools/tests/x86_emulator be
> linked here, too, due to another rule we have:
> 
> x86_emulate.o: x86_emulate.c x86_emulate.h x86_emulate/x86_emulate.c 
> x86_emulate/x86_emulate.h 

Good point.

> Please let me know if you have some other ideas to deal with this.

A static pattern rule may then still be better than repeating the
same thing twice (and later perhaps even more often, i.e. once
we gain shared helper routine source/header files):

x86_emulate.c x86_emulate.h: %:
        [ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*

Jan


_______________________________________________
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®.