From: Sean Christopherson <seanjc@google.com>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
stable@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Peter Xu <peterx@redhat.com>,
David Matlack <dmatlack@google.com>, Kenta Akagi <k@mgml.me>
Subject: Re: [PATCH 5.15.y v3 3/7] KVM: x86/mmu: Derive shadow MMU page role from parent
Date: Thu, 24 Sep 2026 10:10:22 -0700 [thread overview]
Message-ID: <arVZfjUskXC54OKZ@google.com> (raw)
In-Reply-To: <daily-reply-0006-re-kvm-mmu-derive-child-role-5-15@kernel.org>
On Mon, Sep 14, 2026, Sasha Levin wrote:
> > - role.direct = direct;
> > - if (role.direct)
> > - role.gpte_is_8_bytes = true;
> > [...]
> > + if (!role.gpte_is_8_bytes) {
> > + struct kvm_mmu_page *parent_sp = sptep_to_sp(sptep);
> > + role.quadrant = (sptep - parent_sp->spt) % 2;
>
> The "if (role.direct) role.gpte_is_8_bytes = true;" that kvm_mmu_get_page()
> used to do is removed here, and kvm_mmu_child_role() does not put it back.
>
> That works upstream because the field there is has_4_byte_gpte, which
> defaults to 0. On 5.15 the field is gpte_is_8_bytes, the inverse, so the
> translation flips: for a non-paging guest
> kvm_calc_shadow_root_page_role_common() leaves gpte_is_8_bytes at 0 while
> kvm_calc_shadow_mmu_root_page_role() sets direct to 1, and a direct shadow
> page ends up with a quadrant stamped onto it.
>
> Keeping "if (role.direct) role.gpte_is_8_bytes = true;" in
> kvm_mmu_child_role() preserves the upstream behaviour. The alternative is to
> backport the upstream role-computation change first so the field carries the
> mainline sense.
I vote to backport the relevant upstream commits. Reviewing this without those
commits is a pain. I think it's these, to get fairly clean cherry-picks?
dc1ce45575b3401102568dd60ba8894849d1d64b KVM: MMU: update comment on the number of page role combinations
41e35604eaff2266ba8523787ebe99c5ca4c4045 KVM: X86: Remove useless code to set role.gpte_is_8_bytes when role.direct
b46a13cb7ea1137b2e01dfaafcacd5cd79db8390 KVM: X86: Calculate quadrant when !role.gpte_is_8_bytes
bb3b394d35e80d7a58ce015191e4960a13f54ba5 KVM: X86: Rename gpte_is_8_bytes to has_4_byte_gpte and invert the direction
next prev parent reply other threads:[~2026-09-24 17:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 15:55 [PATCH 5.15.y v3 0/7] KVM: fixes for CVE-2026-46113 and related issues Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 1/7] KVM: x86/mmu: Use a bool for direct Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 2/7] KVM: x86/mmu: Stop passing "direct" to mmu_alloc_root() Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 3/7] KVM: x86/mmu: Derive shadow MMU page role from parent Kenta Akagi
2026-09-15 2:03 ` Sasha Levin
2026-09-24 17:10 ` Sean Christopherson [this message]
2026-09-25 18:48 ` Sasha Levin
2026-09-26 17:21 ` Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 4/7] KVM: x86/mmu: Always pass 0 for @quadrant when gptes are 8 bytes Kenta Akagi
2026-09-15 2:03 ` Sasha Levin
2026-09-13 15:55 ` [PATCH 5.15.y v3 5/7] KVM: x86/mmu: pull call to drop_large_spte() into __link_shadow_page() Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 6/7] KVM: x86: Fix shadow paging use-after-free due to unexpected GFN Kenta Akagi
2026-09-13 15:55 ` [PATCH 5.15.y v3 7/7] KVM: x86: Fix shadow paging use-after-free due to unexpected role Kenta Akagi
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=arVZfjUskXC54OKZ@google.com \
--to=seanjc@google.com \
--cc=dmatlack@google.com \
--cc=k@mgml.me \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®