
CVE-2026-53359漏洞补丁
KVM memory hot-patching tool for the KVM shadow MMU issue involving CVE-2026-53359, which modifies kernel instructions at runtime and includes an ELF offset analysis script. This project directly modifies kernel instructions in memory and should only be used on systems you own and are authorized to use, and should be thoroughly tested in a non-production environment first.
The affected kvm_mmu_get_page() path may reuse shadow pages based only on comparing the global frame number. Without also checking the MMU role, it may select a page with an incompatible role. The upstream fix adds the missing role comparison; this hot patch takes a different approach by replacing the corresponding conditional jump with a 6-byte NOP, forcing the code into the path that allocates a new page instead of reusing the old one. This avoids rebooting the host, but shadow pages in the affected path will no longer be reusable, and memory usage may increase.
After the module is loaded, it looks up kvm_mmu_get_page and text_poke via kallsyms_lookup_name, saves the original 6-byte instruction, and modifies the instruction under the protection of stop_machine. When the module is unloaded, the original bytes are restored.
The runtime environment requires Linux 4.18 or later, kernel headers and build tools matching the running kernel, and an x86 host with the relevant KVM modules installed. The kernel build used must also exactly match the patch offsets.
To compile, load the module, and view the logs, use the following commands:
make
sudo insmod KVM-XJ.ko
dmesg | grep KVM-XJ
Unloading the module restores the original instruction:
sudo rmmod KVM_XJ
Instruction locations vary with compile options and kernel versions, so do not assume the default offsets apply to all kernels. To analyze other kernels, run:
python offset_analyzer.py ./kvm.ko
The script reads the ELF symbol table, locates kvm_mmu_get_page, and outputs candidate comparison instructions and jump instructions. You must verify the disassembly of your own kernel and confirm the offsets before modifying the C module.
Tested offsets include jump offset 0x108 for kernel version 4.18.0-496.el8.x86_64 and jump offset 0xe8 for kernel version 4.18.0-358.el8.x86_64. Incorrect offsets may crash the host, so verification must be completed before loading the module.