Skip to contentSkip to conversation

MODSIGN: Fix including certificate twice when the signing_key.x509 already exists

PATCH Superseded Chun-Yi Lee 3 participants 3 messages Feb 21, 2013 – Feb 22, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MODSIGN: Fix including certificate twice when the signing_key.x509 already exists

This issue was found in devel-pekey branch on linux-modsign.git tree. The x509_certificate_list includes certificate twice when the signing_key.x509 already exists.
We can reproduce this issue by making kernel twice, the build log of second time looks like this:

...
CHK kernel/config_data.h
CERTS kernel/x509_certificate_list
- Including cert /ramdisk/working/joey/linux-modsign/signing_key.x509
- Including cert signing_key.x509
...

Actually the build path was the same with the srctree path when building kernel. It causes the size of bzImage increased by packaging certificates twice.

Cc David Howells <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Josh Boyer <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Michal Marek <[email protected]>
---
 kernel/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/Makefile +4 -1
index 0ca8c0a..ecbe73f 100644
@@ -142,7 +142,10 @@ $(obj)/timeconst.h: $(src)/timeconst.pl FORCE
 #
 ###############################################################################
 ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
-X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
+X509_CERTIFICATES-y := $(wildcard *.x509)
+ifneq ($(shell pwd), $(srctree))
+X509_CERTIFICATES-y += $(wildcard $(srctree)/*.x509)
+endif
 X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
 X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
 
Signature · 1 line
1.6.4.2
#1 lore raw
Quoted 2 lines

+ifneq ($(shell pwd), $(srctree))

How reliable is this, I wonder?

David

#2 lore raw

Hi David,

Thanks for your review and point out!

於 四,2013-02-21 於 14:16 +0000,David Howells 提到:

Quoted 6 lines
Quoted 1 line

+ifneq ($(shell pwd), $(srctree))

How reliable is this, I wonder?

David

My current shell is bash, and I tried the '$(shell pwd)' in Makefile works for grab the REAL path when the build path is a symbolic links to kernel source directory. Looks the '$(shell pwd)' in Makefile was call '/bin/pwd' but not 'the shell builtin pwd'.

But, in case the behavior is different between shells, I think used '$(shell /bin/pwd)' will be better for make sure we call /bin/pwd from coreutils.

I will send a second version of this patch, please consider for accept if we need this change.

Thanks a lot!
Joey Lee