* FAILED: patch "[PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect" failed to apply to 5.4-stable tree
@ 2020-07-13 16:00 gregkh
2020-07-13 18:59 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-07-13 16:00 UTC (permalink / raw)
To: steven.price, james.morse, maz; +Cc: stable
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 66b7e05dc0239c5817859f261098ba9cc2efbd2b Mon Sep 17 00:00:00 2001
From: Steven Price <steven.price@arm.com>
Date: Wed, 17 Jun 2020 11:54:56 +0100
Subject: [PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect
with SVE
If SVE is enabled then 'ret' can be assigned the return value of
kvm_vcpu_enable_sve() which may be 0 causing future "goto out" sites to
erroneously return 0 on failure rather than -EINVAL as expected.
Remove the initialisation of 'ret' and make setting the return value
explicit to avoid this situation in the future.
Fixes: 9a3cdf26e336 ("KVM: arm64/sve: Allow userspace to enable SVE for vcpus")
Cc: stable@vger.kernel.org
Reported-by: James Morse <james.morse@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200617105456.28245-1-steven.price@arm.com
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index d3b209023727..6ed36be51b4b 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -245,7 +245,7 @@ static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu)
*/
int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
{
- int ret = -EINVAL;
+ int ret;
bool loaded;
u32 pstate;
@@ -269,15 +269,19 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) ||
test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) {
- if (kvm_vcpu_enable_ptrauth(vcpu))
+ if (kvm_vcpu_enable_ptrauth(vcpu)) {
+ ret = -EINVAL;
goto out;
+ }
}
switch (vcpu->arch.target) {
default:
if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) {
- if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1))
+ if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1)) {
+ ret = -EINVAL;
goto out;
+ }
pstate = VCPU_RESET_PSTATE_SVC;
} else {
pstate = VCPU_RESET_PSTATE_EL1;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect" failed to apply to 5.4-stable tree
2020-07-13 16:00 FAILED: patch "[PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect" failed to apply to 5.4-stable tree gregkh
@ 2020-07-13 18:59 ` Sasha Levin
2020-07-14 6:08 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2020-07-13 18:59 UTC (permalink / raw)
To: gregkh; +Cc: steven.price, james.morse, maz, stable
On Mon, Jul 13, 2020 at 06:00:59PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 5.4-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 66b7e05dc0239c5817859f261098ba9cc2efbd2b Mon Sep 17 00:00:00 2001
>From: Steven Price <steven.price@arm.com>
>Date: Wed, 17 Jun 2020 11:54:56 +0100
>Subject: [PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect
> with SVE
>
>If SVE is enabled then 'ret' can be assigned the return value of
>kvm_vcpu_enable_sve() which may be 0 causing future "goto out" sites to
>erroneously return 0 on failure rather than -EINVAL as expected.
>
>Remove the initialisation of 'ret' and make setting the return value
>explicit to avoid this situation in the future.
>
>Fixes: 9a3cdf26e336 ("KVM: arm64/sve: Allow userspace to enable SVE for vcpus")
>Cc: stable@vger.kernel.org
>Reported-by: James Morse <james.morse@arm.com>
>Signed-off-by: Steven Price <steven.price@arm.com>
>Signed-off-by: Marc Zyngier <maz@kernel.org>
>Link: https://lore.kernel.org/r/20200617105456.28245-1-steven.price@arm.com
I've worked around not having 540f76d12c66 ("arm64: cpufeature: Add CPU
capability for AArch32 EL1 support") in 5.7 and 5.4 and queued this
patch.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect" failed to apply to 5.4-stable tree
2020-07-13 18:59 ` Sasha Levin
@ 2020-07-14 6:08 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-07-14 6:08 UTC (permalink / raw)
To: Sasha Levin; +Cc: steven.price, james.morse, maz, stable
On Mon, Jul 13, 2020 at 02:59:01PM -0400, Sasha Levin wrote:
> On Mon, Jul 13, 2020 at 06:00:59PM +0200, gregkh@linuxfoundation.org wrote:
> >
> > The patch below does not apply to the 5.4-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> >
> > thanks,
> >
> > greg k-h
> >
> > ------------------ original commit in Linus's tree ------------------
> >
> > > From 66b7e05dc0239c5817859f261098ba9cc2efbd2b Mon Sep 17 00:00:00 2001
> > From: Steven Price <steven.price@arm.com>
> > Date: Wed, 17 Jun 2020 11:54:56 +0100
> > Subject: [PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect
> > with SVE
> >
> > If SVE is enabled then 'ret' can be assigned the return value of
> > kvm_vcpu_enable_sve() which may be 0 causing future "goto out" sites to
> > erroneously return 0 on failure rather than -EINVAL as expected.
> >
> > Remove the initialisation of 'ret' and make setting the return value
> > explicit to avoid this situation in the future.
> >
> > Fixes: 9a3cdf26e336 ("KVM: arm64/sve: Allow userspace to enable SVE for vcpus")
> > Cc: stable@vger.kernel.org
> > Reported-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Steven Price <steven.price@arm.com>
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > Link: https://lore.kernel.org/r/20200617105456.28245-1-steven.price@arm.com
>
> I've worked around not having 540f76d12c66 ("arm64: cpufeature: Add CPU
> capability for AArch32 EL1 support") in 5.7 and 5.4 and queued this
> patch.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-14 6:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-13 16:00 FAILED: patch "[PATCH] KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect" failed to apply to 5.4-stable tree gregkh
2020-07-13 18:59 ` Sasha Levin
2020-07-14 6:08 ` Greg KH
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).