* Re: [GIT PULL] KEYS: Miscellaneous fixes
2013-12-10 20:40 [GIT PULL] KEYS: Miscellaneous fixes David Howells
@ 2013-12-12 21:31 ` Linus Torvalds
2013-12-13 14:35 ` David Howells
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2013-12-12 21:31 UTC (permalink / raw)
To: David Howells; +Cc: James Morris, keyrings, LSM List, Linux Kernel Mailing List
On Tue, Dec 10, 2013 at 12:40 PM, David Howells <dhowells@redhat.com> wrote:
>
> Could you pull the following fixes for the keyring stuff.
Pulled. However, I notice that the following issue remains with module
key signing, and I *think* it was introduced in the -rc1 pull:
- start with clean kernel sources
- build kernel ("make -j16" or whatever after doing your config)
- build kernel again ("make -j" - nothing has changed):
...
X.509 certificate list changed
CERTS kernel/x509_certificate_list
- Including cert /home/torvalds/v2.6/linux/signing_key.x509
AS kernel/system_certificates.o
LD kernel/built-in.o
...
which causes it to relink the kernel.
- build kernel yet again, and now finally it doesn't build/link anything.
So some rule for the certificate list seems to be broken. I'm pretty
sure this didn't happen in 3.12. Any ideas?
Linus
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] KEYS: Miscellaneous fixes
2013-12-10 20:40 [GIT PULL] KEYS: Miscellaneous fixes David Howells
2013-12-12 21:31 ` Linus Torvalds
@ 2013-12-13 14:35 ` David Howells
2013-12-13 15:00 ` David Howells
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2013-12-13 14:35 UTC (permalink / raw)
To: Linus Torvalds
Cc: dhowells, James Morris, keyrings, LSM List, Linux Kernel Mailing List
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > Could you pull the following fixes for the keyring stuff.
>
> Pulled. However, I notice that the following issue remains with module
> key signing, and I *think* it was introduced in the -rc1 pull:
>
> - start with clean kernel sources
>
> - build kernel ("make -j16" or whatever after doing your config)
>
> - build kernel again ("make -j" - nothing has changed):
>
> ...
> X.509 certificate list changed
Hmmm... I don't see this.
Are you using O= on the make command line? Do you have any extra certificates?
David
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] KEYS: Miscellaneous fixes
2013-12-10 20:40 [GIT PULL] KEYS: Miscellaneous fixes David Howells
2013-12-12 21:31 ` Linus Torvalds
2013-12-13 14:35 ` David Howells
@ 2013-12-13 15:00 ` David Howells
2013-12-16 16:40 ` David Howells
2013-12-18 16:43 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2013-12-13 15:00 UTC (permalink / raw)
To: Linus Torvalds
Cc: dhowells, James Morris, keyrings, LSM List, Linux Kernel Mailing List
David Howells <dhowells@redhat.com> wrote:
> > - build kernel again ("make -j" - nothing has changed):
> >
> > ...
> > X.509 certificate list changed
>
> Hmmm... I don't see this.
I take that back. I do, but only on the first rebuild. The problem appears
to be that kernel/Makefile does not predict the path of kernel/.x509.list when
it does not exist yet.
David
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] KEYS: Miscellaneous fixes
2013-12-10 20:40 [GIT PULL] KEYS: Miscellaneous fixes David Howells
` (2 preceding siblings ...)
2013-12-13 15:00 ` David Howells
@ 2013-12-16 16:40 ` David Howells
2013-12-18 16:43 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2013-12-16 16:40 UTC (permalink / raw)
To: Linus Torvalds
Cc: dhowells, James Morris, keyrings, LSM List, Linux Kernel Mailing List
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> Pulled. However, I notice that the following issue remains with module
> key signing, and I *think* it was introduced in the -rc1 pull:
I posted four patches on Friday. Does:
[PATCH 1/4] X.509: Fix certificate gathering
fix your problem?
David
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] KEYS: Miscellaneous fixes
2013-12-10 20:40 [GIT PULL] KEYS: Miscellaneous fixes David Howells
` (3 preceding siblings ...)
2013-12-16 16:40 ` David Howells
@ 2013-12-18 16:43 ` David Howells
4 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2013-12-18 16:43 UTC (permalink / raw)
To: Linus Torvalds
Cc: dhowells, James Morris, keyrings, LSM List, Linux Kernel Mailing List
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > Could you pull the following fixes for the keyring stuff.
>
> Pulled. However, I notice that the following issue remains with module
> key signing, and I *think* it was introduced in the -rc1 pull:
>
> - start with clean kernel sources
>
> - build kernel ("make -j16" or whatever after doing your config)
>
> - build kernel again ("make -j" - nothing has changed):
>
> ...
> X.509 certificate list changed
> CERTS kernel/x509_certificate_list
> - Including cert /home/torvalds/v2.6/linux/signing_key.x509
> AS kernel/system_certificates.o
> LD kernel/built-in.o
> ...
>
> which causes it to relink the kernel.
>
> - build kernel yet again, and now finally it doesn't build/link anything.
>
> So some rule for the certificate list seems to be broken. I'm pretty
> sure this didn't happen in 3.12. Any ideas?
Is this fixed by the attached patch?
David
---
Fix the gathering of certificates from both the source tree and the build tree
to correctly calculate the pathnames of all the certificates.
The problem was that if the default generated cert, signing_key.x509, didn't
exist then it would not have a path attached and if it did, it would have a
path attached.
This means that the contents of kernel/.x509.list would change between the
first compilation in a directory and the second. After the second it would
remain stable because the signing_key.x509 file exists.
The consequence was that the kernel would get relinked unconditionally on the
second recompilation. The second recompilation would also show something like
this:
X.509 certificate list changed
CERTS kernel/x509_certificate_list
- Including cert /home/torvalds/v2.6/linux/signing_key.x509
AS kernel/system_certificates.o
LD kernel/built-in.o
which is why the relink would happen.
Unfortunately, it isn't a simple matter of just sticking a path on the front
of the filename of the certificate in the build directory as make can't then
work out how to build it.
So the path has to be prepended to the name for sorting and duplicate
elimination and then removed for the make rule if it is in the build tree.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---
kernel/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/Makefile b/kernel/Makefile
index bbaf7d59c1bb..c23bb0b30293 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -137,9 +137,10 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
###############################################################################
ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
-X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
-X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
+X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509
+X509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
$(or $(realpath $(CERT)),$(CERT))))
+X509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw))
ifeq ($(X509_CERTIFICATES),)
$(warning *** No X.509 certificates found ***)
^ permalink raw reply [flat|nested] 6+ messages in thread