Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash_dump/dm-crypt: don't print in arch-specific code

Patch series "kdump: Enable LUKS-encrypted dump target support in ARM64
and PowerPC", v5.

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 ARM64 and PowerPC, we need to add a device
tree property dmcryptkeys [2] as similar to elfcorehdr to pass the memory
address of the stored info of dm-crypt keys to the kdump kernel.


This patch (of 3):

When the vmcore dumping target is not a LUKS-encrypted target, it's
expected that there is no dm-crypt key thus no need to return -ENOENT.
Also print more logs in crash_load_dm_crypt_keys. The benefit is
arch-specific code can be more succinct.

Link: https://lkml.kernel.org/r/20260225060347.718905-1-coxu@redhat.com
Link: https://lkml.kernel.org/r/20260225060347.718905-2-coxu@redhat.com
Link: https://lore.kernel.org/all/20250502011246.99238-1-coxu@redhat.com/ [1]
Link: https://github.com/devicetree-org/dt-schema/pull/181 [2]
Signed-off-by: Coiby Xu <coxu@redhat.com>
Suggested-by: Will Deacon <will@kernel.org>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Arnaud Lefebvre <arnaud.lefebvre@clever-cloud.com>
Cc: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Cc: Dave Young <dyoung@redhat.com>
Cc: Kairui Song <ryncsn@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Pingfan Liu <kernelfans@gmail.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Thomas Staudt <tstaudt@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Coiby Xu and committed by
Andrew Morton
03738dd1 d01684a2

+6 -7
+1 -5
arch/x86/kernel/kexec-bzimage64.c
··· 525 525 if (ret) 526 526 return ERR_PTR(ret); 527 527 ret = crash_load_dm_crypt_keys(image); 528 - if (ret == -ENOENT) { 529 - kexec_dprintk("No dm crypt key to load\n"); 530 - } else if (ret) { 531 - pr_err("Failed to load dm crypt keys\n"); 528 + if (ret) 532 529 return ERR_PTR(ret); 533 - } 534 530 if (image->dm_crypt_keys_addr && 535 531 cmdline_len + MAX_ELFCOREHDR_STR_LEN + MAX_DMCRYPTKEYS_STR_LEN > 536 532 header->cmdline_size) {
+5 -2
kernel/crash_dump_dm_crypt.c
··· 415 415 416 416 if (key_count <= 0) { 417 417 kexec_dprintk("No dm-crypt keys\n"); 418 - return -ENOENT; 418 + return 0; 419 419 } 420 420 421 421 if (!is_dm_key_reused) { 422 422 image->dm_crypt_keys_addr = 0; 423 423 r = build_keys_header(); 424 - if (r) 424 + if (r) { 425 + pr_err("Failed to build dm-crypt keys header, ret=%d\n", r); 425 426 return r; 427 + } 426 428 } 427 429 428 430 kbuf.buffer = keys_header; ··· 435 433 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; 436 434 r = kexec_add_buffer(&kbuf); 437 435 if (r) { 436 + pr_err("Failed to call kexec_add_buffer, ret=%d\n", r); 438 437 kvfree((void *)kbuf.buffer); 439 438 return r; 440 439 }