Skip to contentSkip to conversation

Fuzz/x86emul and x86emul/test fixes

PATCH Superseded Wei Liu 2 participants 6 messages Feb 20, 2017

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v3 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 | 12 ++++++++----
 tools/tests/x86_emulator/Makefile            | 12 ++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 7 lines
2.11.0


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

PATCH v3 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.

---
v3: use pattern matching rule

---
 tools/fuzz/x86_instruction_emulator/Makefile | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tools/fuzz/x86_instruction_emulator/Makefile +8 -4
index fede7e9afd..b0ea31b2b0 100644
@@ -8,11 +8,15 @@ 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 $@
+
+asm/%: asm ;
 
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
Signature · 7 lines
2.11.0


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

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

Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 20.02.17 at 13:05, <[email protected]> wrote:

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.

---
v3: use pattern matching rule

---
 tools/fuzz/x86_instruction_emulator/Makefile | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tools/fuzz/x86_instruction_emulator/Makefile +0 -0
index fede7e9afd..b0ea31b2b0 100644

tools/fuzz/x86_instruction_emulator/Makefile else · line 12

Quoted 7 lines
tools/fuzz/x86_instruction_emulator/Makefile +2 -2
@@ -8,11 +8,15 @@ 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/$@ .

For consistency with the ln at the very bottom (patch context) you may want to omit the . here.

tools/fuzz/x86_instruction_emulator/Makefile else · line 14

Quoted 3 lines
tools/fuzz/x86_instruction_emulator/Makefile +1 -2
-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

So why don't you use a pattern rule here?

tools/fuzz/x86_instruction_emulator/Makefile else · line 19

Quoted 4 lines
tools/fuzz/x86_instruction_emulator/Makefile +4 -0
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
+
+asm/%: asm ;

Is the semicolon needed here? You don't have one above ...

Jan

tools/fuzz/x86_instruction_emulator/Makefile else · line 22

Quoted 2 lines
tools/fuzz/x86_instruction_emulator/Makefile +0 -0
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*

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

author
#3 lore raw

Re: [PATCH v3 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 20.02.17 at 13:05, <[email protected]> wrote:

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.

---
v3: use pattern matching rule

---
 tools/fuzz/x86_instruction_emulator/Makefile | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tools/fuzz/x86_instruction_emulator/Makefile +0 -0
index fede7e9afd..b0ea31b2b0 100644
@@ -8,11 +8,15 @@ else
 x86-instruction-emulator-fuzzer-all:
 endif
 
Quoted 8 lines

tools/fuzz/x86_instruction_emulator/Makefile else · line 12

Quoted 4 lines
tools/fuzz/x86_instruction_emulator/Makefile +2 -2
-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/$@ .

For consistency with the ln at the very bottom (patch context) you may want to omit the . here.

Sure.

Quoted 6 lines

tools/fuzz/x86_instruction_emulator/Makefile else · line 14

Quoted 3 lines
tools/fuzz/x86_instruction_emulator/Makefile +1 -2
-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

So why don't you use a pattern rule here?

Forgot this place. Will fix.

Quoted 7 lines

tools/fuzz/x86_instruction_emulator/Makefile else · line 19

Quoted 4 lines
tools/fuzz/x86_instruction_emulator/Makefile +4 -0
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
+
+asm/%: asm ;

Is the semicolon needed here? You don't have one above ...

Yes, this is needed; otherwise make complains not knowing how to make the target. When I change x86_emulate.[ch] to use patter rule, I will need to add a semicolon as well.

From Make manual for empty recipes:

Empty recipes can also be used to avoid errors for targets that will be created as a side-effect of another recipe: if the target does not exist the empty recipe ensures that make won’t complain that it doesn't know how to build the target, and make will assume the target is out of date.

Wei.

Quoted 6 lines

Jan

Quoted 2 lines
tools/fuzz/x86_instruction_emulator/Makefile +0 -0
 x86_emulate.c x86_emulate.h: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*

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

#4 lore raw

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

Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 20.02.17 at 15:05, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich

tools/fuzz/x86_instruction_emulator/Makefile else · line 19

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 20.02.17 at 13:05, <[email protected]> wrote:
tools/fuzz/x86_instruction_emulator/Makefile +4 -0
+asm:
+	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
+
+asm/%: asm ;

Is the semicolon needed here? You don't have one above ...

Yes, this is needed; otherwise make complains not knowing how to make the target. When I change x86_emulate.[ch] to use patter rule, I will need to add a semicolon as well.

Quoted 6 lines

From Make manual for empty recipes:

Empty recipes can also be used to avoid errors for targets that will be created as a side-effect of another recipe: if the target does not exist the empty recipe ensures that make won’t complain that it doesn't know how to build the target, and make will assume the target is out of date.

Oh, yes, of course.

Jan

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

author
#5 lore raw

PATCH v3 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 | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tools/tests/x86_emulator/Makefile +8 -4
index 9bf36947c0..e0cd88d13d 100644
@@ -40,11 +40,15 @@ 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 $@
+
+asm/%: asm ;
 
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I.
 
Signature · 7 lines
2.11.0


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