From: syzbot <syzbot+fb7c2dd166d3ea63df2a@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Re: KASAN: use-after-free Read in kvm_setup_guest_pvclock
Date: Mon, 20 Jul 2026 05:55:43 -0700 [thread overview]
Message-ID: <6a5e1acf.5028b7d0.1f0bb.0327.GAE@google.com> (raw)
In-Reply-To: <6a426dd2.854d4ab9.360e1d.0008.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: KASAN: use-after-free Read in kvm_setup_guest_pvclock
Author: halves@igalia.com
#syz test
Reported-by: syzbot+fb7c2dd166d3ea63df2a@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=fb7c2dd166d3ea63df2a
Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
---
virt/kvm/pfncache.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index 728d2c1b488a..8a766c4cd4bd 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -152,6 +152,32 @@ static inline bool mmu_notifier_retry_cache(struct kvm *kvm, unsigned long mmu_s
return kvm->mmu_invalidate_seq != mmu_seq;
}
+static void kvm_gpc_invalidate_pfn(struct kvm *kvm, kvm_pfn_t pfn)
+{
+ struct gfn_to_pfn_cache *gpc;
+
+ if (is_error_noslot_pfn(pfn))
+ return;
+
+ spin_lock(&kvm->gpc_lock);
+ list_for_each_entry(gpc, &kvm->gpc_list, list) {
+ read_lock_irq(&gpc->lock);
+
+ if (gpc->valid && gpc->pfn == pfn) {
+ read_unlock_irq(&gpc->lock);
+
+ write_lock_irq(&gpc->lock);
+ if (gpc->valid && gpc->pfn == pfn)
+ gpc->valid = false;
+ write_unlock_irq(&gpc->lock);
+ continue;
+ }
+
+ read_unlock_irq(&gpc->lock);
+ }
+ spin_unlock(&kvm->gpc_lock);
+}
+
static kvm_pfn_t hva_to_pfn_retry(struct gfn_to_pfn_cache *gpc)
{
/* Note, the new page offset may be different than the old! */
@@ -201,6 +227,7 @@ static kvm_pfn_t hva_to_pfn_retry(struct gfn_to_pfn_cache *gpc)
if (new_khva != old_khva)
gpc_unmap(new_pfn, new_khva);
+ kvm_gpc_invalidate_pfn(gpc->kvm, new_pfn);
kvm_release_page_unused(page);
cond_resched();
@@ -221,6 +248,7 @@ static kvm_pfn_t hva_to_pfn_retry(struct gfn_to_pfn_cache *gpc)
new_khva = gpc_map(new_pfn);
if (!new_khva) {
+ kvm_gpc_invalidate_pfn(gpc->kvm, new_pfn);
kvm_release_page_unused(page);
goto out_error;
}
--
2.55.0
next prev parent reply other threads:[~2026-07-20 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 13:06 [syzbot] [kvm-x86?] KASAN: use-after-free Read in kvm_setup_guest_pvclock syzbot
2026-06-30 20:10 ` syzbot
2026-07-20 12:55 ` syzbot [this message]
2026-07-20 14:27 ` Forwarded: " syzbot
2026-07-21 13:49 ` syzbot
2026-07-22 15:58 ` Forwarded: Re: [syzbot] [kvm-x86?] " syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a5e1acf.5028b7d0.1f0bb.0327.GAE@google.com \
--to=syzbot+fb7c2dd166d3ea63df2a@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox