diff mbox

[for-4.15] wireless: create, don't append, to shipped-certs.c

Message ID 20171219192303.31395-1-briannorris@chromium.org (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show

Commit Message

Brian Norris Dec. 19, 2017, 7:23 p.m. UTC
The current rule for generating the {shipped,extra}-certs.c source files
might create an invalid C source file, containing redefinitions of the
same variables:

  CC [M]  net/wireless/shipped-certs.o
net/wireless/shipped-certs.c:686:10: error: redefinition of 'shipped_regdb_certs'
 const u8 shipped_regdb_certs[] = {
          ^
net/wireless/shipped-certs.c:2:10: note: previous definition of 'shipped_regdb_certs' was here
 const u8 shipped_regdb_certs[] = {
          ^
net/wireless/shipped-certs.c:1368:14: error: redefinition of 'shipped_regdb_certs_len'
 unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);
              ^
net/wireless/shipped-certs.c:684:14: note: previous definition of 'shipped_regdb_certs_len' was here
 unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);
              ^

This can be easily triggered by forcing a rebuild of these files:

  $ touch net/wireless/certs/sforshee.x509
  $ make

In practice, this is seen often by having a separate source and build
directory, where the build artifacts remain but the source tree changes
(even if Seth's cert doesn't change, it might get created/removed when
checking out different source revisions).

I don't see why this rule should be an append; we're writing the file
all in one go.

Fixes: 90a53e4432b1 ("cfg80211: implement regdb signature checking")
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
This is an error introduced in 4.15-rc1.

I've seen other errors reported by Paul and Damian (CC'd); I think Paul's
failure was fixed already, but Damian might have still been having problems
with not having a "clean" environment. Perhaps he was hitting this bug?

 net/wireless/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Johannes Berg Dec. 19, 2017, 8:11 p.m. UTC | #1
On Tue, 2017-12-19 at 11:23 -0800, Brian Norris wrote:
> 
> In practice, this is seen often by having a separate source and build
> directory, where the build artifacts remain but the source tree changes
> (even if Seth's cert doesn't change, it might get created/removed when
> checking out different source revisions).
> 
> I don't see why this rule should be an append; we're writing the file
> all in one go.

Yeah, that was an oversight from the code prior to my changes to make
it write it only once.

> Fixes: 90a53e4432b1 ("cfg80211: implement regdb signature checking")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> This is an error introduced in 4.15-rc1.
> 
> I've seen other errors reported by Paul and Damian (CC'd); I think Paul's
> failure was fixed already, but Damian might have still been having problems
> with not having a "clean" environment. Perhaps he was hitting this bug?

I'm not really sure what that problem was - I think a combination of
missing clean-files and this perhaps? Anyway, I applied another fix for
this today, and it's on the way to Linus's tree, along with the missing
clean-files and a conversion to non-binary files so that patches work
better.

johannes
Brian Norris Dec. 19, 2017, 8:38 p.m. UTC | #2
On Tue, Dec 19, 2017 at 09:11:30PM +0100, Johannes Berg wrote:
> I'm not really sure what that problem was - I think a combination of
> missing clean-files and this perhaps? Anyway, I applied another fix for
> this today, and it's on the way to Linus's tree, along with the missing
> clean-files and a conversion to non-binary files so that patches work
> better.

Ah, I didn't see that. I guess you just applied it a few hours ago, and
it didn't trickle into -next yet.

Thanks,
Brian
diff mbox

Patch

diff --git a/net/wireless/Makefile b/net/wireless/Makefile
index d7d6cb00c47b..b662be3422e1 100644
--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -43,7 +43,7 @@  $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.x509)
 	      echo "$$allf"; \
 	      echo '};'; \
 	      echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \
-	  ) >> $@)
+	  ) > $@)
 
 $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \
 		      $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509)
@@ -66,4 +66,4 @@  $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \
 	      echo "$$allf"; \
 	      echo '};'; \
 	      echo 'unsigned int extra_regdb_certs_len = sizeof(extra_regdb_certs);'; \
-	  ) >> $@)
+	  ) > $@)