LinuxX · Kernel ManagementLive patching
Live kernel patching — kpatch, kgraft, and livepatch
What you'll learn
- Explain how live kernel patching works
- Distinguish kpatch (Red Hat), kgraft (SUSE), and livepatch (Canonical)
- Know when live patching is safe and when a reboot is required
- Decide the operational policy for live patching on the fleet
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
Live kernel patching applies security fixes to the running kernel without rebooting. The mechanism: replace a function in the running kernel with a patched version, using the kernel’s ftrace infrastructure to redirect calls.
How live patching works
flowchart LR
K[Running kernel]
F[ftrace hook]
P[Patched function]
K --> F
P -.replaces.-> F
The live-patch daemon (kpatch, kgraft, or canonical-livepatch) loads a specially-built kernel module that uses ftrace to redirect specific kernel functions to their patched versions. The running processes see the patched behaviour; the underlying kernel version does not change.
$ kpatch list; uname -r; cat /proc/versionInstalled patches:
kpatch-6.1.0-1.el9_1.x86_64 (kernel-6.1.0-1.el9)
6.1.0-1.el9
Linux version 6.1.0-1.el9 ...Illustrative output
The vendors
| Tool | Distribution | Mechanism |
|---|---|---|
| kpatch | RHEL-family (RHEL, Rocky, Alma, Oracle) | ftrace-based function replacement |
| kgraft | SUSE | similar approach; merged into kpatch |
| canonical-livepatch | Ubuntu | ftrace-based; Ubuntu Pro subscription required |
| KernelCare | Multi-distribution (TuxCare) | Commercial alternative |
$ canonical-livepatch statuscurrent kernel: 6.1.0-13-generic
server check-in: succeeded
patch state: ● running kernel is NOT yet covered
patch version: 0
...Illustrative output
When live patching is safe
Safe use cases:
- A CVE patch for a specific function (e.g., a bounds check bug).
- A driver bug fix that affects a peripheral the host uses.
- A performance fix for a hot code path.
When live patching is NOT safe:
- ABI changes (struct field additions).
- Filesystem format changes (require unmount/remount or new filesystem).
- Hardware enablement (e.g., new CPU instructions).
- Anything that affects early-boot code paths (before ftrace is ready).
$ kpatch info kpatch-6.1.0-1.el9_1patch name: kpatch-6.1.0-1.el9_1
kernel version: 6.1.0-1.el9
patch description: Livepatch for CVE-2025-XXXX
...Illustrative output
Operational policy
The production question is: when to live-patch and when to reboot?
- Configure automatic live-patching for routine security patches. RHEL and Ubuntu ship with this enabled in the default subscription
- Document the live-patch backlog in the runbook — what patches are pending reboot, what host they affect
- Schedule periodic reboots for non-live-patchable updates and to clear the patch backlog
- Test live-patching on a clone host before enabling in production; the patching daemon is itself a kernel module
- Audit live-patch state quarterly. Use kpatch list or canonical-livepatch status for every host. Tainted flag K (live-patch applied) confirms the patch loaded
Knowledge check
Knowledge check · 3 questions
Q1. Which of the following can live kernel patching typically fix?
Q2. A fleet running live patching still needs a scheduled reboot cycle.
Q3. Which of the following are correct live-patching practices? Select all that apply.
Passing score: 75%. Answers are checked in this browser.