Live patching is the technique of modifying the code of a running kernel in memory so that a security or bug fix takes effect immediately, without rebooting the machine. In operating systems, and within the wider practice of OS updates & maintenance, it is used mainly to close critical kernel vulnerabilities on servers and workstations that cannot afford unplanned downtime.
The approach is also called kernel live patching. It does not replace regular kernel updates: it is a bridge that buys time between the disclosure of a flaw and the next planned maintenance window, when a full updated kernel is installed and the system restarts cleanly.
How live patching redirects kernel functions
A live patch works by replacing whole functions, not individual instructions. The patch is delivered as a loadable kernel module that contains corrected versions of the affected functions. When the module loads, the kernel places a redirection at the entry point of each original function so that every new call jumps to the fixed copy instead.
On Linux, the redirection relies on the ftrace function tracing framework, which already reserves a small patchable area at the start of most kernel functions. The livepatch subsystem registers a handler there that changes the instruction pointer to the new function. The old code stays in memory, which is why a later patch can be reverted by removing the redirection.
The hardest part is consistency. A thread may be sleeping inside a function that is being replaced, and switching it mid-execution could corrupt state. The Linux consistency model therefore moves each task to the patched state individually, only when its stack trace shows no patched function, or when it crosses the boundary between user space and kernel space. Until every task has transitioned, the patch is reported as being in transition.
The following table summarizes the stages that a typical kernel live patch passes through.
| Stage | What happens | Typical duration |
|---|---|---|
| Build | Vendor compiles fixed functions into a patch module | Hours to days after disclosure |
| Load | Module is inserted and its signature is verified | Under one second |
| Redirect | Entry points of old functions are redirected | Milliseconds |
| Transition | Each task switches once its stack is safe | Seconds, sometimes minutes |
| Complete | All tasks use the new code | Persists until the next reboot |
Live patching implementations by platform
Several mature implementations exist, and most enterprise Linux distributions ship their own service built on the upstream kernel livepatch interface, which was merged in Linux 4.0 in 2015. Earlier designs such as Ksplice, kGraft and kpatch shaped that interface. Windows has a different mechanism called hotpatching, available for selected Windows Server editions.
This table compares the main implementations and how they are typically consumed.
| Implementation | Platform | Delivery model |
|---|---|---|
| Upstream livepatch | Linux kernel 4.0 and later | Interface used by distribution tools |
| kpatch | Red Hat Enterprise Linux and derivatives | Patch modules from the vendor |
| kGraft lineage | SUSE Linux Enterprise | Subscription live patching service |
| Ksplice | Oracle Linux | Vendor service, also covers some user space |
| Canonical Livepatch | Ubuntu LTS releases | Client agent with cloud-delivered patches |
| Windows hotpatching | Selected Windows Server editions | Monthly hotpatch updates between baseline releases |
Live patching compared with other update methods
Live patching is one tool among several for keeping a system current, and each method trades downtime against completeness. A conventional kernel update installs a new kernel image and requires a reboot to activate it. A/B system updates prepare a second system partition and switch to it on restart, which makes rollback simple but still needs a restart.
The comparison below places live patching next to its closest neighbors in OS updates & maintenance.
| Approach | Reboot needed | Scope of change | Main strength |
|---|---|---|---|
| Live patching | No | Selected kernel functions | Zero downtime for urgent fixes |
| Kernel update | Yes | Entire kernel image | Complete and permanent fix |
| A/B system updates | Yes | Whole system partition | Atomic switch and easy rollback |
| In-place upgrade | Yes, often several | Full OS version | Moves to a new release |
| Service restart | No | User-space programs only | Reloads patched libraries quickly |
A frequent misunderstanding is that live patching also updates user-space libraries such as the C library or OpenSSL. Most implementations cover only the kernel, so administrators still need to restart affected services after library updates.
When to use live patching in practice
Live patching is most valuable where reboots are expensive or risky: database hosts with long warm-up times, virtualization hosts carrying many guests, telecommunications nodes and industrial controllers. It fits naturally into patch management as the fast lane for critical kernel issues, while ordinary updates follow the normal schedule.
The decision table below shows typical situations and a sensible strategy for each.
| Situation | Recommended choice | Reason |
|---|---|---|
| Actively exploited kernel flaw | Apply a live patch now | Closes exposure before a window opens |
| Routine monthly kernel fixes | Schedule a reboot | Full kernel is simpler to support |
| Fix changes data structures | Reboot with a new kernel | Such changes rarely suit live patches |
| Host running many virtual machines | Live patch, then migrate and reboot later | Avoids restarting all guests at once |
| Desktop or laptop | Normal update and reboot | Downtime cost is low |
Good practice is to verify the patch state after loading, for example by checking the enabled patches and the transition status that the kernel reports through /sys/kernel/livepatch. Monitoring should alert when a patch remains stuck in transition.
Limitations and risks of live patching
Live patching has real technical limits, and vendors decide case by case whether a fix can be delivered this way. Patches that change data structure layouts, alter initialization code that has already run, or modify assembly entry paths are hard or impossible to apply live. In those cases the vendor publishes only a regular kernel update.
- Patches accumulate: each live patch is usually cumulative, and vendors support a given kernel build only for a limited period, often about one year, after which a reboot to a newer kernel is required.
- Not persistent across reboots by itself: the patch module must be loaded again at boot, which the vendor agent normally handles.
- Security of the mechanism: loading code into a running kernel is powerful, so patch modules must be cryptographically signed, especially when Secure Boot is enabled.
- False sense of completeness: a system that reports itself as patched may still run vulnerable libraries or firmware.
For these reasons, experienced administrators treat live patching as risk reduction, not a substitute for rebooting. A planned restart onto a fully updated kernel remains part of a healthy maintenance cycle.
A plain-language summary
The kernel is the core of an operating system, and fixing it normally means restarting the computer. Live patching swaps out the broken parts while the machine keeps running, a little like replacing a faulty light switch in a building without turning off power to every floor.
It is mainly used for urgent security fixes on servers that must stay online. It is not permanent on its own, so the computer is still restarted later, at a convenient time, onto a fully updated system.
An example from practice
A regional hospital runs its patient records database on a cluster of Linux servers that must remain available around the clock. When a privilege escalation flaw in the kernel networking code is disclosed and reported as actively exploited, the infrastructure team cannot wait for the quarterly maintenance window, which is six weeks away.
The distribution vendor releases a live patch two days later. The team tests it on a staging server, confirms that the transition completes in under a minute, and then rolls it out to all twelve production nodes through their configuration management tool. No service interruption occurs, and monitoring confirms that every node reports the patch as enabled.
At the next maintenance window, the servers are rebooted onto a new kernel that includes the fix permanently. The outcome is that the exposure window shrank from six weeks to about three days without any planned downtime.