All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: frankja@linux.ibm.com
Cc: borntraeger@de.ibm.com, cohuck@redhat.com, david@redhat.com,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	thuth@redhat.com, stable@kernel.org
Subject: [PATCH/FIXUP FOR STABLE BEFORE THIS SERIES] KVM: s390: do not clobber user space fpc during guest reset
Date: Thu, 30 Jan 2020 09:55:00 +0100	[thread overview]
Message-ID: <1580374500-31247-1-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <20200129200312.3200-2-frankja@linux.ibm.com>

The initial CPU reset currently clobbers the userspace fpc. This was an
oversight during a fixup for the lazy fpu reloading rework.  The reset
calls are only done from userspace ioctls. No CPU context is loaded, so
we can (and must) act directly on the sync regs, not on the thread
context. Otherwise the fpu restore call will restore the zeroes fpc to
userspace.

Cc: stable@kernel.org
Fixes: 9abc2a08a7d6 ("KVM: s390: fix memory overwrites when vx is disabled")
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c059b86..eb789cd 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2824,8 +2824,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
 	vcpu->arch.sie_block->gcr[14] = CR14_UNUSED_32 |
 					CR14_UNUSED_33 |
 					CR14_EXTERNAL_DAMAGE_SUBMASK;
-	/* make sure the new fpc will be lazily loaded */
-	save_fpu_regs();
+	vcpu->run->s.regs.fpc = 0;
 	current->thread.fpu.fpc = 0;
 	vcpu->arch.sie_block->gbea = 1;
 	vcpu->arch.sie_block->pp = 0;
-- 
1.8.3.1

  reply	other threads:[~2020-01-30  8:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 20:03 [PATCH v8 0/4] KVM: s390: Add new reset vcpu API Janosch Frank
2020-01-29 20:03 ` [PATCH v8 1/4] " Janosch Frank
2020-01-30  8:55   ` Christian Borntraeger [this message]
2020-01-30  9:49     ` [PATCH/FIXUP FOR STABLE BEFORE THIS SERIES] KVM: s390: do not clobber user space fpc during guest reset David Hildenbrand
2020-01-30 10:39       ` Cornelia Huck
2020-01-30 10:56         ` Thomas Huth
2020-01-30 11:07           ` Christian Borntraeger
2020-01-30 11:01       ` Christian Borntraeger
2020-01-30 11:14         ` Christian Borntraeger
2020-01-30 11:20           ` David Hildenbrand
2020-01-30 11:27             ` Christian Borntraeger
2020-01-30 11:42               ` [PATCH v2] KVM: s390: do not clobber user space registers during guest reset/store status Christian Borntraeger
2020-01-30 11:44                 ` Christian Borntraeger
2020-01-30 11:44                   ` Christian Borntraeger
2020-01-30 12:01                 ` Christian Borntraeger
2020-01-30 12:01                   ` Christian Borntraeger
2020-01-30 12:38                   ` David Hildenbrand
2020-01-30  9:00   ` [PATCH v8 1/4] KVM: s390: Add new reset vcpu API Thomas Huth
2020-01-30  9:58   ` Christian Borntraeger
2020-01-29 20:03 ` [PATCH v8 2/4] selftests: KVM: Add fpu and one reg set/get library functions Janosch Frank
2020-01-30 10:36   ` Thomas Huth
2020-01-30 13:55     ` Andrew Jones
2020-01-30 14:10       ` Janosch Frank
2020-01-30 14:30         ` Andrew Jones
2020-01-30 14:58           ` Janosch Frank
2020-01-30 15:04             ` Andrew Jones
2020-01-29 20:03 ` [PATCH v8 3/4] selftests: KVM: s390x: Add reset tests Janosch Frank
2020-01-30 10:51   ` Thomas Huth
2020-01-30 11:32     ` Janosch Frank
2020-01-30 11:36       ` Thomas Huth
2020-01-29 20:03 ` [PATCH v8 4/4] selftests: KVM: testing the local IRQs resets Janosch Frank
2020-01-30 10:55   ` Cornelia Huck
2020-01-30 11:18     ` Janosch Frank
2020-01-30 11:28       ` Cornelia Huck
2020-01-30 11:34         ` Janosch Frank
2020-01-30 11:10   ` Thomas Huth
2020-01-30 11:33     ` Janosch Frank
2020-01-30  9:10 ` [PATCH] KVM: s390: Cleanup initial cpu reset Janosch Frank

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=1580374500-31247-1-git-send-email-borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.