Jump to content

kexec

From Wikipedia, the free encyclopedia

kexec(kernel execute), analogous to the Unix/Linux kernel callexec,is a mechanism of theLinux kernelthat allows booting of a newkernelfrom the currently running one.

Details

[edit]

Essentially, kexec skips thebootloaderstage andhardwareinitialization phase performed by the systemfirmware(BIOSorUEFI), and directly loads the new kernel intomain memoryand starts executing it immediately. This avoids the long times associated with a full reboot, and can help systems to meet high-availability requirements by minimizingdowntime.[1][2]

While feasible, implementing a mechanism such as kexec raises two major challenges:

  • Memory of the currently running kernel is overwritten by the new kernel, while the old one is still executing.
  • The new kernel will usually expect all hardware devices to be in a well defined state, in which they are after a system reboot because the system firmware resets them to a "sane" state. Bypassing a real reboot may leave devices in an unknown state, and the new kernel will have to recover from that.

Support for allowing onlysignedkernels to be booted through kexec was merged into version 3.17 of theLinux kernel mainline,which was released on October 5, 2014.[3]This disallows aroot userto load arbitrary code via kexec and execute it, complementing theUEFI secure bootand in-kernel security mechanisms for ensuring that only signedLinux kernel modulescan be inserted into the running kernel.[4][5][6]

Kexec is used byLinuxBootto boot the main kernel from the Linux kernel located in the firmware.

See also

[edit]
  • kdump (Linux)– Linux kernel's crash dump mechanism, which internally uses kexec
  • kGraft– Linux kernel live patching technology developed by SUSE
  • kpatch– Linux kernel live patching technology developed by Red Hat
  • Ksplice– Linux kernel live patching technology developed by Ksplice, Inc. and later bought by Oracle

References

[edit]
  1. ^Hariprasad Nellitheertha (May 4, 2004)."Reboot Linux faster using kexec".IBM.Archived fromthe originalon January 21, 2013.RetrievedDecember 5,2013.
  2. ^David Pendell (August 16, 2008)."Reboot like a racecar with kexec".linux.Archived fromthe originalon February 14, 2009.RetrievedDecember 5,2013.
  3. ^"Linux kernel 3.17, Section 1.10. Signed kexec kernels".kernelnewbies.org.October 5, 2014.RetrievedNovember 3,2014.
  4. ^Jake Edge (June 25, 2014)."Reworking kexec for signatures".LWN.net.RetrievedAugust 9,2014.
  5. ^Matthew Garrett (December 3, 2013)."Subverting security with kexec".dreamwidth.org.RetrievedDecember 5,2013.
  6. ^Kees Cook (December 10, 2013)."Live patching the kernel".outflux.net.RetrievedDecember 12,2013.