From: "Nutty Liu" <liujingqi@lanxincomputing.com>
To: "Radim Krčmář" <rkrcmar@ventanamicro.com>, kvm-riscv@lists.infradead.org
Cc: <kvm@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
"Anup Patel" <anup@brainfault.org>,
"Atish Patra" <atishp@atishpatra.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] RISC-V: KVM: fix stack overrun when loading vlenb
Date: Wed, 6 Aug 2025 18:05:02 +0800 [thread overview]
Message-ID: <3d7df3b0-27c5-47a2-a4a1-dde168e7848e@lanxincomputing.com> (raw)
In-Reply-To: <20250805104418.196023-4-rkrcmar@ventanamicro.com>
On 8/5/2025 6:44 PM, Radim Krčmář wrote:
> The userspace load can put up to 2048 bits into an xlen bit stack
> buffer. We want only xlen bits, so check the size beforehand.
>
> Fixes: 2fa290372dfe ("RISC-V: KVM: add 'vlenb' Vector CSR")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
> ---
Reviewed-by: Nutty Liu <liujingqi@lanxincomputing.com>
Thanks,
Nutty
> arch/riscv/kvm/vcpu_vector.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kvm/vcpu_vector.c b/arch/riscv/kvm/vcpu_vector.c
> index a5f88cb717f3..05f3cc2d8e31 100644
> --- a/arch/riscv/kvm/vcpu_vector.c
> +++ b/arch/riscv/kvm/vcpu_vector.c
> @@ -182,6 +182,8 @@ int kvm_riscv_vcpu_set_reg_vector(struct kvm_vcpu *vcpu,
> struct kvm_cpu_context *cntx = &vcpu->arch.guest_context;
> unsigned long reg_val;
>
> + if (reg_size != sizeof(reg_val))
> + return -EINVAL;
> if (copy_from_user(®_val, uaddr, reg_size))
> return -EFAULT;
> if (reg_val != cntx->vector.vlenb)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2025-08-06 10:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 10:44 [PATCH] RISC-V: KVM: fix stack overrun when loading vlenb Radim Krčmář
2025-08-06 9:59 ` Daniel Henrique Barboza
2025-08-06 10:05 ` Nutty Liu [this message]
2025-08-22 11:28 ` Anup Patel
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=3d7df3b0-27c5-47a2-a4a1-dde168e7848e@lanxincomputing.com \
--to=liujingqi@lanxincomputing.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@atishpatra.org \
--cc=dbarboza@ventanamicro.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rkrcmar@ventanamicro.com \
--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;
as well as URLs for NNTP newsgroup(s).