Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 7 min read

A live patch can load, report enabled and still not run its fix

In an earlier post we watched the transition that a Linux live patch goes through before it is fully in place. When the transition ends, every task runs the new code. That tells us the kernel accepted the patch. It does

In an earlier post we watched the transition that a Linux live patch goes through before it is fully in place. When the transition ends, every task runs the new code. That tells us the kernel accepted the patch. It does not tell us that the new code is the fix the patch was built from, and this post is about the gap between those two things.

We studied that gap in a paper now under review, with a public preprint. We compared 681 live patch modules shipped by six distributions with independent compiles of the fixes they were built from, and almost all of them put their fix into effect. A few did not, and every one of those loaded, reported enabled and completed its transition. Below we describe how that happens, how often it can happen, and what operators, distributions and tool authors can check.

The three signals and what they mean

A live patch is a kernel module that carries new versions of the functions a fix changes, together with a table that tells the kernel which original functions to redirect. After loading it, an operator sees three signals. The module is loaded, /sys/kernel/livepatch/<patch>/enabled reads 1, and transition returns to 0.

All three describe what the kernel did with the module. None of them compares the module with the fix. If the table leaves out a function the fix changed, the kernel redirects the functions that are listed, reports success, and keeps running the old version of the one that is not.

How a fix can be carried but never called

The case we can describe in full is openEuler's hotpatch for CVE-2025-21727, a use-after-free in the kernel's parallel processing helper, padata. The fix changes padata_free_shell().

GCC had split that function in two when it built the kernel. One part is a small wrapper, and the other is a clone named padata_free_shell.part.0 that holds the body. The fix changes only the clone. The clone has its own ftrace entry, so the kernel could redirect it directly.

kpatch-build, the generator that built the module, decides what to register with three rules. Every clone such as .part.0 is treated as a child of its parent function. A parent is marked changed only when a changed child has no ftrace entry of its own. Only parents get an entry in the table of replaced functions.

Put together, these rules copy the fixed clone into the module and register nothing for it. The module's table of 13 functions names neither the wrapper nor the clone. On a running kernel the module loaded, reported enabled and completed its transition. Ftrace redirected padata_replace(), which the table does name, while every call to the clone still entered the kernel's own unfixed copy.

The openEuler security team reproduced the omission and released a corrected hotpatch, ACC-1-7, with advisory openEuler-HotPatchSA-2026-1000. The faulty releases had shipped for 586 days. On AArch64 the team found a second form of the same fault, in which the wrapper is replaced but still calls the kernel's unfixed clone.

How often this shape appears

The rule is not specific to one vendor's build. Current upstream kpatch makes the same choice on the openEuler objects, and an open kpatch issue reports the same omission in another security module, with a proposed fix that is not merged.

We measured how often real fixes take this shape. Of 2,445 small stable kernel fixes built with GCC 13.3, 13 change a .part clone that has its own ftrace entry while leaving its parent unchanged. That is 0.53%, or about one fix in 190. kpatch-build built nine of them on our test kernels, and all nine left the changed clone out of the table. In five, the clone was the fix's only change, so the table was empty. All nine loaded and reported enabled.

Other generators handle the same shape differently. The in-tree klp-build, Xen's livepatch-build-tools and Oracle Ksplice all replace the clone directly. The omission therefore comes from one rule in one tool, not from a limit of live patching.

In what distributions shipped, the shape is rare. Of the 681 shipped modules that could be judged, 668 put their fix into effect. The other 13 are releases of three security live patches that leave a changed clone out of their table. Two of them are under coordinated disclosure with their vendors, so we give no further detail about them here.

Why the usual checks miss it

The kernel accepted every real fault we loaded, and 85.9% of the faults we injected into modules built from real fixes. Each accepted module loaded, reported enabled and completed its transition.

kpatch-build's own checks run before the module exists, and they let the clone omission through. Patch presence tests ask whether the fix's code is in a binary, and a live patch module contains that code by construction, even when the kernel never calls it. Vendor advisories listed the CVE as fixed for the affected kernels, so a system that tracked them counted the vulnerability as closed.

What you can check on your own machines

The kernel already lists what each live patch registers. Under /sys/kernel/livepatch/<patch>/ there is one directory per patched object, such as vmlinux or a module name, and inside it one directory per function, named <function>,<sympos>.

# Every function each loaded live patch asks the kernel to redirect
for p in /sys/kernel/livepatch/*/; do
  echo "== ${p}"
  ls -d "${p}"*/*/ 2>/dev/null
done

With the kernel's own livepatch-sample loaded on Debian 13 (6.12.118+deb13-amd64), the same sample as in the earlier post, the loop prints one function. The loop needs no root.

== /sys/kernel/livepatch/livepatch_sample/
/sys/kernel/livepatch/livepatch_sample/vmlinux/cmdline_proc_show,1/

Compare that list with the functions the fix changes. The fix itself names them, in the upstream commit that the CVE record points to. If a changed function is missing from the list, look for a compiler clone of it in the running kernel.

# Does the running kernel hold the changed function as a clone?
grep -E ' padata_free_shell(\.part\.[0-9]+|\.isra\.[0-9]+|\.constprop\.[0-9]+)?$' /proc/kallsyms

Without root the names are listed and the addresses read as zero, which is enough for this question. The answer depends on the build, because the compiler decides per build whether to split a function. On the Debian 13 kernel above, padata_free_shell is a single function, while 712 other functions have a .part clone. On the openEuler kernel of the hotpatch, built with GCC 10.3.1, it was split.

If the kernel holds a clone of a changed function, and the patch registers neither that function nor its clone, the fix may be only partly in effect. Not every missing function is a fault. A function can be left out safely when its code did not change, when the kernel reaches it only through replaced code, or when the vendor's form of the fix does not need it. A missing entry is a question to ask the vendor, with the commit and the clone name attached.

This manual check covers only the shape described above. The checks in the paper go further. They compile the touched files three times to find exactly which functions the fix changes, and compare every relocation in the module with an independent compile, which also catches a call bound to the wrong copy of a symbol.

What distributions and generator authors can do

A generator holds everything a self-check needs at the end of a build. It has its own original and patched objects, so it can compare the functions that differ with the module's table before the module is signed. With the generator's own objects as the reference, the comparison added under 3% to a kpatch-build run in our tests, and a failure at that point costs a rebuild rather than an incident.

Two further habits help. Each shipped live patch can record its generator version next to the kernel and compiler, because one kpatch-build release built a faithful module from the same fix, compiler and kernel for which the release before it did not. Status reports can also separate "accepted by the kernel" from "verified against the fix", rather than read enabled alone.

Data and code

The paper is under review, and the preprint is at doi.org/10.5281/zenodo.24716483. The checks, the injected faults and the result files are archived at doi.org/10.5281/zenodo.24644743 and mirrored at github.com/kazuru-chidumbwe/lpfid. The evidence for the cases under coordinated disclosure is frozen in one archive, and its hash is published in the repository so the archive can be added unchanged when those disclosures close. We triggered no vulnerability and publish no exploit.

If you build or ship live patches and want to run the checks on your own pipeline, we would be glad to hear how they behave on it.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.