From: Zenghui Yu <yuzenghui@huawei.com>
To: Ben Horgan <ben.horgan@arm.com>
Cc: <catalin.marinas@arm.com>, <will@kernel.org>, <maz@kernel.org>,
<oliver.upton@linux.dev>, <joey.gouly@arm.com>,
<suzuki.poulose@arm.com>, <linux-arm-kernel@lists.infradead.org>,
<kvmarm@lists.linux.dev>, <yury.norov@gmail.com>,
<linux@rasmusvillemoes.dk>, <linux-kernel@vger.kernel.org>,
<james.morse@arm.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH 1/2] KVM: arm64: Fix enforcement of upper bound on MDCR_EL2.HPMN
Date: Fri, 4 Jul 2025 14:44:38 +0800 [thread overview]
Message-ID: <ca3054b2-b053-3859-a992-09499809d4d4@huawei.com> (raw)
In-Reply-To: <20250703135729.1807517-2-ben.horgan@arm.com>
On 2025/7/3 21:57, Ben Horgan wrote:
> Previously, u64_replace_bits() was used to no effect as the return value
> was ignored. Convert to u64p_replace_bits() so the value is updated in
> place.
>
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> Fixes: efff9dd2fee7 ("KVM: arm64: Handle out-of-bound write to MDCR_EL2.HPMN")
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: stable@vger.kernel.org
> ---
> arch/arm64/kvm/sys_regs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 76c2f0da821f..c20bd6f21e60 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -2624,7 +2624,7 @@ static bool access_mdcr(struct kvm_vcpu *vcpu,
> */
> if (hpmn > vcpu->kvm->arch.nr_pmu_counters) {
> hpmn = vcpu->kvm->arch.nr_pmu_counters;
> - u64_replace_bits(val, hpmn, MDCR_EL2_HPMN);
> + u64p_replace_bits(&val, hpmn, MDCR_EL2_HPMN);
> }
>
> __vcpu_assign_sys_reg(vcpu, MDCR_EL2, val);
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Thanks!
next prev parent reply other threads:[~2025-07-04 6:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 13:57 [PATCH 0/2] Fix and add warning of misuse of type##_replace_bits() Ben Horgan
2025-07-03 13:57 ` [PATCH 1/2] KVM: arm64: Fix enforcement of upper bound on MDCR_EL2.HPMN Ben Horgan
2025-07-04 6:44 ` Zenghui Yu [this message]
2025-07-03 13:57 ` [PATCH 2/2] bitfield: Ensure the return value of type##_replace_bits() is checked Ben Horgan
2025-07-07 16:31 ` Yury Norov
2025-07-08 9:42 ` Ben Horgan
2025-07-08 9:45 ` Marc Zyngier
2025-07-08 14:46 ` Yury Norov
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=ca3054b2-b053-3859-a992-09499809d4d4@huawei.com \
--to=yuzenghui@huawei.com \
--cc=ben.horgan@arm.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yury.norov@gmail.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
all inboxes | Powered by JetHome®