Skip to content

Commit c1ad12e

Browse files
arndbakpm00
authored andcommitted
kexec: fix KEXEC_FILE dependencies
The cleanup for the CONFIG_KEXEC Kconfig logic accidentally changed the 'depends on CRYPTO=y' dependency to a plain 'depends on CRYPTO', which causes a link failure when all the crypto support is in a loadable module and kexec_file support is built-in: x86_64-linux-ld: vmlinux.o: in function `__x64_sys_kexec_file_load': (.text+0x32e30a): undefined reference to `crypto_alloc_shash' x86_64-linux-ld: (.text+0x32e58e): undefined reference to `crypto_shash_update' x86_64-linux-ld: (.text+0x32e6ee): undefined reference to `crypto_shash_final' Both s390 and x86 have this problem, while ppc64 and riscv have the correct dependency already. On riscv, the dependency is only used for the purgatory, not for the kexec_file code itself, which may be a bit surprising as it means that with CONFIG_CRYPTO=m, it is possible to enable KEXEC_FILE but then the purgatory code is silently left out. Move this into the common Kconfig.kexec file in a way that is correct everywhere, using the dependency on CRYPTO_SHA256=y only when the purgatory code is available. This requires reversing the dependency between ARCH_SUPPORTS_KEXEC_PURGATORY and KEXEC_FILE, but the effect remains the same, other than making riscv behave like the other ones. On s390, there is an additional dependency on CRYPTO_SHA256_S390, which should technically not be required but gives better performance. Remove this dependency here, noting that it was not present in the initial Kconfig code but was brought in without an explanation in commit 7140688 ("s390/kexec_file: Add kexec_file_load system call"). [[email protected]: fix riscv build] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: 6af5138 ("x86/kexec: refactor for kernel/Kconfig.kexec") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Eric DeVolder <[email protected]> Tested-by: Eric DeVolder <[email protected]> Cc: Albert Ou <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David S. Miller <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Herbert Xu <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 4376807 commit c1ad12e

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

arch/powerpc/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,10 @@ config ARCH_SUPPORTS_KEXEC
608608
def_bool PPC_BOOK3S || PPC_E500 || (44x && !SMP)
609609

610610
config ARCH_SUPPORTS_KEXEC_FILE
611-
def_bool PPC64 && CRYPTO=y && CRYPTO_SHA256=y
611+
def_bool PPC64
612612

613613
config ARCH_SUPPORTS_KEXEC_PURGATORY
614-
def_bool KEXEC_FILE
614+
def_bool y
615615

616616
config ARCH_SELECTS_KEXEC_FILE
617617
def_bool y

arch/riscv/Kconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,7 @@ config ARCH_SELECTS_KEXEC_FILE
702702
select KEXEC_ELF
703703

704704
config ARCH_SUPPORTS_KEXEC_PURGATORY
705-
def_bool KEXEC_FILE
706-
depends on CRYPTO=y
707-
depends on CRYPTO_SHA256=y
705+
def_bool ARCH_SUPPORTS_KEXEC_FILE
708706

709707
config ARCH_SUPPORTS_CRASH_DUMP
710708
def_bool y

arch/s390/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ config ARCH_SUPPORTS_KEXEC
254254
def_bool y
255255

256256
config ARCH_SUPPORTS_KEXEC_FILE
257-
def_bool CRYPTO && CRYPTO_SHA256 && CRYPTO_SHA256_S390
257+
def_bool y
258258

259259
config ARCH_SUPPORTS_KEXEC_SIG
260260
def_bool MODULE_SIG_FORMAT
261261

262262
config ARCH_SUPPORTS_KEXEC_PURGATORY
263-
def_bool KEXEC_FILE
263+
def_bool y
264264

265265
config ARCH_SUPPORTS_CRASH_DUMP
266266
def_bool y

arch/x86/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,15 +2072,15 @@ config ARCH_SUPPORTS_KEXEC
20722072
def_bool y
20732073

20742074
config ARCH_SUPPORTS_KEXEC_FILE
2075-
def_bool X86_64 && CRYPTO && CRYPTO_SHA256
2075+
def_bool X86_64
20762076

20772077
config ARCH_SELECTS_KEXEC_FILE
20782078
def_bool y
20792079
depends on KEXEC_FILE
20802080
select HAVE_IMA_KEXEC if IMA
20812081

20822082
config ARCH_SUPPORTS_KEXEC_PURGATORY
2083-
def_bool KEXEC_FILE
2083+
def_bool y
20842084

20852085
config ARCH_SUPPORTS_KEXEC_SIG
20862086
def_bool y

kernel/Kconfig.kexec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ config KEXEC
3636
config KEXEC_FILE
3737
bool "Enable kexec file based system call"
3838
depends on ARCH_SUPPORTS_KEXEC_FILE
39+
depends on CRYPTO_SHA256=y || !ARCH_SUPPORTS_KEXEC_PURGATORY
3940
select KEXEC_CORE
4041
help
4142
This is new version of kexec system call. This system call is

0 commit comments

Comments
 (0)