Re: [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported
Coiby Xu <[email protected]>
| Newsgroups | org.infradead.lists.kexec,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aoV8HkBNGRclxMPl@Rk> |
On Sun, Aug 09, 2026 at 05:36:50PM +0530, Sourabh Jain wrote:
>
>
>On 06/08/26 11:03, Coiby Xu wrote:
>>On Wed, Aug 05, 2026 at 05:39:28PM +0530, Sourabh Jain wrote:
>>>
>>>
>>>On 29/07/26 09:06, 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. Reserving image->dm_crypt_keys_addr
>>>>is also unnecessary. 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 <[email protected]>
>>>>---
>>>>Â Documentation/admin-guide/kdump/kdump.rst | 16 ++++++++++------
>>>> kernel/crash_dump_dm_crypt.c             | 23 ++++++++++++++++++++---
>>>>Â 2 files changed, 30 insertions(+), 9 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 b5b78656cf06..46d6b31c3ca4 100644
>>>>--- a/kernel/crash_dump_dm_crypt.c
>>>>+++ b/kernel/crash_dump_dm_crypt.c
>>>>@@ -310,6 +310,15 @@ static ssize_t
>>>>config_keys_reuse_show(struct config_item *item, char *page)
>>>>Â Â Â Â return sysfs_emit(page, "%d\n", is_dm_key_reused);
>>>>Â }
>>>>+static bool crash_hotplug_support(struct kimage *image)
>>>>+{
>>>>+#ifdef CONFIG_CRASH_HOTPLUG
>>>>+Â Â Â return image->hotplug_support;
>>>
>>>I don't think it is good idea to access kexec_crash_image
>>>properties without
>>>holding the kexec lock.
>>
>>Thanks for raising the concern! Let's discuss this issue in [PATCH
>>v3 03/10].
>>
>>>
>>>Also, would it make sense to move this API somewhere else?
>>
>>Can you help me understand why to move this API? Is it because using
>>ifdef in .c file is discouraged?
>
>This API is used to verify crash hotplug support, which is not
>directly related to crash_dm_crypt_keys.
>It also seems to be generally useful.
>
>- Sourabh Jain
Thanks for the clarification! After trying to make use of existing
crash_check_hotplug_support API in kernel/crash_core.c, I realize there
is no need to explicitly disallow configfs/crash_dm_crypt_key/reuse.
Because image->dm_crypt_keys_addr will be set to 0 when crash hotplug is
supported. Thus in fact the reuse API has already been implicitly
disallowed. So I will drop the unnecessary crash_hotplug_support
function in next version.
--
Best regards,
Coiby