From: Coiby Xu <coiby.xu@gmail.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: kexec@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <baoquan.he@linux.dev>,
Dave Young <ruirui.yang@linux.dev>,
Pratyush Yadav <pratyush@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 8/9] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported
Date: Mon, 31 Aug 2026 21:34:30 +0800 [thread overview]
Message-ID: <apWAp7FamnxneZ3v@Rk> (raw)
In-Reply-To: <38e371e9-1f0a-4e9f-a5e1-0b9d696379da@linux.ibm.com>
On Sun, Aug 30, 2026 at 01:28:59PM +0530, Sourabh Jain wrote:
>
>
>On 28/08/26 14:18, Coiby Xu wrote:
>>If crash hotplug is supported, dm-crypt keys saved to reserved memory
>>will be taken care of automatically. Thus it doesn't make sense to use
>>configfs/crash_dm_crypt_key/reuse. Not reserving
>>image->dm_crypt_keys_addr makes it implicitly to disallow using this
>>API. Currently x86_64 and ppc64le have implemented crash hotplug
>>feature.
>>
>>Also update the doc accordingly. Note two doc issues are fixed as well.
>>
>>Fixes: 9ebfa8dcaea7 ("crash_dump: reuse saved dm crypt keys for CPU/memory hot-plugging")
>>Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
>>---
>> Documentation/admin-guide/kdump/kdump.rst | 16 ++++++++++------
>> kernel/crash_dump_dm_crypt.c | 13 +++++++++----
>> 2 files changed, 19 insertions(+), 10 deletions(-)
>>
>>diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst
>>index 7587caadbae1..0bf2eb100a05 100644
>>--- a/Documentation/admin-guide/kdump/kdump.rst
>>+++ b/Documentation/admin-guide/kdump/kdump.rst
>>@@ -577,9 +577,10 @@ with /sys/kernel/config/crash_dm_crypt_keys for setup,
>> 1. Tell the first kernel what logon keys are needed to unlock the disk volumes,
>> # Add key #1
>>- mkdir /sys/kernel/config/crash_dm_crypt_keys/7d26b7b4-e342-4d2d-b660-7426b0996720
>>+ VOL1_UUID=7d26b7b4-e342-4d2d-b660-7426b0996720
>>+ mkdir /sys/kernel/config/crash_dm_crypt_keys/$VOL1_UUID
>> # Add key #1's description
>>- echo cryptsetup:7d26b7b4-e342-4d2d-b660-7426b0996720 > /sys/kernel/config/crash_dm_crypt_keys/description
>>+ echo cryptsetup:$VOL1_UUID > /sys/kernel/config/crash_dm_crypt_keys/$VOL1_UUID/description
>> # how many keys do we have now?
>> cat /sys/kernel/config/crash_dm_crypt_keys/count
>>@@ -591,15 +592,18 @@ with /sys/kernel/config/crash_dm_crypt_keys for setup,
>> cat /sys/kernel/config/crash_dm_crypt_keys/count
>> 2
>>- # To support CPU/memory hot-plugging, reuse keys already saved to reserved
>>- # memory
>>- echo true > /sys/kernel/config/crash_dm_crypt_key/reuse
>>-
>> 2. Load the dump-capture kernel
>> 3. After the dump-capture kerne get booted, restore the keys to user keyring
>> echo yes > /sys/kernel/crash_dm_crypt_keys/restore
>>+For CPU/memory hot-plugging, you can reuse keys already saved to reserved
>>+memory before reloading the kdump image,
>>+ echo true > /sys/kernel/config/crash_dm_crypt_keys/reuse
>>+
>>+Note if crash hotplug is supported, this API is totally unnecessary thus will
>>+be disabled automatically.
>>+
>> Contact
>> =======
>>diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c
>>index b7629174e4db..3aaa0f9c3117 100644
>>--- a/kernel/crash_dump_dm_crypt.c
>>+++ b/kernel/crash_dump_dm_crypt.c
>>@@ -324,7 +324,7 @@ static ssize_t config_keys_reuse_store(struct config_item *item,
>> r = -EINVAL;
>> if (!kexec_crash_image || !kexec_crash_image->dm_crypt_keys_addr) {
>>- pr_debug("dm-crypt keys haven't be saved to crash-reserved memory\n");
>>+ pr_debug("dm-crypt keys haven't be saved to crash-reserved memory or crash hotplug supported\n");
>
>Nit: the above line is more than 100 characters. There is no
>complaint from checkpatch, but I feel we should reduce it to
>below 100 characters.
Thanks for the reminder! Documentation/process/coding-style.rst
explicitly states,
However, never break user-visible strings such as printk messages because
that breaks the ability to grep for them.
In fact, scripts/checkpatch.pl will issue a SPLIT_STRING warning if we
break the user-visible strings. So I think this is accepted unless
kexec/kdump subsystem has a hard column limit.
>
>Also, I checked that we don't have pr_fmt defined for this file,
>but we do have pr_debug and other pr_* calls. See if defining
>pr_fmt helps reduce the character count in the above line.
If I'm not mistaken, pr_fmt only adds a prefix. So I don't think it will
help reduce the character count in this particular case.
>
>But the overall idea of handling crash hotplug support with
>crash dm-crypt looks good to me. So feel free to add:
>
>Reviewed-by: Sourabh Jain sourabhjain@linux.ibm.com
Thanks for reviewing and ack'ing the patch!
>
>Thanks,
>Sourabh Jain
>
>
>> goto unlock;
>> }
>>@@ -519,9 +519,9 @@ int crash_load_dm_crypt_keys(struct kimage *image)
>> void kexec_file_post_load_cleanup_dm_crypt(struct kimage *image)
>> {
>> /*
>>- * For CPU/memory hot-plugging, the kdump image will be reloaded. Prevent
>>- * keys_header from being cleaned up during unloading when
>>- * is_dm_key_reused=true
>>+ * For CPU/memory hot-plugging without CONFIG_CRASH_HOTPLUG, the whole kdump
>>+ * image will be reloaded. Prevent keys_header from being cleaned up during
>>+ * unloading when is_dm_key_reused=true
>> */
>> if (!is_dm_key_reused) {
>> kfree_sensitive(keys_header);
>>@@ -532,6 +532,11 @@ void kexec_file_post_load_cleanup_dm_crypt(struct kimage *image)
>> mutex_unlock(&config_keys_subsys.su_mutex);
>> mutex_acquired = false;
>> }
>>+
>>+#ifdef CONFIG_CRASH_HOTPLUG
>>+ if (image->hotplug_support)
>>+ image->dm_crypt_keys_addr = 0;
>>+#endif
>> }
>> static int __init configfs_dmcrypt_keys_init(void)
>
--
Best regards,
Coiby
next prev parent reply other threads:[~2026-08-31 13:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 8:48 [PATCH v4 0/9] Bug fixes and enhancements for kdump LUKS support Coiby Xu
2026-08-28 8:48 ` [PATCH v4 1/9] crash_dump: Fix potential double free and UAF of keys_header Coiby Xu
2026-08-30 6:30 ` Sourabh Jain
2026-08-31 13:39 ` Coiby Xu
2026-08-30 7:07 ` Sourabh Jain
2026-09-09 0:31 ` Coiby Xu
2026-08-31 7:39 ` Jinjie Ruan
2026-08-31 13:44 ` Coiby Xu
2026-09-01 1:36 ` Jinjie Ruan
2026-09-02 12:53 ` Coiby Xu
2026-08-28 8:48 ` [PATCH v4 2/9] crash_dump: Disallow writing to dm-crypt configfs during kexec_file_load syscall Coiby Xu
2026-08-29 7:02 ` Sourabh Jain
2026-08-29 12:17 ` Coiby Xu
2026-08-30 5:37 ` Sourabh Jain
2026-09-06 12:18 ` Coiby Xu
2026-08-28 8:48 ` [PATCH v4 3/9] crash_dump: Read the number of dm-crypt keys from reserved memory Coiby Xu
2026-08-30 7:19 ` Sourabh Jain
2026-08-31 13:45 ` Coiby Xu
2026-08-28 8:48 ` [PATCH v4 4/9] crash_dump: Free temporary dm-crypt keys_header buffer in kdump kernel Coiby Xu
2026-08-28 8:48 ` [PATCH v4 5/9] crash_dump: Only use kexec_dprintk during the kexec_file_load syscall Coiby Xu
2026-08-28 8:48 ` [PATCH v4 6/9] crash_dump: Improve readability of config_keys_restore_store Coiby Xu
2026-08-28 8:48 ` [PATCH v4 7/9] crash_dump: Check the function return codes in restore_dm_crypt_keys_to_thread_keyring Coiby Xu
2026-08-28 8:48 ` [PATCH v4 8/9] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported Coiby Xu
2026-08-30 7:58 ` Sourabh Jain
2026-08-31 13:34 ` Coiby Xu [this message]
2026-08-28 8:48 ` [PATCH v4 9/9] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list Coiby Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apWAp7FamnxneZ3v@Rk \
--to=coiby.xu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=corbet@lwn.net \
--cc=kexec@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=sourabhjain@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.