Patch "RISC-V: KVM: Fix sbiret init before forwarding to userspace" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RISC-V: KVM: Fix sbiret init before forwarding to userspace

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     risc-v-kvm-fix-sbiret-init-before-forwarding-to-user.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4ea3cb21d6d42284fd9b10004130d1e14b0815f4
Author: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
Date:   Wed Aug 7 17:49:44 2024 +0200

    RISC-V: KVM: Fix sbiret init before forwarding to userspace
    
    [ Upstream commit 6b7b282e6baea06ba65b55ae7d38326ceb79cebf ]
    
    When forwarding SBI calls to userspace ensure sbiret.error is
    initialized to SBI_ERR_NOT_SUPPORTED first, in case userspace
    neglects to set it to anything. If userspace neglects it then we
    can't be sure it did anything else either, so we just report it
    didn't do or try anything. Just init sbiret.value to zero, which is
    the preferred value to return when nothing special is specified.
    
    KVM was already initializing both sbiret.error and sbiret.value, but
    the values used appear to come from a copy+paste of the __sbi_ecall()
    implementation, i.e. a0 and a1, which don't apply prior to the call
    being executed, nor at all when forwarding to userspace.
    
    Fixes: dea8ee31a039 ("RISC-V: KVM: Add SBI v0.1 support")
    Signed-off-by: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240807154943.150540-2-ajones@xxxxxxxxxxxxxxxx
    Signed-off-by: Anup Patel <anup@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/kvm/vcpu_sbi.c b/arch/riscv/kvm/vcpu_sbi.c
index 9cd97091c7233..7a7fe40d0930b 100644
--- a/arch/riscv/kvm/vcpu_sbi.c
+++ b/arch/riscv/kvm/vcpu_sbi.c
@@ -91,8 +91,8 @@ void kvm_riscv_vcpu_sbi_forward(struct kvm_vcpu *vcpu, struct kvm_run *run)
 	run->riscv_sbi.args[3] = cp->a3;
 	run->riscv_sbi.args[4] = cp->a4;
 	run->riscv_sbi.args[5] = cp->a5;
-	run->riscv_sbi.ret[0] = cp->a0;
-	run->riscv_sbi.ret[1] = cp->a1;
+	run->riscv_sbi.ret[0] = SBI_ERR_NOT_SUPPORTED;
+	run->riscv_sbi.ret[1] = 0;
 }
 
 void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux