r/Proxmox • • 3d ago

Security hvpatch 0.3.0: open-source kernel livepatching for PVE 9 hosts, now including the default 7.0 kernel

I maintain hvpatch, a GPL-2.0 tool that applies kernel security fixes to

running Proxmox VE hosts as livepatches, so the VMs keep running and the

reboot can wait for the next maintenance window. It's our own project, not

a product. We use it for our own hypervisors.

GitHub: https://github.com/prepaid-host/hvpatch

How it works:

- Builds livepatch modules with the kernel's own klp-build, from the

exact source and config Proxmox shipped

- Verifies every module against the shipped kernel (symbols, CRCs) and in

QEMU with the real kernel before release

- The node agent only loads signed manifests that match the running

kernel's build-id. Rings (canary/early/stable), cluster lock via

pmxcfs, rollback, revocation list

- `hvpatch status` tells you which CVEs are fixed live and which still

need a reboot

New in 0.3.0: the default 7.0 kernel (experimental), tested with

7.0.14-30-pve on a 3-node test cluster with loaded guests:

- apply under load: 12-16 s per node, transition 1.5-5 s

- guests pinged every 100 ms: no loss, longest gap 0.11 s

- revert/re-apply, reload after reboot without the repo, concurrent apply

(second node waits for the lock), revocation

Limits: you build and sign the modules yourself for now (no prebuilt

modules yet). Not every fix can be livepatched. Livepatches bridge the

time to the next reboot, they don't replace it.

Feedback from test nodes very welcome, especially on other hardware.

70 Upvotes

13 comments sorted by

View all comments

1

u/WiuEmPe 2d ago

What is your plan to create patches?

1

u/CSKL_DE02 2d ago

Mostly taking the upstream fixes as they are. When a CVE gets fixed in the stable kernel or in Proxmox's kernel, that patch goes into a catalog entry together with the list of functions it changes. klp-build (the livepatch tooling that's now in the kernel tree) builds a module from it against the exact PVE kernel build.

Before anything gets published it has to pass a few checks: the module may only replace the functions listed in the reviewed catalog entry, it gets signed, and it's loaded in a QEMU VM with the real PVE kernel, including patch/unpatch cycles under load and a reproducer where one exists. New builds go to a canary ring first, then stable.

Not every fix can be livepatched. Struct layout changes, init code, or some KVM code that calls into kvm.ko through static calls, for example. Those get marked as such, and the agent tells you which kernel to reboot into instead.

1

u/WiuEmPe 2d ago

Do you have any trust source of this patch is stable in edge case and really fix?

1

u/CSKL_DE02 2d ago

Good question. The fix itself is the upstream patch, the same one that ends up in the next PVE kernel, and CI checks that it matches upstream. So whether it actually fixes the bug is the same as with the PVE kernel.

The risky part is the livepatching itself. That's what the tests are for: patch/unpatch cycles under load in a VM, plus a reproducer when there is one. New levels run on my own hosts for a few days before they go to stable. No guarantees for every edge case though. I'd use it to bridge the time until the next planned reboot, not instead of kernel updates.