Re: [PATCH] crash_dump: Fix potential double free and UAF of keys_header

From: Coiby Xu

Date: Fri May 01 2026 - 21:03:14 EST


On Tue, Apr 07, 2026 at 03:29:18PM +0530, Sourabh Jain wrote:

[...]
As per kdump.rst, restore was introduced to handle CPU and
memory hotplug cases. Is it needed when there is no in-kernel
update to the kdump image on CPU or memory hotplug events?

But in that case, we rely on a udev rule to reload the kdump image
again.

I am confused about when exactly we need to restore.

To clarify, reuse other than restore is needed for non in-kernel update
when handing CPU/memory hotplugging. Yes, a udev rule is also needed in
this case.

Below commit explains how the reuse is utilized:

commit 9ebfa8dcaea77a8ef02d0f9478717a138b0ad828
Author: Coiby Xu <coxu@xxxxxxxxxx>
Date:   Fri May 2 09:12:38 2025 +0800

    crash_dump: reuse saved dm crypt keys for CPU/memory hot-plugging

It got it now. This is helpful when kdump needs to be reloaded due to
CPU/memory hotplug events using the kexec_file_load system call,
but only when CONFIG_CRASH_HOTPLUG is not enabled.



IIUC this feature is not support on crash image loaded using kexec_load syscall, right?

Glad you've figured it out! Yes, you are correct. If
CONFIG_CRASH_HOTPLUG is enabled, there is no need for configfs/reuse. In
v2, I've improved the doc and also added a patch to prevented using this
API when CONFIG_CRASH_HOTPLUG is enabled.


--
Best regards,
Coiby