[TUTORIAL] hvpatch – kernel live patching for Proxmox VE 9 (early release, feedback and testers wanted)

CSakel

Active Member
Aug 4, 2020
12
6
43
24
prepaid-host.com

hvpatch: kernel live patching for Proxmox VE​


Hi all,

I'm Christopher from Prepaid-Host, a hoster running Proxmox VE 9 for customer VMs. We built an open-source tool that applies kernel security fixes to running PVE hosts without a reboot, and we'd like your feedback before taking it further.

GitHub: https://github.com/prepaid-host/hvpatch · GPL-2.0 · early release

Why​

  • Each one means drain, reboot, refill. Passthrough VMs and single nodes get real downtime.
  • Until the reboot, hosts with customer VMs stay exposed to guest-to-host bugs.
  • KernelCare doesn't support PVE 9, and Proxmox will "re-evaluate" livepatching, without promises.

How it works​

  • Build: the kernel's own klp-build (mainline since 6.19), against the exact Proxmox source, config and toolchain. Any mismatch stops the build.
  • Checks: every module is verified against the shipped kernel and booted in QEMU before it is signed.
  • Catalog: one reviewed entry per CVE, saying clearly "fixed live" or "reboot required".
  • Agent: a small Rust binary (.deb). It verifies signature, kernel build-id and hash, loads the patch, reverses instead of forcing when something goes wrong, and reloads it after a reboot before the guests start.
  • No central server: a static HTTPS repo, nodes pull, your Ansible decides the order. Bring your own keys.

Tested so far​

Nested PVE 9.2 on a real host, kernels 7.3.4-1 and 7.3.5-1:

TestResult
3 real CVE fixes (mm/gup.c, overlayfs) as livepatchExploit blocked, works again after revert
20 apply/revert cycles, guests under load (memory with checksums, 15 Gbit/s)No errors, no kernel warnings, ~1.6 s per transition
Transition blocked by a sleeping taskReversed after timeout, no force
Secure Boot with MOK, legacy BIOS, reload after rebootOK
Module rebuildBit-identical

Not yet: bare metal and a multi-node rollout. That's next.

Limits​

  • A bridge to your next maintenance window, not a replacement for kernel updates.
  • Opt-in 7.3 kernels only for now. The 7.0 tree lacks the objtool support klp-build needs.
  • Data structure changes, ZFS and QEMU fixes still need a reboot; hvpatch status tells you which.
  • No prebuilt modules yet: you build your own (~2 h and ~60 GB per kernel).
  • Independent project, not affiliated with Proxmox.

Try it (test hosts only)​

Bash:
wget https://github.com/prepaid-host/hvpatch/releases/latest/download/hvpatch_amd64.deb
apt install ./hvpatch_amd64.deb
hvpatch setup --repository https://your.repo --key manifest.pub
hvpatch check
Building your own modules: self-hosting guide

Questions to you​

  1. Is the opt-in 7.3 kernel fine for you, or is 7.0 support a must?
  2. Own builds with your own keys, or signed modules built by the project?
  3. Anyone up for reviewing catalog entries? Each needs two reviewers.

Thanks for reading, happy to answer questions!
Christopher
 
Last edited:
Is the opt-in 7.3 kernel fine for you, or is 7.0 support a must?
As you know, 7.3 is just for testing at the moment and not suggested for production, so 7.0 would be great or we all just wait.

I really appreciate what you want to create for PVE users and look forward to use it in production.
 
  • Like
Reactions: Johannes S
As you know, 7.3 is just for testing at the moment and not suggested for production, so 7.0 would be great or we all just wait.

I really appreciate what you want to create for PVE users and look forward to use it in production.
Thanks, that's a fair point, and I agree: for production, 7.0 is what matters.

The reason 7.3 came first is technical, not a preference. The 7.0 kernel is built from the Ubuntu-based tree, and since 7.0.14-25 Proxmox builds objtool there without the livepatch support (HAVE_XXHASH=n in this commit). The Ubuntu base carries objtool/klp changes from 7.2.y without some helpers they need, and klp-build isn't used there, so it was simply switched off. 7.3 is plain upstream stable and works out of the box.

What I'm working on for 7.0:
  • take objtool and klp-build consistently from a 7.2.y release and build with them against the 7.0 tree
  • keep the existing check that our own build of the unpatched kernel matches the one Proxmox ships, so a different objtool can't sneak in a difference
  • run the same test chain as on 7.3 (Gate A, QEMU stage, real host)

No date promises, but I'll post here when 7.0 builds pass the tests.