[BUG] WARNING in __kvm_gpc_refresh (virt/kvm/pfncache.c:267, v7.4-rc3)

From: Zheng Zheng

Date: Sat Nov 21 2026 - 12:29:02 EST


Hi Paolo, Sean, David,

We found a reproducible warning on v7.4-rc3 with syzkaller: the KVM guest
page cache invariant "either gpa or uhva must be valid, but not both" is
violated while KVM emulates a Xen event-channel send. The supplied
recipe reproduced on independent fresh VMs; no state snapshot is
required.

Repository and reproducer:

https://github.com/Zheng-zheng-codes/kvm-gpc-refresh-warning
commit f9bb1f09b4070e6b19fdc49a10297b2afe7e5fb8

Report
------

kvm_is_error_gpa(gpa) == kvm_is_error_hva(uhva)
WARNING: arch/x86/kvm/../../../virt/kvm/pfncache.c:267 at
__kvm_gpc_refresh+0x1692/0x1e40
RIP: 0010:__kvm_gpc_refresh+0x1692/0x1e40 virt/kvm/pfncache.c:267
Call Trace:
kvm_gpc_refresh+0xed/0x160 virt/kvm/pfncache.c:382
kvm_xen_set_evtchn.part.0+0x1b3/0x280 arch/x86/kvm/xen.c:2014
kvm_xen_set_evtchn arch/x86/kvm/xen.c:2115 [inline]
kvm_xen_hvm_evtchn_send+0x22f/0x290 arch/x86/kvm/xen.c:2105

The warning site:

/* Either gpa or uhva must be valid, but not both */
if (WARN_ON_ONCE(kvm_is_error_gpa(gpa) == kvm_is_error_hva(uhva)))
return -EINVAL;

kvm_xen_set_evtchn() retries kvm_xen_set_evtchn_fast(), and on
-EWOULDBLOCK calls kvm_gpc_refresh(&kvm->arch.xen.shinfo_cache,
PAGE_SIZE), which re-refreshes the gpc with whatever gpa/uhva state the
cache currently holds. In the failing run both representations were in
the same error state, so the refresh warned and returned -EINVAL and the
event-channel write failed. The setup was a nested-KVM guest fuzzing the
KVM ioctls, including Xen HVM shared-info/event-channel configuration.

No memory corruption was observed; the effect is the WARN plus the failed
evtchn delivery.

Reproduction
------------

git clone https://github.com/Zheng-zheng-codes/kvm-gpc-refresh-warning
cd kvm-gpc-refresh-warning

# boot v7.4-rc3 with the supplied kernel config
# using a Debian trixie x86_64 guest

# in the guest, as root:
syz-execprog -procs=1 -threaded -repeat=1 \
-executor ./syz-executor \
reproducer/repro.kernsight.prog

The recipe is a state-reconstruction sequence (74 replay programs
followed by the crashing testcase). The warning depends on the kernel
state built by the recipe; the testcase alone is not sufficient. The
recipe must run with -procs=1; using -procs=8 did not reproduce the
warning under our tests.

Expected result: within about two minutes of starting the reproducer the
guest console shows

kvm_is_error_gpa(gpa) == kvm_is_error_hva(uhva)
WARNING: arch/x86/kvm/../../../virt/kvm/pfncache.c:267 at
__kvm_gpc_refresh+0x1692/0x1e40

and the event-channel write that triggered it fails. All five of our
fresh-VM verification runs hit this at 120-121 seconds.

Verification:

- pipeline auto-repro: attempt 1 triggered (160 replay programs) but was
not verified within the 20-minute budget; attempt 2 verified
(confirmed=true, status=verified, fresh-VM recipe replay, 74 replay
programs, 2026-11-21T14:59:08Z)
- stability on fresh VMs: five independent runs, 5/5 reproductions,
120-121 s to the warning in every run (2026-11-21, external-verify/)
- C reproducer: not generated; the syzkaller recipe is the primary
reproducer

Repository contents
-------------------

README.md overview, analysis and verification table
environment.txt kernel/guest hashes and exact QEMU command line
kernel.config kernel configuration used for the reproduction
description original crash title
SHA256SUMS SHA-256 checksums covering every file in the
repository
(including the five verification runs and
their HIT markers)
logs/ original crash evidence
log0 — fuzzer log of the verified attempt
machineInfo0 — VM/environment record
report0 — crash report of the verified attempt
title-stat — occurrence statistics
reproducer/ the reproducer and its provenance
repro.kernsight.prog — the reproducer: 74 replay programs followed
by the crashing testcase (log format)
repro.prog — the crashing testcase alone (not sufficient)
repro.priming.prog — the replay/priming prefix
repro.priming.json — priming trace (candidate picks, distances)
repro.context.json — reproduction context (fresh_vm_recipe_replay)
repro.state.json — measured 539-D pre-crash state vector
repro.report — raw crash report of the reproduction
repro.stats — phase/timing log of the reproduction
repro.README.txt — original bundle description
external-verify/ five independent fresh-VM verification runs
README.md methodology and per-run results
run-1 ... run-5/
serial.log — full guest console of the run
run.log — harness log with hashes and timings
HIT — marker written when the target appeared

Kernel/guest details:

kernel: v7.4-rc3, bzImage sha256
0c16409f8aec508ac44a63e631c2bd352536401f3fd0856df1d839fb953a1882
guest: Debian trixie x86_64, 6 GiB RAM, 4 vCPU, QEMU/KVM, nested KVM
boot: oops=panic panic_on_warn=1 hung_task_panic=0 kvm-intel.nested=1
config: CONFIG_KASAN=y, CONFIG_PROVE_LOCKING=y, CONFIG_KVM=y,
CONFIG_KVM_XEN=y

Thanks,
Zheng