Skip to contentSkip to conversation

kbuild: If the module stripping command fails the build should abort

PATCH In review Douglas Anderson 2 participants 4 messages Mar 14, 2019 – Mar 15, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: If the module stripping command fails the build should abort

If the call to strip returns an error code then it makes sense for the build to fail. Currently we'll just chug along and ship unstripped modules.

Fixes e2a666d52b48 ("kbuild: sign the modules at install time")

---

 scripts/Makefile.modinst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.modinst +1 -1
index ff5ca9817a85..5d05c43c6f31 100644
@@ -22,7 +22,7 @@ quiet_cmd_modules_install = INSTALL $@
       cmd_modules_install = \
     mkdir -p $(2) ; \
     cp $@ $(2) ; \
-    $(mod_strip_cmd) $(2)/$(notdir $@) ; \
+    $(mod_strip_cmd) $(2)/$(notdir $@) && \
     $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \
     $(mod_compress_cmd) $(2)/$(notdir $@)
 
Signature · 1 line
2.21.0.360.g471c308f928-goog
#1 lore raw
Quoted 7 lines · Douglas Anderson

If the call to strip returns an error code then it makes sense for the build to fail. Currently we'll just chug along and ship unstripped modules.

Fixes e2a666d52b48 ("kbuild: sign the modules at install time")

Did you see this problem in the latest kernel?

Since commit 3a2429e1faf40b2aaa481aa4b001a74d222c7e8b, $(call cmd,...) is run with 'set -e'.

Any failure in a series of commands will let the build fail.

If you have the problem in old versions ( < 4.20), I do not mind this patch for linux-stable.

Quoted 19 lines

---

 scripts/Makefile.modinst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.modinst +1 -2
index ff5ca9817a85..5d05c43c6f31 100644
@@ -22,7 +22,7 @@ quiet_cmd_modules_install = INSTALL $@
       cmd_modules_install = \
     mkdir -p $(2) ; \
     cp $@ $(2) ; \
-    $(mod_strip_cmd) $(2)/$(notdir $@) ; \
+    $(mod_strip_cmd) $(2)/$(notdir $@) && \
     $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \
     $(mod_compress_cmd) $(2)/$(notdir $@)
 
--
Quoted 2 lines

2.21.0.360.g471c308f928-goog

--
Best Regards
Masahiro Yamada

#2 lore raw

Hi,

Quoted 13 lines · Masahiro Yamada
Quoted 7 lines · Douglas Anderson

If the call to strip returns an error code then it makes sense for the build to fail. Currently we'll just chug along and ship unstripped modules.

Fixes e2a666d52b48 ("kbuild: sign the modules at install time")

Did you see this problem in the latest kernel?

Quoted 7 lines

Since commit q,
$(call cmd,...) is run with 'set -e'.

Any failure in a series of commands will let the build fail.

If you have the problem in old versions ( < 4.20),

Ah! I was in 4.19 when I saw the problem. I then confirmed that the code in mainline was the same and that the new version built fine with my patch, but I didn't go back and confirm the problem there.

OK, I just checked linux/master and can confirm there's no problem there. Sorry for the noise then...

I wonder if perhaps we should revert commit caf6fe91ddf6 ("modsign:
Abort modules_install when signing fails") then to be consistent?

Quoted 1 line

I do not mind this patch for linux-stable.

It's probably not worth it. In general I prefer linux-stable to be as just cherry-picks of mainline as much as possible. When it starts forking then future picks get harder. Sure in this case it's unlikely that someone will get tripped up by an "&&" vs a ";" when picking future changes, but given that it's not super urgent I guess I'd vote that we skip it.

-Doug
-Doug

#3 lore raw

Hi.

Quoted 30 lines · Doug Anderson

Hi,

Quoted 13 lines · Masahiro Yamada
Quoted 7 lines · Douglas Anderson

If the call to strip returns an error code then it makes sense for the build to fail. Currently we'll just chug along and ship unstripped modules.

Fixes e2a666d52b48 ("kbuild: sign the modules at install time")

Did you see this problem in the latest kernel?

Quoted 7 lines

Since commit q,
$(call cmd,...) is run with 'set -e'.

Any failure in a series of commands will let the build fail.

If you have the problem in old versions ( < 4.20),

Ah! I was in 4.19 when I saw the problem. I then confirmed that the code in mainline was the same and that the new version built fine with my patch, but I didn't go back and confirm the problem there.

Quoted 5 lines

OK, I just checked linux/master and can confirm there's no problem there. Sorry for the noise then...

I wonder if perhaps we should revert commit caf6fe91ddf6 ("modsign:
Abort modules_install when signing fails") then to be consistent?

Right.

If you send a patch, I will take it.

Quoted 8 lines
Quoted 1 line

I do not mind this patch for linux-stable.

It's probably not worth it. In general I prefer linux-stable to be as just cherry-picks of mainline as much as possible. When it starts forking then future picks get harder. Sure in this case it's unlikely that someone will get tripped up by an "&&" vs a ";" when picking future changes, but given that it's not super urgent I guess I'd vote that we skip it.

Agree.

Signature · 2 lines
Best Regards
Masahiro Yamada