Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3700273ybv; Mon, 10 Feb 2020 04:58:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzw99a0d5jV6sZs7j64lnNqNsjn0lTpoMuXErMNLr+4QsHd4D6Q0TUfU4u24te551BIDjC+ X-Received: by 2002:a9d:67c9:: with SMTP id c9mr965132otn.67.1581339509602; Mon, 10 Feb 2020 04:58:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339509; cv=none; d=google.com; s=arc-20160816; b=iabQVsSA9ICVIQYLvNj7aZFtVLQEhqXGCXaPUFiq6dTOOeNgT5LxT92tVCLmivSpgr 95y/MucD5FPGVGBW0i0UaIYOSq8KWRGOdjAG0LZh+se0GAlAVPOFOYGoC6OYqnpqNs+V pxJ691sa1l2SBL8gD6bDJmUp5m58bTeyl1b0RNecvPljtCjx0zz/ALrjVDkLWnunQX4b DpZiA9IWb749Z4za2Hvh0BbgrtqDJ/DtN5+AZMMPWdzIcCIV+zr6Bj6ZhL/Wjh0zD6Ex 8Xk1NpboMoYFMbpeMwInTvSqJlD3z6ZYHu0qPeb+5pZQGqTWNJYdjxeVz1pw7xv14HD0 KTKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RwCWQlfVa4s0udTq/auvqG25IXsExKcM8S5NdsoaqLo=; b=ebFEJeaLjoDhBaJ2WccYJfJ3fxP04aIC7Qgdnb46uHLmMKLsQUIIrzHvgu+Ok/+Cyo RZpZ5kFi3qFtNjD51EbaVHc2VOr3zFt4cVO2bvSdFF2w5YKqmuQW/6U6oeOqs7xwjgWI H0orzho31vlcaJmNbFrRG3BVSvYhR8afHsA6YegpgXEBL82OwKzHSXvoqY/S/c/6d/aX 8DLgwIm4qps6aWkhDKWufyK24i3XimUvb2gZzeAxQftTK7SWsoeU21wufltEwdLR9a91 LECU1WWV+HVOwzAqpdzxQSwa92zCuJr/QFeEyUmourjks21X5DbVcb1cLwni02YCDurs L0mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXx0A5BN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s20si157482otp.4.2020.02.10.04.58.17; Mon, 10 Feb 2020 04:58:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXx0A5BN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730211AbgBJM6N (ORCPT + 99 others); Mon, 10 Feb 2020 07:58:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:43344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729969AbgBJMlV (ORCPT ); Mon, 10 Feb 2020 07:41:21 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7397E2051A; Mon, 10 Feb 2020 12:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338481; bh=ZUu47upwjUFLICrdCrNbo88EzvpQJD47DTK6GhaZXEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXx0A5BNVWE7P/5/BY/IsT4kkL0bptiSQeBpY7SoIAmYLsdOie7zIHilD/TC1BYqG 7dQgf75LeoobH20poewuLLFr1qatNig5mIQPsePHko0OoR6vRk5y22IATiM3s/fwc9 /GIamMykSHPiiHkaGuulHHHucAXQ+2KdfC7cgyRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Christian Borntraeger , David Hildenbrand , Cornelia Huck , Janosch Frank Subject: [PATCH 5.5 258/367] KVM: s390: do not clobber registers during guest reset/store status Date: Mon, 10 Feb 2020 04:32:51 -0800 Message-Id: <20200210122448.301644683@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Borntraeger commit 55680890ea78be0df5e1384989f1be835043c084 upstream. The initial CPU reset clobbers the userspace fpc and the store status ioctl clobbers the guest acrs + fpr. As these calls are only done via ioctl (and not via vcpu_run), no CPU context is loaded, so we can (and must) act directly on the sync regs, not on the thread context. Cc: stable@kernel.org Fixes: e1788bb995be ("KVM: s390: handle floating point registers in the run ioctl not in vcpu_put/load") Fixes: 31d8b8d41a7e ("KVM: s390: handle access registers in the run ioctl not in vcpu_put/load") Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck Signed-off-by: Janosch Frank Link: https://lore.kernel.org/r/20200131100205.74720-2-frankja@linux.ibm.com Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/kvm-s390.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2860,9 +2860,7 @@ static void kvm_s390_vcpu_initial_reset( 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(); - current->thread.fpu.fpc = 0; + vcpu->run->s.regs.fpc = 0; vcpu->arch.sie_block->gbea = 1; vcpu->arch.sie_block->pp = 0; vcpu->arch.sie_block->fpf &= ~FPF_BPBC; @@ -4351,7 +4349,7 @@ long kvm_arch_vcpu_ioctl(struct file *fi switch (ioctl) { case KVM_S390_STORE_STATUS: idx = srcu_read_lock(&vcpu->kvm->srcu); - r = kvm_s390_vcpu_store_status(vcpu, arg); + r = kvm_s390_store_status_unloaded(vcpu, arg); srcu_read_unlock(&vcpu->kvm->srcu, idx); break; case KVM_S390_SET_INITIAL_PSW: {