]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
KVM: Don't set Accessed/Dirty bits for ZERO_PAGE
authorSean Christopherson <seanjc@google.com>
Fri, 29 Apr 2022 01:04:09 +0000 (01:04 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:56:34 +0000 (11:56 +0200)
commit35cccc71a7b0b4e14c17dc7f0b9eb3a06d553b69
tree8333cda21c7631609e6abfac9e32afb0f020084a
parent3f7759d86c68ecd51963437356160eaec983fd6e
KVM: Don't set Accessed/Dirty bits for ZERO_PAGE

BugLink: https://bugs.launchpad.net/bugs/1990162
[ Upstream commit a1040b0d42acf69bb4f6dbdc54c2dcd78eea1de5 ]

Don't set Accessed/Dirty bits for a struct page with PG_reserved set,
i.e. don't set A/D bits for the ZERO_PAGE.  The ZERO_PAGE (or pages
depending on the architecture) should obviously never be written, and
similarly there's no point in marking it accessed as the page will never
be swapped out or reclaimed.  The comment in page-flags.h is quite clear
that PG_reserved pages should be managed only by their owner, and
strictly following that mandate also simplifies KVM's logic.

Fixes: 7df003c85218 ("KVM: fix overflow of zero page refcount with ksm running")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220429010416.2788472-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
virt/kvm/kvm_main.c