public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: detect depmod version to exclude new SHA3 module signing options
@ 2024-01-10 10:24 Russell King (Oracle)
  2024-01-15 12:45 ` Russell King (Oracle)
  2024-01-21 19:54 ` Linus Torvalds
  0 siblings, 2 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-01-10 10:24 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Dimitri John Ledkov, Linus Torvalds, Luis Chamberlain,
	linux-modules, linux-kbuild

When using the SHA3 module signing options, kmod 28 segfaults during
"make modules_install" on the build host.

When running depmod under gdb, it reports:

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-vec.S:133

Therefore, SHA3 can't be used on a build system with an old kmod. Add
a script to retrieve the version of depmod, and use that in the Kconfig
to determine whether the SHA3 options should be made available.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
I don't know what the minimum requirement is for SHA3 to work, so I have
chosen a minimum of version 29 for the purposes of this patch.
---
 kernel/module/Kconfig     |  8 ++++++++
 scripts/Kconfig.include   |  3 +++
 scripts/depmod-version.sh | 11 +++++++++++
 3 files changed, 22 insertions(+)
 create mode 100755 scripts/depmod-version.sh

diff --git a/kernel/module/Kconfig b/kernel/module/Kconfig
index 0ea1b2970a23..d2ba454026a9 100644
--- a/kernel/module/Kconfig
+++ b/kernel/module/Kconfig
@@ -223,6 +223,11 @@ config MODULE_SIG_ALL
 	  Sign all modules during make modules_install. Without this option,
 	  modules must be signed manually, using the scripts/sign-file tool.
 
+config DEPMOD_VERSION
+	int
+	default	$(depmod-version)
+	default 0
+
 comment "Do not forget to sign required modules with scripts/sign-file"
 	depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL
 
@@ -250,14 +255,17 @@ config MODULE_SIG_SHA512
 
 config MODULE_SIG_SHA3_256
 	bool "Sign modules with SHA3-256"
+	depends on DEPMOD_VERSION > 28
 	select CRYPTO_SHA3
 
 config MODULE_SIG_SHA3_384
 	bool "Sign modules with SHA3-384"
+	depends on DEPMOD_VERSION > 28
 	select CRYPTO_SHA3
 
 config MODULE_SIG_SHA3_512
 	bool "Sign modules with SHA3-512"
+	depends on DEPMOD_VERSION > 28
 	select CRYPTO_SHA3
 
 endchoice
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 5a84b6443875..052f581c86da 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -63,3 +63,6 @@ ld-version := $(shell,set -- $(ld-info) && echo $2)
 cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
 m32-flag := $(cc-option-bit,-m32)
 m64-flag := $(cc-option-bit,-m64)
+
+# depmod version
+depmod-version := $(shell,$(srctree)/scripts/depmod-version.sh)
diff --git a/scripts/depmod-version.sh b/scripts/depmod-version.sh
new file mode 100755
index 000000000000..32a8a6f6b737
--- /dev/null
+++ b/scripts/depmod-version.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+: ${DEPMOD:=depmod}
+
+# legacy behavior: "depmod" in /sbin, no /sbin in PATH
+PATH="$PATH:/sbin"
+
+LC_ALL=C "$DEPMOD" --version | sed -n '1s/kmod version //p'
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-21 19:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 10:24 [PATCH] kbuild: detect depmod version to exclude new SHA3 module signing options Russell King (Oracle)
2024-01-15 12:45 ` Russell King (Oracle)
2024-01-15 13:09   ` Dimitri John Ledkov
2024-01-15 13:48     ` Russell King (Oracle)
2024-01-15 14:25     ` Russell King (Oracle)
2024-01-15 14:39       ` Dimitri John Ledkov
2024-01-15 14:57         ` Russell King (Oracle)
2024-01-16 22:35       ` Lucas De Marchi
2024-01-17  0:21         ` Masahiro Yamada
2024-01-21 19:54 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox