Skip to contentSkip to conversation

Fuzz/x86emul and x86emul/test fixes

PATCH Superseded Wei Liu 2 participants 5 messages Feb 17, 2017

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Fuzz/x86emul and x86emul/test fixes

Wei Liu (2):
fuzz/x86emul: avoid race in link farm rune
x86emul/test: avoid race in link farm rune

 tools/fuzz/x86_instruction_emulator/Makefile | 13 +++++++------
 tools/tests/x86_emulator/Makefile            | 13 +++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v2 1/2 fuzz/x86emul: avoid race in link farm rune

Several ln -sf can race with each other and cause error like:

14:43:56 00:07:06 O: ln: cannot remove 'asm': No such file or directory

Provide dedicated targets for soft-linking directories.

---
 tools/fuzz/x86_instruction_emulator/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tools/fuzz/x86_instruction_emulator/Makefile +7 -6
index fede7e9afd..ac9010e4a8 100644
@@ -8,19 +8,20 @@ else
 x86-instruction-emulator-fuzzer-all:
 endif
 
-x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
-	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
+x86_emulate:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@ .
 
-asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h:
-	[ -L asm ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 asm
+x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h: x86_emulate
+
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
 
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
 
 CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h asm
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c $(x86_emulate.h)
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH v2 1/2] fuzz/x86emul: avoid race in link farm rune

Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 17.02.17 at 11:27, <[email protected]> wrote:
tools/fuzz/x86_instruction_emulator/Makefile +6 -4
@@ -8,19 +8,20 @@ else
 x86-instruction-emulator-fuzzer-all:
 endif
 
-x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
-	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
+x86_emulate:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@ .
 
-asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h:
-	[ -L asm ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 asm
+x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h: x86_emulate
+
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
 

tools/fuzz/x86_instruction_emulator/Makefile else · line 26

Quoted 10 lines
tools/fuzz/x86_instruction_emulator/Makefile +1 -2
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
 
 CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h asm
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c $(x86_emulate.h)

This now breaks the need for re-compilation of x86_emulate.o when any of the headers in $(x86.h) changed.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#3 lore raw

Re: [PATCH v2 1/2] fuzz/x86emul: avoid race in link farm rune

Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 17.02.17 at 11:27, <[email protected]> wrote:
tools/fuzz/x86_instruction_emulator/Makefile +6 -4
@@ -8,19 +8,20 @@ else
 x86-instruction-emulator-fuzzer-all:
 endif
 
-x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
-	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
+x86_emulate:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@ .
 
-asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h:
-	[ -L asm ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 asm
+x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h: x86_emulate
+
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
 
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
 
 CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
 
Quoted 9 lines

tools/fuzz/x86_instruction_emulator/Makefile else · line 26

Quoted 5 lines
tools/fuzz/x86_instruction_emulator/Makefile +1 -2
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h asm
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c $(x86_emulate.h)

This now breaks the need for re-compilation of x86_emulate.o when any of the headers in $(x86.h) changed.

Yes, you're right. I will fix this.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw

PATCH v2 2/2 x86emul/test: avoid race in link farm rune

In reply to Wei Liu

Several ln -sf can race with each other. Provide dedicated targets for soft-linking directories.

---
 tools/tests/x86_emulator/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tools/tests/x86_emulator/Makefile +7 -6
index 9bf36947c0..6fa0b6c803 100644
@@ -40,16 +40,17 @@ distclean: clean
 .PHONY: install
 install:
 
-x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
-	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
+x86_emulate:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/arch/x86/$@ .
 
-asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h:
-	[ -L asm ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 asm
+x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h: x86_emulate
+
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
 
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I.
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h asm
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c $(x86_emulate.h)
 	$(HOSTCC) $(HOSTCFLAGS) -D__XEN_TOOLS__ -c -g -o $@ $<
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel