[PATCH v2] powerpc/kdump: pass dm-crypt keys to kdump kernel

Coiby Xu coxu at redhat.com
Thu Jan 8 21:32:55 AEDT 2026


On Wed, Jan 07, 2026 at 02:32:41PM +0530, Sourabh Jain wrote:
>
>
>On 06/01/26 13:10, Coiby Xu wrote:
>>CONFIG_CRASH_DM_CRYPT has been introduced to support LUKS-encrypted
>>device dump target by addressing two challenges [1],
>>  - Kdump kernel may not be able to decrypt the LUKS partition. For some
>>    machines, a system administrator may not have a chance to enter the
>>    password to decrypt the device in kdump initramfs after the 1st kernel
>>    crashes
>>
>>  - LUKS2 by default use the memory-hard Argon2 key derivation function
>>    which is quite memory-consuming compared to the limited memory reserved
>>    for kdump.
>>
>>To also enable this feature for PowerPC, we only need to let 1st kernel
>>build up the kernel command parameter dmcryptkeys as similar to
>>elfcorehdr to pass the memory address of the stored info of dm-crypt
>>keys to the kdump kernel.
>>
>>Note to avoid a building failure [2] caused by undeclared function
>>crash_load_dm_crypt_keys when CONFIG_CRASH_DUMP is not enabled,
>>realign the function declaration with CONFIG_CRASH_DM_CRYPT.
>>
>>[1] https://lore.kernel.org/all/20250502011246.99238-1-coxu@redhat.com/
>>[2] https://lore.kernel.org/oe-kbuild-all/202512272218.ghBaSjzO-lkp@intel.com/
>>
>>Cc: Thomas Staudt <tstaudt at de.ibm.com>
>>Cc: Arnaud Lefebvre <arnaud.lefebvre at clever-cloud.com>
>>Cc: Baoquan he <bhe at redhat.com>
>>Cc: Dave Young <dyoung at redhat.com>
>>Cc: Kairui Song <ryncsn at gmail.com>
>>Cc: Pingfan Liu <kernelfans at gmail.com>
>>Cc: Andrew Morton <akpm at linux-foundation.org>
>>Cc: Sourabh Jain <sourabhjain at linux.ibm.com>
>>Signed-off-by: Coiby Xu <coxu at redhat.com>
>>---
>>v2:
>>- fix double kfree issue [Sourabh]
>>- corretly kfree old modified_cmdline
>>- use imperative mood for commit message
>>- fix a compiling error caught by kernel test robot
>>
>>  arch/powerpc/include/asm/kexec.h |  3 ++-
>>  arch/powerpc/kexec/elf_64.c      | 27 ++++++++++++++++++++++++++-
>>  arch/powerpc/kexec/file_load.c   | 18 ++++++++++--------
>>  include/linux/crash_core.h       | 14 +++++++-------
>>  4 files changed, 45 insertions(+), 17 deletions(-)
>>
>>diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
>>index bd4a6c42a5f3..f3d098d543b4 100644
>>--- a/arch/powerpc/include/asm/kexec.h
>>+++ b/arch/powerpc/include/asm/kexec.h
>>@@ -80,7 +80,8 @@ struct kimage_arch {
>>  };
>>  char *setup_kdump_cmdline(struct kimage *image, char *cmdline,
>>-			  unsigned long cmdline_len);
>>+			  unsigned long cmdline_len,
>>+			  char *name, unsigned long addr);
>>  int setup_purgatory(struct kimage *image, const void *slave_code,
>>  		    const void *fdt, unsigned long kernel_load_addr,
>>  		    unsigned long fdt_load_addr);
>>diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c
>>index 5d6d616404cf..995d7e8e98e1 100644
>>--- a/arch/powerpc/kexec/elf_64.c
>>+++ b/arch/powerpc/kexec/elf_64.c
>>@@ -81,13 +81,38 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
>>  		/* Setup cmdline for kdump kernel case */
>>  		modified_cmdline = setup_kdump_cmdline(image, cmdline,
>>-						       cmdline_len);
>>+						       cmdline_len,
>>+						       "elfcorehdr",
>>+						       image->elf_load_addr);
>>  		if (!modified_cmdline) {
>>  			pr_err("Setting up cmdline for kdump kernel failed\n");
>>  			ret = -EINVAL;
>>  			goto out;
>>  		}
>>  		cmdline = modified_cmdline;
>>+		cmdline_len = strlen(cmdline) + 1;
>
>I have a limited understanding of the new dm-crypt keys, but the way they
>are loaded and the additional command-line options added for the kdump
>kernel look good to me.
>
>Feel free to add:
>Acked-by: Sourabh Jain <sourabhjain at linux.ibm.com>

Thanks for reviewing and acknowledging the patch!

-- 
Best regards,
Coiby



More information about the Linuxppc-dev mailing list