Skip to contentSkip to conversation

s390/kexec: Make KEXEC_SIG available when CONFIG_MODULES=n

PATCH RESEND Superseded Alexander Egorenkov 3 participants 4 messages Feb 9 – Feb 10

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 s390/kexec: Make KEXEC_SIG available when CONFIG_MODULES=n

The commit c8424e776b09 ("MODSIGN: Export module signature definitions") replaced the dependency of KEXEC_SIG on SYSTEM_DATA_VERIFICATION with the dependency on MODULE_SIG_FORMAT. This change disables KEXEC_SIG in s390 kernels built with MODULES=n if nothing else selects MODULE_SIG_FORMAT.

Furthermore, the signature verification in s390 kexec does not require MODULE_SIG_FORMAT because it requires only the struct module_signature and, therefore, does not depend on code in kernel/module_signature.c.

But making ARCH_SUPPORTS_KEXEC_SIG depend on SYSTEM_DATA_VERIFICATION is also incorrect because it makes KEXEC_SIG available on s390 only if some other arbitrary option (for instance a file system or device driver) selects it directly or indirectly.

To properly make KEXEC_SIG available for s390 kernels built with MODULES=y as well as MODULES=n _and_ also not depend on arbitrary options selecting SYSTEM_DATA_VERIFICATION, we set ARCH_SUPPORTS_KEXEC_SIG=y for s390 and select SYSTEM_DATA_VERIFICATION when KEXEC_SIG=y.

Fixes c8424e776b09 ("MODSIGN: Export module signature definitions")
---
 arch/s390/Kconfig    | 2 +-
 kernel/Kconfig.kexec | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/s390/Kconfig +1 -1
index c2c7bf974397..385c1052cf45 100644
@@ -313,7 +313,7 @@ config ARCH_SUPPORTS_KEXEC_FILE
 	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool MODULE_SIG_FORMAT
+	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_PURGATORY
 	def_bool y
kernel/Kconfig.kexec +1 -0
index 15632358bcf7..df97227cfca9 100644
@@ -50,6 +50,7 @@ config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on ARCH_SUPPORTS_KEXEC_SIG
 	depends on KEXEC_FILE
+	select SYSTEM_DATA_VERIFICATION if S390
 	help
 	  This option makes the kexec_file_load() syscall check for a valid
 	  signature of the kernel image. The image can still be loaded without
Signature · 1 line
2.51.0
#1 lore raw
Quoted 15 lines · Alexander Egorenkov

The commit c8424e776b09 ("MODSIGN: Export module signature definitions") replaced the dependency of KEXEC_SIG on SYSTEM_DATA_VERIFICATION with the dependency on MODULE_SIG_FORMAT. This change disables KEXEC_SIG in s390 kernels built with MODULES=n if nothing else selects MODULE_SIG_FORMAT.

Furthermore, the signature verification in s390 kexec does not require MODULE_SIG_FORMAT because it requires only the struct module_signature and, therefore, does not depend on code in kernel/module_signature.c.

But making ARCH_SUPPORTS_KEXEC_SIG depend on SYSTEM_DATA_VERIFICATION is also incorrect because it makes KEXEC_SIG available on s390 only if some other arbitrary option (for instance a file system or device driver) selects it directly or indirectly.

Quoted 4 lines

To properly make KEXEC_SIG available for s390 kernels built with MODULES=y as well as MODULES=n _and_ also not depend on arbitrary options selecting SYSTEM_DATA_VERIFICATION, we set ARCH_SUPPORTS_KEXEC_SIG=y for s390 and select SYSTEM_DATA_VERIFICATION when KEXEC_SIG=y.

Thanks for fixing the issue.

Seems the background and change is a little twisting, and selecting SYSTEM_DATA_VERIFICATION will cause a bunch of verification feature selected. While the change is only s390 related, request s390 expert to have look at this change. If no concern from s390 developer, I am also fine to it.

Thanks
Baoquan

Quoted 36 lines
Fixes c8424e776b09 ("MODSIGN: Export module signature definitions")
---
 arch/s390/Kconfig    | 2 +-
 kernel/Kconfig.kexec | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/s390/Kconfig +1 -1
index c2c7bf974397..385c1052cf45 100644
@@ -313,7 +313,7 @@ config ARCH_SUPPORTS_KEXEC_FILE
 	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool MODULE_SIG_FORMAT
+	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_PURGATORY
 	def_bool y
kernel/Kconfig.kexec +1 -0
index 15632358bcf7..df97227cfca9 100644
@@ -50,6 +50,7 @@ config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on ARCH_SUPPORTS_KEXEC_SIG
 	depends on KEXEC_FILE
+	select SYSTEM_DATA_VERIFICATION if S390
 	help
 	  This option makes the kexec_file_load() syscall check for a valid
 	  signature of the kernel image. The image can still be loaded without
Signature · 1 line
2.51.0
maintainer
#2 lore raw
Quoted 28 lines · Baoquan He
Quoted 15 lines · Alexander Egorenkov

The commit c8424e776b09 ("MODSIGN: Export module signature definitions") replaced the dependency of KEXEC_SIG on SYSTEM_DATA_VERIFICATION with the dependency on MODULE_SIG_FORMAT. This change disables KEXEC_SIG in s390 kernels built with MODULES=n if nothing else selects MODULE_SIG_FORMAT.

Furthermore, the signature verification in s390 kexec does not require MODULE_SIG_FORMAT because it requires only the struct module_signature and, therefore, does not depend on code in kernel/module_signature.c.

But making ARCH_SUPPORTS_KEXEC_SIG depend on SYSTEM_DATA_VERIFICATION is also incorrect because it makes KEXEC_SIG available on s390 only if some other arbitrary option (for instance a file system or device driver) selects it directly or indirectly.

Quoted 4 lines

To properly make KEXEC_SIG available for s390 kernels built with MODULES=y as well as MODULES=n _and_ also not depend on arbitrary options selecting SYSTEM_DATA_VERIFICATION, we set ARCH_SUPPORTS_KEXEC_SIG=y for s390 and select SYSTEM_DATA_VERIFICATION when KEXEC_SIG=y.

Thanks for fixing the issue.

Seems the background and change is a little twisting, and selecting SYSTEM_DATA_VERIFICATION will cause a bunch of verification feature selected. While the change is only s390 related, request s390 expert to have look at this change. If no concern from s390 developer, I am also fine to it.

...

Quoted 11 lines
Quoted 11 lines
arch/s390/Kconfig +1 -1
index c2c7bf974397..385c1052cf45 100644
@@ -313,7 +313,7 @@ config ARCH_SUPPORTS_KEXEC_FILE
 	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool MODULE_SIG_FORMAT
+	def_bool y
 
Quoted 11 lines

kernel/Kconfig.kexec config KEXEC_SIG · line 53

Quoted 11 lines
arch/s390/Kconfig +0 -0
 config ARCH_SUPPORTS_KEXEC_PURGATORY
 	def_bool y
kernel/Kconfig.kexec +1 -0
index 15632358bcf7..df97227cfca9 100644
@@ -50,6 +50,7 @@ config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on ARCH_SUPPORTS_KEXEC_SIG
 	depends on KEXEC_FILE
+	select SYSTEM_DATA_VERIFICATION if S390

Alexander, would it make sense to move this to arch/s390/Kconfig and add something like

select SYSTEM_DATA_VERIFICATION if KEXEC_SIG

instead? This would have the slight advantage to keep arch specifics out of common code Kconfig.

#3 lore raw
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
arch/s390/Kconfig +1 -1
index c2c7bf974397..385c1052cf45 100644
@@ -313,7 +313,7 @@ config ARCH_SUPPORTS_KEXEC_FILE
 	def_bool y
 
 config ARCH_SUPPORTS_KEXEC_SIG
-	def_bool MODULE_SIG_FORMAT
+	def_bool y
 
Quoted 11 lines

kernel/Kconfig.kexec config KEXEC_SIG · line 53

Quoted 11 lines
arch/s390/Kconfig +0 -0
 config ARCH_SUPPORTS_KEXEC_PURGATORY
 	def_bool y
kernel/Kconfig.kexec +1 -0
index 15632358bcf7..df97227cfca9 100644
@@ -50,6 +50,7 @@ config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on ARCH_SUPPORTS_KEXEC_SIG
 	depends on KEXEC_FILE
+	select SYSTEM_DATA_VERIFICATION if S390

Alexander, would it make sense to move this to arch/s390/Kconfig and add something like

Quoted 4 lines

select SYSTEM_DATA_VERIFICATION if KEXEC_SIG

instead? This would have the slight advantage to keep arch specifics out of common code Kconfig.

That's even better, what i was actually looking for. And works as expected too.

Thanks, Heiko.