[PATCH v10 11/13] PCI: liveupdate: Freeze preservation status during shutdown
David Matlack
dmatlack at google.com
Tue Oct 13 09:50:03 PDT 2026
On 2026-10-13 04:39 PM, sashiko-bot at kernel.org wrote:
> [Severity: High]
> If a user task exits or closes the Live Update session fd during system shutdown,
> the LU core tears down the preservation session.
>
> When dev->liveupdate.frozen is true, pci_liveupdate_unpreserve_device()
> returns -EINVAL and leaves dev->liveupdate.outgoing pointing to the FLB memory.
>
> However, the LU core ignores this failure and unconditionally drops the FLB
> reference:
[...]
> Will this leave a dangling pointer in dev->liveupdate.outgoing?
>
> Since pci_device_shutdown() relies on this pointer to skip disabling Bus Master,
> could this result in the old kernel leaving DMA enabled while the next kernel
> treats the device as unpreserved, creating a risk of memory corruption?
This can't happen during a Live Update kexec.
kernel_kexec() calls liveupdate_reboot() before device_shutdown().
liveupdate_reboot() calls luo_session_serialize(), which takes
luo_session_serialize_rwsem for write and, on success, never releases
it. luo_session_release() and the session ioctls all take that rwsem
for read, so once sessions are serialized, nothing can unpreserve a file
until the kexec. If serialization fails, kernel_kexec() bails out before
device_shutdown(), so no device is ever frozen.
So during a Live Update kexec, unpreserve cannot race with devices
being frozen, and the outgoing FLB cannot be freed out from under
pci_device_shutdown().
On a non-kexec reboot or poweroff, LUO is not serialized, so the
unpreserve can fail as described and leave a stale pointer in
dev->liveupdate.outgoing. But nothing dereferences it at that point.
The only visible effect is the "Cannot unpreserve device after it is
frozen!" warning, which seems appropriate for a session being torn down
in the middle of shutdown.
So I don't think any change is needed here.
More information about the kexec
mailing list