Skip to main content
RunBook Academy

LinuxX · Kernel ManagementLive patching

Live kernel patching — kpatch, kgraft, and livepatch

Advanced⏱ ~8 minbashkpatchcanonical-livepatchuname

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

Not yet marked complete on this device.

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.

Read-only / Safekpatch list
$ kpatch list; uname -r; cat /proc/version
Installed 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

ToolDistributionMechanism
kpatchRHEL-family (RHEL, Rocky, Alma, Oracle)ftrace-based function replacement
kgraftSUSEsimilar approach; merged into kpatch
canonical-livepatchUbuntuftrace-based; Ubuntu Pro subscription required
KernelCareMulti-distribution (TuxCare)Commercial alternative
Read-only / Safecanonical-livepatch
$ canonical-livepatch status
current 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).
Read-only / Safepatch info
$ kpatch info kpatch-6.1.0-1.el9_1
patch 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?

  1. Configure automatic live-patching for routine security patches. RHEL and Ubuntu ship with this enabled in the default subscription
  2. Document the live-patch backlog in the runbook — what patches are pending reboot, what host they affect
  3. Schedule periodic reboots for non-live-patchable updates and to clear the patch backlog
  4. Test live-patching on a clone host before enabling in production; the patching daemon is itself a kernel module
  5. 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

  1. Q1. Which of the following can live kernel patching typically fix?

  2. Q2. A fleet running live patching still needs a scheduled reboot cycle.

  3. Q3. Which of the following are correct live-patching practices? Select all that apply.

Passing score: 75%. Answers are checked in this browser.