]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86: Fix wall clock writes in Xen shared_info not to mark page dirty
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sat, 20 Nov 2021 18:00:36 +0000 (18:00 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 21 Nov 2021 12:40:43 +0000 (12:40 +0000)
commit0d0818ae48ce1e1bac4a14cad454e0283307fa7c
treea63ee4269ca6b8898c596cb9ae8fb0defa18603a
parent5ad923ae3b973fe83d39117f6b8edf9eef77ee6c
KVM: x86: Fix wall clock writes in Xen shared_info not to mark page dirty

When dirty ring logging is enabled, any dirty logging without an active
vCPU context will cause a kernel oops. But we've already declared that
the shared_info page doesn't get dirty tracking anyway, since it would
be kind of insane to mark it dirty every time we deliver an event channel
interrupt. Userspace is supposed to just assume it's always dirty any
time a vCPU can run or event channels are routed.

So stop using the generic kvm_write_wall_clock() and just write directly
through the gfn_to_pfn_cache that we already have set up.

We can make kvm_write_wall_clock() static in x86.c again now, but let's
not remove the 'sec_hi_ofs' argument even though it's not used yet. At
some point we *will* want to use that for KVM guests too.

Fixes: 629b5348841a ("KVM: x86/xen: update wallclock region")
Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h
arch/x86/kvm/xen.c