* [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported [not found] <20260729033654.311541-1-coiby.xu@gmail.com> @ 2026-07-29 3:36 ` Coiby Xu 2026-08-05 12:09 ` Sourabh Jain 2026-07-29 3:36 ` [PATCH v3 10/10] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list Coiby Xu 1 sibling, 1 reply; 5+ messages in thread From: Coiby Xu @ 2026-07-29 3:36 UTC (permalink / raw) To: kexec Cc: Andrew Morton, Sourabh Jain, Baoquan He, Dave Young, Pratyush Yadav, Mike Rapoport, Pasha Tatashin, Jonathan Corbet, Shuah Khan, Coiby Xu, open list:DOCUMENTATION, open list 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 <coiby.xu@gmail.com> --- 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; +#else + return false; +#endif +} + static ssize_t config_keys_reuse_store(struct config_item *item, const char *page, size_t count) { @@ -317,6 +326,11 @@ static ssize_t config_keys_reuse_store(struct config_item *item, bool val; int r; + if (kexec_crash_image && crash_hotplug_support(kexec_crash_image)) { + pr_debug("Crash hotplug supported\n"); + return -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"); return -EINVAL; @@ -513,9 +527,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); @@ -526,6 +540,9 @@ void kexec_file_post_load_cleanup_dm_crypt(struct kimage *image) mutex_unlock(&config_keys_subsys.su_mutex); mutex_acquired = false; } + + if (crash_hotplug_support(image)) + image->dm_crypt_keys_addr = 0; } static int __init configfs_dmcrypt_keys_init(void) -- 2.55.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported 2026-07-29 3:36 ` [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported Coiby Xu @ 2026-08-05 12:09 ` Sourabh Jain 2026-08-06 5:33 ` Coiby Xu 0 siblings, 1 reply; 5+ messages in thread From: Sourabh Jain @ 2026-08-05 12:09 UTC (permalink / raw) To: Coiby Xu, kexec Cc: Andrew Morton, Baoquan He, Dave Young, Pratyush Yadav, Mike Rapoport, Pasha Tatashin, Jonathan Corbet, Shuah Khan, Coiby Xu, open list:DOCUMENTATION, open list 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 <coiby.xu@gmail.com> > --- > 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. Also, would it make sense to move this API somewhere else? - Sourabh Jain > +#else > + return false; > +#endif > +} > + > static ssize_t config_keys_reuse_store(struct config_item *item, > const char *page, size_t count) > { > @@ -317,6 +326,11 @@ static ssize_t config_keys_reuse_store(struct config_item *item, > bool val; > int r; > > + if (kexec_crash_image && crash_hotplug_support(kexec_crash_image)) { > + pr_debug("Crash hotplug supported\n"); > + return -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"); > return -EINVAL; > @@ -513,9 +527,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); > @@ -526,6 +540,9 @@ void kexec_file_post_load_cleanup_dm_crypt(struct kimage *image) > mutex_unlock(&config_keys_subsys.su_mutex); > mutex_acquired = false; > } > + > + if (crash_hotplug_support(image)) > + image->dm_crypt_keys_addr = 0; > } > > static int __init configfs_dmcrypt_keys_init(void) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported 2026-08-05 12:09 ` Sourabh Jain @ 2026-08-06 5:33 ` Coiby Xu 0 siblings, 0 replies; 5+ messages in thread From: Coiby Xu @ 2026-08-06 5:33 UTC (permalink / raw) To: Sourabh Jain Cc: kexec, Andrew Morton, Baoquan He, Dave Young, Pratyush Yadav, Mike Rapoport, Pasha Tatashin, Jonathan Corbet, Shuah Khan, Coiby Xu, open list:DOCUMENTATION, open list 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 <coiby.xu@gmail.com> >>--- >> 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? > >- Sourabh Jain [...] -- Best regards, Coiby ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 10/10] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list [not found] <20260729033654.311541-1-coiby.xu@gmail.com> 2026-07-29 3:36 ` [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported Coiby Xu @ 2026-07-29 3:36 ` Coiby Xu 2026-08-05 12:10 ` Sourabh Jain 1 sibling, 1 reply; 5+ messages in thread From: Coiby Xu @ 2026-07-29 3:36 UTC (permalink / raw) To: kexec Cc: Andrew Morton, Sourabh Jain, Baoquan He, Dave Young, Pratyush Yadav, Mike Rapoport, Pasha Tatashin, Jonathan Corbet, Shuah Khan, Coiby Xu, Rob Herring (Arm), open list:DOCUMENTATION, open list The encrypted dump target support is now extended to arm64 and ppc64le. Fixes: e3a84be1ec2f ("arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel") Reported-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Coiby Xu <coiby.xu@gmail.com> --- Documentation/admin-guide/kdump/kdump.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst index 0bf2eb100a05..36ad6125c670 100644 --- a/Documentation/admin-guide/kdump/kdump.rst +++ b/Documentation/admin-guide/kdump/kdump.rst @@ -572,8 +572,8 @@ Write the dump file to encrypted disk volume ============================================ CONFIG_CRASH_DM_CRYPT can be enabled to support saving the dump file to an -encrypted disk volume (only x86_64 supported for now). User space can interact -with /sys/kernel/config/crash_dm_crypt_keys for setup, +encrypted disk volume (only x86_64, arm64, ppc64le supported for now). User +space can interact 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 -- 2.55.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 10/10] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list 2026-07-29 3:36 ` [PATCH v3 10/10] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list Coiby Xu @ 2026-08-05 12:10 ` Sourabh Jain 0 siblings, 0 replies; 5+ messages in thread From: Sourabh Jain @ 2026-08-05 12:10 UTC (permalink / raw) To: Coiby Xu, kexec Cc: Andrew Morton, Baoquan He, Dave Young, Pratyush Yadav, Mike Rapoport, Pasha Tatashin, Jonathan Corbet, Shuah Khan, Coiby Xu, Rob Herring (Arm), open list:DOCUMENTATION, open list On 29/07/26 09:06, Coiby Xu wrote: > The encrypted dump target support is now extended to arm64 and ppc64le. > > Fixes: e3a84be1ec2f ("arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel") > Reported-by: Sourabh Jain <sourabhjain@linux.ibm.com> > Signed-off-by: Coiby Xu <coiby.xu@gmail.com> > --- > Documentation/admin-guide/kdump/kdump.rst | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst > index 0bf2eb100a05..36ad6125c670 100644 > --- a/Documentation/admin-guide/kdump/kdump.rst > +++ b/Documentation/admin-guide/kdump/kdump.rst > @@ -572,8 +572,8 @@ Write the dump file to encrypted disk volume > ============================================ > > CONFIG_CRASH_DM_CRYPT can be enabled to support saving the dump file to an > -encrypted disk volume (only x86_64 supported for now). User space can interact > -with /sys/kernel/config/crash_dm_crypt_keys for setup, > +encrypted disk volume (only x86_64, arm64, ppc64le supported for now). User > +space can interact 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 Changes look good to me. Feel free to add. Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-06 5:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260729033654.311541-1-coiby.xu@gmail.com>
2026-07-29 3:36 ` [PATCH v3 09/10] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported Coiby Xu
2026-08-05 12:09 ` Sourabh Jain
2026-08-06 5:33 ` Coiby Xu
2026-07-29 3:36 ` [PATCH v3 10/10] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list Coiby Xu
2026-08-05 12:10 ` Sourabh Jain
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox