Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amit Machhiwal" <amachhiw@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: PPC: Don't map unclassified guest state IDs onto bit 0
Date: Wed, 02 Dec 2026 18:21:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-246429@kernel.org> (raw)
In-Reply-To: <20261202181630.21203-3-amachhiw@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: PPC: missing Fixes trailer on kvmppc_gse_flatten_iden() bug
  fix
--

commit 3fb79be85605a3aaa7279630bfc52cabade894f3
Author: Amit Machhiwal <amachhiw@linux.ibm.com>

> KVM: PPC: Don't map unclassified guest state IDs onto bit 0
>
> kvmppc_gse_flatten_iden() converts a guest state ID into a bitmap
> position.  For an ID that does not belong to any guest state class it
> returns 0, which is also the valid position of KVMPPC_GSID_BLANK.  A
> caller passing such an ID therefore silently reads or modifies the
> state of an unrelated element, and because ID 0 terminates the
> kvmppc_gsbm_for_each() style iterators, a stray bit 0 also hides every
> other element from them.
>
> Return -1 for an unclassified ID instead and make the users of
> kvmppc_gse_flatten_iden() cope with it:
>
>  - kvmppc_gsp_insert(), kvmppc_gsbm_set() and kvmppc_gsbm_clear() warn
>    once and do nothing.
>  - kvmppc_gsbm_test() warns once and returns false.
>  - kvmppc_gsbm_next() warns once and ends the iteration if the previous
>    ID is unclassified.  The old "flatten(prev) + 1" form would have
>    turned -1 back into position 0, so check the result first.
>  - kvmppc_gsp_lookup() returns NULL, as for an element that is absent.
>
> The guest state buffer is produced by the L0 hypervisor.  PowerVM is not
> expected to send an element that L1 cannot interpret, but other L0
> implementations exist, for example the QEMU TCG nestedv2 model, and L1
> should not depend on that.  Elements received from L0 are already
> rejected by kvmppc_gse_parse() if their ID is unclassified, so they
> never reach these helpers.  The warnings can therefore only be triggered
> by a kernel bug, such as adding a new guest state ID without a class,
> and not by the contents of a guest state buffer.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>

[Severity: Low]
This fixes a bug in kvmppc_gse_flatten_iden() and carries a stable tag.
Should this include:

  Fixes: 6ccbbc33f06a ("KVM: PPC: Add helper library for Guest State Buffers")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202181630.21203-1-amachhiw@linux.ibm.com?part=2

      reply	other threads:[~2026-12-02 18:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:16 [PATCH 0/2] KVM: PPC: Don't alias unclassified guest state IDs onto bit 0 Amit Machhiwal
2026-12-02 18:16 ` [PATCH 1/2] KVM: PPC: Reject unknown guest state IDs in kvmppc_gse_parse() Amit Machhiwal
2026-12-02 18:16 ` [PATCH 2/2] KVM: PPC: Don't map unclassified guest state IDs onto bit 0 Amit Machhiwal
2026-12-02 18:21   ` sashiko-bot [this message]

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=sashiko-outbox-246429@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amachhiw@linux.ibm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox