Can't use kexec-tools for preserve-context kexec 'call'?

David Woodhouse dwmw2 at infradead.org
Mon Dec 9 06:07:54 PST 2024


In https://git.kernel.org/torvalds/c/07fa619f2a40c there is a test
program which uses kexec to invoke a 4-instruction 'executable' which
merely writes a byte to a serial port and returns.

It just loads a single kexec segment containing those four
instructions.

Should I have been able to do that using kexec-tools? I couldn't work
out how.

And even once it's loaded, 'kexec -f -e' does manage to invoke it, but
then reports 'No such file or directory' after the reboot() system call
returns success. Strace shows:

reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC[  143.979879] Freezing user space processes
[  143.981493] Freezing user space processes completed (elapsed 0.000 seconds)
[  143.982148] OOM killer disabled.
[  143.999573] Disabling non-boot CPUs ...
[  144.017504] smpboot: CPU 1 is now offline
[  144.018298] crash hp: kexec_trylock() failed, kdump image may be inaccurate
B[  144.034246] Enabling non-boot CPUs ...
[  144.034666] crash hp: kexec_trylock() failed, kdump image may be inaccurate
[  144.035396] smpboot: Booting Node 0 Processor 1 APIC 0x1
[  144.037406] CPU1 is up
[  144.042020] virtio_blk virtio1: 2/0/0 default/read/poll queues
[  144.046702] OOM killer enabled.
[  144.047368] Restarting tasks ... done.
) = 0
write(2, "kexec failed: No such file or di"..., 40kexec failed: No such file or directory
) = 40
exit_group(-1)                          = ?
+++ exited with 255 +++





-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5965 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20241209/73d6a8f2/attachment.p7s>


More information about the kexec mailing list