Skip to content

Commit

Permalink
kexec: don't use kexec_file_load on XEN
Browse files Browse the repository at this point in the history
Since commit 29fe506 ("kexec: make -a the default")
kexec tries the kexec_file_load syscall first and only falls back to kexec_load on
selected error codes.

This effectively breaks kexec on XEN, unless -c is pecified to force the kexec_load
syscall.

The XEN-specific functions (xen_kexec_load / xen_kexec_unload) are only called
from my_load / k_unload, i.e. the kexec_load code path.

With -p (panic kernel) kexec_file_load on XEN fails with -EADDRNOTAVAIL (crash
kernel reservation is ignored by the kernel on XEN), which is not in the list
of return codes that cause the fallback to kexec_file.

Without -p kexec_file_load actualy leads to a kernel oops on v6.4.0
(needs to be dubugged separately).

Signed-off-by: Jiri Bohac <[email protected]>
Fixes: 29fe506 ("kexec: make -a the default")
Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
jiribohac authored and horms committed Jan 25, 2024
1 parent 21ea456 commit 94fbe64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions kexec/kexec.8
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Specify that the new kernel is of this
.TP
.BI \-s\ (\-\-kexec-file-syscall)
Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
Ignored on XEN.
.TP
.BI \-c\ (\-\-kexec-syscall)
Specify that the old KEXEC_LOAD syscall should be used exclusively.
Expand Down
4 changes: 4 additions & 0 deletions kexec/kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,10 @@ int main(int argc, char *argv[])
}
}
}
if (xen_present()) {
do_kexec_file_syscall = 0;
do_kexec_fallback = 0;
}
if (do_kexec_file_syscall) {
if (do_load_jump_back_helper && !do_kexec_fallback)
die("--load-jump-back-helper not supported with kexec_file_load\n");
Expand Down

0 comments on commit 94fbe64

Please sign in to comment.