diff mbox series

kbuild: Fix signing issue for external modules

Message ID be81c0ac-fac7-44bf-9062-018bf47e7bbe@secunet.com (mailing list archive)
State New
Headers show
Series kbuild: Fix signing issue for external modules | expand

Commit Message

Torsten Hilbrich Jan. 10, 2025, 2 p.m. UTC
When running the sign script the kernel is within the source directory
of external modules. This caused issues when the kernel uses relative
paths, like:

make[5]: Entering directory '/build/client/devel/kernel/work/linux-2.6'
make[6]: Entering directory '/build/client/devel/addmodules/vtx/work/vtx'
   INSTALL /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+/extra/vtx.ko
   SIGN    /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+/extra/vtx.ko
/bin/sh: 1: scripts/sign-file: not found
   DEPMOD  /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+

Working around it by using absolute pathes here.

Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
Link: https://lore.kernel.org/linux-kbuild/302dedfd-af8b-43cc-99cf-3a3f7b34b714@secunet.com
Issue: CLIENT-32662
---
  scripts/Makefile.modinst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Masahiro Yamada Jan. 10, 2025, 3:33 p.m. UTC | #1
On Fri, Jan 10, 2025 at 11:00 PM Torsten Hilbrich
<torsten.hilbrich@secunet.com> wrote:
>
> When running the sign script the kernel is within the source directory
> of external modules. This caused issues when the kernel uses relative
> paths, like:
>
> make[5]: Entering directory '/build/client/devel/kernel/work/linux-2.6'
> make[6]: Entering directory '/build/client/devel/addmodules/vtx/work/vtx'
>    INSTALL /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+/extra/vtx.ko
>    SIGN    /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+/extra/vtx.ko
> /bin/sh: 1: scripts/sign-file: not found
>    DEPMOD  /build/client/devel/addmodules/vtx/_/lib/modules/6.13.0-devel+
>
> Working around it by using absolute pathes here.
>
> Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
> Link: https://lore.kernel.org/linux-kbuild/302dedfd-af8b-43cc-99cf-3a3f7b34b714@secunet.com
> Issue: CLIENT-32662

Please drop this tag.

Instead, your Signed-off-by tag is mandatory.





> ---
>   scripts/Makefile.modinst | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
> index f97c9926ed31..1628198f3e83 100644
> --- a/scripts/Makefile.modinst
> +++ b/scripts/Makefile.modinst
> @@ -105,7 +105,7 @@ else
>   sig-key := $(CONFIG_MODULE_SIG_KEY)
>   endif
>   quiet_cmd_sign = SIGN    $@
> -      cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
> +      cmd_sign = $(objtree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" $(objtree)/certs/signing_key.x509 $@ \
>                    $(if $(KBUILD_EXTMOD),|| true)
>
>   ifeq ($(sign-only),)
> --
> 2.39.5
>
>
>
diff mbox series

Patch

diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index f97c9926ed31..1628198f3e83 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -105,7 +105,7 @@  else
  sig-key := $(CONFIG_MODULE_SIG_KEY)
  endif
  quiet_cmd_sign = SIGN    $@
-      cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
+      cmd_sign = $(objtree)/scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" $(objtree)/certs/signing_key.x509 $@ \
                   $(if $(KBUILD_EXTMOD),|| true)
  
  ifeq ($(sign-only),)