From: Jan Luebbe Date: Tue, 31 Jan 2023 08:43:23 +0000 (+0100) Subject: kbuild: modinst: Fix build error when CONFIG_MODULE_SIG_KEY is a PKCS#11 URI X-Git-Tag: baikal/aarch64/sdk6.1~118 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=a737ed98e2f656f83f48c7af1f09be26c51ba2b9;p=kernel.git kbuild: modinst: Fix build error when CONFIG_MODULE_SIG_KEY is a PKCS#11 URI [ Upstream commit 22e46f6480e83bcf49b6d5e6b66c81872c97a902 ] When CONFIG_MODULE_SIG_KEY is PKCS#11 URI (pkcs11:*), signing of modules fails: scripts/sign-file sha256 /.../linux/pkcs11:token=foo;object=bar;pin-value=1111 certs/signing_key.x509 /.../kernel/crypto/tcrypt.ko Usage: scripts/sign-file [-dp] [] scripts/sign-file -s [] First, we need to avoid adding the $(srctree)/ prefix to the URL. Second, since the kconfig string values no longer include quotes, we need to add them again when passing a PKCS#11 URI to sign-file. This avoids splitting by the shell if the URI contains semicolons. Fixes: 4e61f8a037cd ("kbuild: stop using config_filename in scripts/Makefile.modsign") Fixes: d210c61d23dc ("kbuild: do not quote string values in include/config/auto.conf") Signed-off-by: Jan Luebbe Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index a4c987c23750f..10df89b9ef679 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -66,9 +66,13 @@ endif # Don't stop modules_install even if we can't sign external modules. # ifeq ($(CONFIG_MODULE_SIG_ALL),y) +ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),) sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY) +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 = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \ $(if $(KBUILD_EXTMOD),|| true) else quiet_cmd_sign :=