All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kenta Akagi" <k@mgml.me>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 5.15.y v3 4/7] KVM: x86/mmu: Always pass 0 for @quadrant when gptes are 8 bytes
Date: Sun, 13 Sep 2026 16:49:17 +0000	[thread overview]
Message-ID: <20260913164917.E2F2C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913155523.7423-5-k@mgml.me>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Guest-triggerable WARN_ON_ONCE in mmu_alloc_root causing host DoS.
--

commit 990a474db7a6b43a7cc3e9446db94141ba6c88d1
Author: Paolo Bonzini <pbonzini@redhat.com>

KVM: x86/mmu: Always pass 0 for @quadrant when gptes are 8 bytes

The quadrant is only used when gptes are 4 bytes, but
mmu_alloc_{direct,shadow}_roots() pass in a non-zero quadrant for PAE
page directories regardless. Make this less confusing by only passing in
a non-zero quadrant when it is actually necessary.

> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index b0504d40ac8c6..b7801690ea175 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -3474,9 +3474,10 @@ static hpa_t mmu_alloc_root(struct kvm_vcpu *vcpu, gfn_t gfn, int quadrant,
>  	struct kvm_mmu_page *sp;
>  
>  	role.level = level;
> +	role.quadrant = quadrant;
>  
> -	if (!role.gpte_is_8_bytes)
> -		role.quadrant = quadrant;
> +	WARN_ON_ONCE(quadrant && role.gpte_is_8_bytes);
> +	WARN_ON_ONCE(role.direct && !role.gpte_is_8_bytes);

[Severity: High]
Can this assertion be triggered by a guest on a host using a shadow MMU?

If a guest disables paging (CR0.PG=0) while the host is using a shadow MMU
(e.g., TDP is disabled), KVM computes the MMU role in
kvm_calc_shadow_mmu_root_page_role(), setting role.base.direct = 1 and
role.base.gpte_is_8_bytes = 0.

When KVM later allocates roots for this direct MMU via
mmu_alloc_direct_roots(), it calls mmu_alloc_root(), which causes this
WARN_ON_ONCE to evaluate to true and fire, resulting in a host DoS
that is reachable by any malicious or misconfigured guest.

This issue does not appear to be fixed in subsequent patches in this series.

>  
>  	sp = kvm_mmu_get_page(vcpu, gfn, role);
>  	++sp->root_count;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260913155523.7423-1-k@mgml.me?part=4

  reply	other threads:[~2026-09-13 16:49 UTC|newest]

Thread overview: 16+ 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-13 16:56   ` sashiko-bot
2026-09-15  2:03   ` Sasha Levin
2026-09-24 17:10     ` Sean Christopherson
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-13 16:49   ` sashiko-bot [this message]
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 16:51   ` sashiko-bot
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=20260913164917.E2F2C1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=k@mgml.me \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.