MODSIGN: Fix including certificate twice when the
[opensuse:kernel-source.git] / patches.fixes / 0001-MODSIGN-Fix-including-certificate-twice-when-the-si.patch
1 From: Chun-Yi Lee <joeyli.kernel@gmail.com>
2 Date: Thu, 21 Feb 2013 19:23:49 +0800
3 Subject: [PATCH v2] MODSIGN: Fix including certificate twice when the signing_key.x509 already exists
4
5 Git-commit: 4ea349d3bb1d3521b7df8dbf0e88fe41cd3c0683
6 Patch-mainline: v3.9-rc?, merged to linux-modsign
7 References: bnc#805114
8 Target: SLE-11 SP3
9
10 This issue was found in devel-pekey branch on linux-modsign.git tree. The
11 x509_certificate_list includes certificate twice when the signing_key.x509
12 already exists.
13 We can reproduce this issue by making kernel twice, the build log of
14 second time looks like this:
15
16 ...
17   CHK     kernel/config_data.h
18   CERTS   kernel/x509_certificate_list
19   - Including cert /ramdisk/working/joey/linux-modsign/signing_key.x509
20   - Including cert signing_key.x509
21 ...
22
23 Actually the build path was the same with the srctree path when building
24 kernel. It causes the size of bzImage increased by packaging certificates
25 twice.
26
27 v2:
28 Using '$(shell /bin/pwd)' instead of '$(shell pwd)' for more reliable between different shells.
29
30 Cc: Rusty Russell <rusty@rustcorp.com.au>
31 Cc: Josh Boyer <jwboyer@redhat.com>
32 Cc: Randy Dunlap <rdunlap@xenotime.net>
33 Cc: Herbert Xu <herbert@gondor.apana.org.au>
34 Cc: "David S. Miller" <davem@davemloft.net>
35 Cc: Michal Marek <mmarek@suse.com>
36 Signed-off-by: Chun-Yi Lee <jlee@suse.com>
37 Signed-off-by: David Howells <dhowells@redhat.com>
38 ---
39  kernel/Makefile |    5 ++++-
40  1 file changed, 4 insertions(+), 1 deletion(-)
41
42 --- a/kernel/Makefile
43 +++ b/kernel/Makefile
44 @@ -149,7 +149,10 @@ ifeq ($(CONFIG_MODULE_SIG),y)
45  # them into the kernel.
46  #
47  ###############################################################################
48 -X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
49 +X509_CERTIFICATES-y := $(wildcard *.x509)
50 +ifneq ($(shell /bin/pwd), $(srctree))
51 +X509_CERTIFICATES-y += $(wildcard $(srctree)/*.x509)
52 +endif
53  X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
54  X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
55