kexec: call liveupdate_reboot() before kexec

Modify the kernel_kexec() to call liveupdate_reboot().

This ensures that the Live Update Orchestrator is notified just before the
kernel executes the kexec jump.  The liveupdate_reboot() function triggers
the final freeze event, allowing participating FDs perform last-minute
check or state saving within the blackout window.

If liveupdate_reboot() returns an error (indicating a failure during LUO
finalization), the kexec operation is aborted to prevent proceeding with
an inconsistent state.  An error is returned to user.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Pasha Tatashin <[email protected]>
Reviewed-by: Mike Rapoport (Microsoft) <[email protected]>
Reviewed-by: Pratyush Yadav <[email protected]>
Tested-by: David Matlack <[email protected]>
Cc: Aleksander Lobakin <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: Alice Ryhl <[email protected]>
Cc: Andriy Shevchenko <[email protected]>
Cc: anish kumar <[email protected]>
Cc: Anna Schumaker <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Borislav Betkov <[email protected]>
Cc: Chanwoo Choi <[email protected]>
Cc: Chen Ridong <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Daniel Wagner <[email protected]>
Cc: Danilo Krummrich <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: David Jeffery <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Guixin Liu <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Ilpo Järvinen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Ira Weiny <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Joanthan Cameron <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Lennart Poettering <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Lukas Wunner <[email protected]>
Cc: Marc Rutland <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Matthew Maurer <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Myugnjoo Ham <[email protected]>
Cc: Parav Pandit <[email protected]>
Cc: Pratyush Yadav <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Saeed Mahameed <[email protected]>
Cc: Samiullah Khawaja <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Stuart Hayes <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Thomas Gleinxer <[email protected]>
Cc: Thomas Weißschuh <[email protected]>
Cc: Vincent Guittot <[email protected]>
Cc: William Tu <[email protected]>
Cc: Yoann Congal <[email protected]>
Cc: Zhu Yanjun <[email protected]>
Cc: Zijun Hu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
Pasha Tatashin authored and Andrew Morton committed 2025-11-27 14:24:38 -08:00
1 parent 1aece82100
commit db8bed8082
1 file changed
+5
+5
View File
@@ -15,6 +15,7 @@
#include <linux/kexec.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/liveupdate.h>
#include <linux/highmem.h>
#include <linux/syscalls.h>
#include <linux/reboot.h>
@@ -1137,6 +1138,10 @@ int kernel_kexec(void)
goto Unlock;
}
error = liveupdate_reboot();
if (error)
goto Unlock;
#ifdef CONFIG_KEXEC_JUMP
if (kexec_image->preserve_context) {
/*