All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Dimitri John Ledkov <dimitri.ledkov@canonical.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	linux-modules@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: detect depmod version to exclude new SHA3 module signing options
Date: Mon, 15 Jan 2024 12:45:33 +0000	[thread overview]
Message-ID: <ZaUo7ctf5H/qqqkG@shell.armlinux.org.uk> (raw)
In-Reply-To: <E1rNVlL-000qDm-Pg@rmk-PC.armlinux.org.uk>

Ping?

On Wed, Jan 10, 2024 at 10:24:43AM +0000, Russell King (Oracle) wrote:
> 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
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2024-01-15 12:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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) [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZaUo7ctf5H/qqqkG@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=dimitri.ledkov@canonical.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.