public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Zenghui Yu <zenghui.yu@linux.dev>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com
Subject: Re: [PATCH] KVM: arm64: Fix the descriptor address in __kvm_at_swap_desc()
Date: Tue, 17 Mar 2026 13:37:57 +0000	[thread overview]
Message-ID: <86ldfq60ga.wl-maz@kernel.org> (raw)
In-Reply-To: <20260317115748.47332-1-zenghui.yu@linux.dev>

On Tue, 17 Mar 2026 11:57:48 +0000,
Zenghui Yu <zenghui.yu@linux.dev> wrote:
> 
> From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
> 
> Using "(u64 __user *)hva + offset" to get the virtual addresses of S1/S2
> descriptors looks really wrong, if offset is not zero. What we want to get
> for swapping is hva + offset, not hva + offset*8. ;-)
> 
> Fix it.
> 
> Fixes: f6927b41d573 ("KVM: arm64: Add helper for swapping guest descriptor")
> Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
> ---
>  arch/arm64/kvm/at.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c
> index c5c5644b1878..a024d9a770dc 100644
> --- a/arch/arm64/kvm/at.c
> +++ b/arch/arm64/kvm/at.c
> @@ -1753,7 +1753,7 @@ int __kvm_at_swap_desc(struct kvm *kvm, gpa_t ipa, u64 old, u64 new)
>  	if (!writable)
>  		return -EPERM;
>  
> -	ptep = (u64 __user *)hva + offset;
> +	ptep = (void __user *)hva + offset;
>  	if (cpus_have_final_cap(ARM64_HAS_LSE_ATOMICS))
>  		r = __lse_swap_desc(ptep, old, new);
>  	else

Holy crap! How did we miss that???

Thanks a lot for spotting it, I'll queue that now.

	M.

-- 
Without deviation from the norm, progress is not possible.


  reply	other threads:[~2026-03-17 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 11:57 [PATCH] KVM: arm64: Fix the descriptor address in __kvm_at_swap_desc() Zenghui Yu
2026-03-17 13:37 ` Marc Zyngier [this message]
2026-03-17 13:44 ` Marc Zyngier

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=86ldfq60ga.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=oupton@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=zenghui.yu@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