Skip to contentSkip to conversation

Add explicit error for missing CONFIG_ASN1

PATCH In review James Bottomley 3 participants 10 messages Sep 22, 2020 – Sep 24, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Add explicit error for missing CONFIG_ASN1

I recently ran into this as an error from 0day. On x86 it's pretty much impossible to build a configuration where CONFIG_ASN1 isn't set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-keys/tpm2key.asn1.o', needed by 'security/keys/trusted-keys/built-in.a'. make[4]: *** [scripts/Makefile.build:283: security/keys/trusted-keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined for the asn1_compiler. Stop. make[3]: *** [scripts/Makefile.build:505: security/keys/trusted-keys] Error 2

James

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1 compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 Makefile.build: Add an explicit error for missing ASN.1 compiler

The current dependency rules mean that the build breaks if the ASN.1 compiler is required but CONFIG_ASN1 isn't set. However, it isn't obvious from the error message about missing files what the actual problem is, so make the build system give an explicit error.

---
 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)
scripts/Makefile.build +5 -0
index a467b9323442..bca7003beac8 100644
@@ -382,6 +382,11 @@ quiet_cmd_asn1_compiler = ASN.1   $(basename $@).[ch]
       cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
 				$(basename $@).c $(basename $@).h
 
+ifndef CONFIG_ASN1
+$(objtree)/scripts/asn1_compiler:
+	$(error CONFIG_ASN1 must be defined for the asn1_compiler)
+endif
+
 $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
 	$(call cmd,asn1_compiler)
 
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 1/1] Makefile.build: Add an explicit error for missing ASN.1 compiler

Quoted 8 lines · James Bottomley

The current dependency rules mean that the build breaks if the ASN.1 compiler is required but CONFIG_ASN1 isn't set. However, it isn't obvious from the error message about missing files what the actual problem is, so make the build system give an explicit error.

---

Applied to linux-kbuild.
Thanks.

Quoted 22 lines
 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)
scripts/Makefile.build +5 -1
index a467b9323442..bca7003beac8 100644
@@ -382,6 +382,11 @@ quiet_cmd_asn1_compiler = ASN.1   $(basename $@).[ch]
       cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
                                $(basename $@).c $(basename $@).h
 
+ifndef CONFIG_ASN1
+$(objtree)/scripts/asn1_compiler:
+       $(error CONFIG_ASN1 must be defined for the asn1_compiler)
+endif
+
 $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
        $(call cmd,asn1_compiler)
 
--

2.26.2

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
In reply to James Bottomley
Quoted 18 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's pretty much impossible to build a configuration where CONFIG_ASN1 isn't set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-keys/tpm2key.asn1.o', needed by 'security/keys/trusted-keys/built-in.a'. make[4]: *** [scripts/Makefile.build:283: security/keys/trusted-keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined for the asn1_compiler. Stop. make[3]: *** [scripts/Makefile.build:505: security/keys/trusted-keys] Error 2

James

Quoted 7 lines

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1 compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

Is there a missing
select ASN1
somewhere?

Signature · 1 line
~Randy
#4 lore raw
Quoted 29 lines · Randy Dunlap
Quoted 28 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's pretty much impossible to build a configuration where CONFIG_ASN1 isn't set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted-keys/built- in.a'.
make[4]: *** [scripts/Makefile.build:283: security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505: security/keys/trusted-
keys] Error 2

James

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1 compiler

Quoted 6 lines
Quoted 2 lines
 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

Is there a missing
select ASN1
somewhere?

You mean in the build used to produce the errors above? Yes, so the patch is to make the problem more explicit.

James

#5 lore raw
Quoted 33 lines · James Bottomley
Quoted 32 lines · Randy Dunlap
Quoted 30 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's pretty much impossible to build a configuration where CONFIG_ASN1 isn't set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted-keys/built- in.a'.
make[4]: *** [scripts/Makefile.build:283: security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505: security/keys/trusted-
keys] Error 2

James

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1 compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 6 lines
Quoted 3 lines

Is there a missing
select ASN1
somewhere?

You mean in the build used to produce the errors above? Yes, so the patch is to make the problem more explicit.

I appreciate that the message can be improved, but it seems possible that some Kconfig could also be improved.

Signature · 1 line
~Randy
#6 lore raw
Quoted 47 lines · Randy Dunlap
Quoted 46 lines · James Bottomley
Quoted 44 lines · Randy Dunlap
Quoted 31 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's pretty
much impossible to build a configuration where CONFIG_ASN1 isn't
set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is
never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted- keys/built-
in.a'.
make[4]: *** [scripts/Makefile.build:283:
security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined
for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505:
security/keys/trusted-
keys] Error 2

James

Quoted 8 lines

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1
compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

Is there a missing
select ASN1
somewhere?

Quoted 6 lines
Quoted 3 lines

You mean in the build used to produce the errors above? Yes, so the
patch is to make the problem more explicit.

I appreciate that the message can be improved, but it seems possible that some Kconfig could also be improved.

I don't really see how. To find the problem you have to identify a conditional build in the Makefile that requires the asn1 compiler but for which the config option doesn't have a select ASN1. We don't currently preserve the "what selected this symbol" information in kconfig, which is what we'd need.

James

#7 lore raw
Quoted 52 lines · James Bottomley
Quoted 51 lines · Randy Dunlap
Quoted 49 lines · James Bottomley
Quoted 38 lines · Randy Dunlap
Quoted 37 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's pretty
much impossible to build a configuration where CONFIG_ASN1 isn't
set, so you rarely notice a problem using the ASN.1 compiler because something else has selected it. However, this compiler is
never built if CONFIG_ASN1 isn't set and the error you get from kbuild is particularly unhelpful:

make[4]: *** No rule to make target 'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted- keys/built-
in.a'.
make[4]: *** [scripts/Makefile.build:283:
security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be defined
for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505:
security/keys/trusted-
keys] Error 2

James

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1
compiler

Quoted 6 lines
Quoted 2 lines
 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

Is there a missing
select ASN1
somewhere?

You mean in the build used to produce the errors above? Yes, so the
patch is to make the problem more explicit.

Quoted 8 lines
Quoted 2 lines

I appreciate that the message can be improved, but it seems possible that some Kconfig could also be improved.

I don't really see how. To find the problem you have to identify a conditional build in the Makefile that requires the asn1 compiler but for which the config option doesn't have a select ASN1. We don't currently preserve the "what selected this symbol" information in kconfig, which is what we'd need.

Well, if you have a failing .config file, I would be glad to take a look at it...

Signature · 1 line
~Randy
#8 lore raw
Quoted 61 lines · Randy Dunlap
Quoted 60 lines · James Bottomley
Quoted 58 lines · Randy Dunlap
Quoted 48 lines · James Bottomley
Quoted 47 lines · Randy Dunlap
Quoted 45 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's
pretty
much impossible to build a configuration where CONFIG_ASN1 isn't
set, so you rarely notice a problem using the ASN.1 compiler
because something else has selected it. However, this compiler
is
never built if CONFIG_ASN1 isn't set and the error you get from
kbuild is particularly unhelpful:

make[4]: *** No rule to make target
'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted- keys/built-
in.a'.
make[4]: *** [scripts/Makefile.build:283:
security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be
defined
for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505:
security/keys/trusted-
keys] Error 2

James

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1
compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 6 lines
Quoted 3 lines

Is there a missing
select ASN1
somewhere?

You mean in the build used to produce the errors above? Yes, so the patch is to make the problem more explicit.

I appreciate that the message can be improved, but it seems possible that some Kconfig could also be improved.

Quoted 8 lines
Quoted 5 lines

I don't really see how. To find the problem you have to identify a conditional build in the Makefile that requires the asn1 compiler but for which the config option doesn't have a select ASN1. We don't currently preserve the "what selected this symbol" information in kconfig, which is what we'd need.

Well, if you have a failing .config file, I would be glad to take a look at it...

The original problem is already fixed. The point of this patch is to make 0day explicitly identify it if it ever occurs again.

James

#9 lore raw
Quoted 68 lines · James Bottomley
Quoted 67 lines · Randy Dunlap
Quoted 65 lines · James Bottomley
Quoted 53 lines · Randy Dunlap
Quoted 52 lines · James Bottomley
Quoted 50 lines · Randy Dunlap
Quoted 37 lines · James Bottomley

I recently ran into this as an error from 0day. On x86 it's
pretty
much impossible to build a configuration where CONFIG_ASN1 isn't
set, so you rarely notice a problem using the ASN.1 compiler
because something else has selected it. However, this compiler
is
never built if CONFIG_ASN1 isn't set and the error you get from
kbuild is particularly unhelpful:

make[4]: *** No rule to make target
'security/keys/trusted-
keys/tpm2key.asn1.o', needed by 'security/keys/trusted- keys/built-
in.a'.
make[4]: *** [scripts/Makefile.build:283:
security/keys/trusted-
keys/trusted_tpm2.o] Error 1
make[4]: Target '__build' not remade because of errors.

This patch changes the above error to the much easier to diagnose:

scripts/Makefile.build:387: *** CONFIG_ASN1 must be
defined
for
the asn1_compiler. Stop.
make[3]: *** [scripts/Makefile.build:505:
security/keys/trusted-
keys] Error 2

James

Quoted 8 lines

---

James Bottomley (1):
Makefile.build: Add an explicit error for missing ASN.1
compiler

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

Is there a missing
select ASN1
somewhere?

Quoted 5 lines
Quoted 2 lines

You mean in the build used to produce the errors above? Yes, so the patch is to make the problem more explicit.

I appreciate that the message can be improved, but it seems possible that some Kconfig could also be improved.

I don't really see how. To find the problem you have to identify a conditional build in the Makefile that requires the asn1 compiler but for which the config option doesn't have a select ASN1. We don't currently preserve the "what selected this symbol" information in kconfig, which is what we'd need.

Quoted 5 lines
Quoted 2 lines

Well, if you have a failing .config file, I would be glad to take a look at it...

The original problem is already fixed. The point of this patch is to make 0day explicitly identify it if it ever occurs again.

Got it. That's helpful info IMO.

thanks.

Signature · 1 line
~Randy