Skip to content

kbuild: Use objtree for module signing key path#220

Merged
rene merged 1 commit intolf-edge:eve-kernel-amd64-nextfrom
rucoder:rucoder/fix-module-signing
Oct 16, 2025
Merged

kbuild: Use objtree for module signing key path#220
rene merged 1 commit intolf-edge:eve-kernel-amd64-nextfrom
rucoder:rucoder/fix-module-signing

Conversation

@rucoder
Copy link
Collaborator

@rucoder rucoder commented Oct 15, 2025

Upstreaming status

The patch is submitted upstream https://marc.info/?l=linux-kbuild&m=176054596327578&w=2

UPDATE: patch was applied to kbuild-next

Impact

Out-of-tree modules e.g. Hailo and ZFS are not signed but the build is not generation error so it was missed

Description

When building out-of-tree modules with CONFIG_MODULE_SIG_FORCE=y, module signing fails because the private key path uses $(srctree) while the public key path uses $(objtree). Since signing keys are generated in the build directory during kernel compilation, both paths should use $(objtree) for consistency.

This causes SSL errors like:
SSL error:02001002:system library:fopen:No such file or directory
sign-file: /kernel-src/certs/signing_key.pem

The issue occurs because:

  • sig-key uses: $(srctree)/certs/signing_key.pem (source tree)
  • cmd_sign uses: $(objtree)/certs/signing_key.x509 (build tree)

But both keys are generated in $(objtree) during the build.

This complements commit 25ff08a ('kbuild: Fix signing issue for external modules') which fixed the scripts path and public key path, but missed the private key path inconsistency.

Fixes out-of-tree module signing for configurations with separate source and build directories (e.g., O=/kernel-out).

When building out-of-tree modules with CONFIG_MODULE_SIG_FORCE=y,
module signing fails because the private key path uses $(srctree)
while the public key path uses $(objtree). Since signing keys are
generated in the build directory during kernel compilation, both
paths should use $(objtree) for consistency.

This causes SSL errors like:
  SSL error:02001002:system library:fopen:No such file or directory
  sign-file: /kernel-src/certs/signing_key.pem

The issue occurs because:
- sig-key uses: $(srctree)/certs/signing_key.pem (source tree)
- cmd_sign uses: $(objtree)/certs/signing_key.x509 (build tree)

But both keys are generated in $(objtree) during the build.

This complements commit 25ff08a ('kbuild: Fix signing issue for
external modules') which fixed the scripts path and public key path,
but missed the private key path inconsistency.

Fixes out-of-tree module signing for configurations with separate
source and build directories (e.g., O=/kernel-out).

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rucoder rucoder requested a review from rene October 15, 2025 16:44
@rene rene merged commit 3152b8f into lf-edge:eve-kernel-amd64-next Oct 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants