Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp741311ybk; Wed, 20 May 2020 10:47:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEtzQyPDxVQyvM2byHxIvec7fqILVu88QpGJNlXsBHp9j9QWaOGut9kKFK5W4eQrTeLiCp X-Received: by 2002:a05:6402:3092:: with SMTP id de18mr4555588edb.109.1589996844238; Wed, 20 May 2020 10:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589996844; cv=none; d=google.com; s=arc-20160816; b=tKI4+cJVa4OzlVbnTdG9J4a4cXZqz8MRtKqIksXoUmS1oP0TcNCrceIhHdqTryyki7 kzqlN2ehNCMlKEsL8p/tu90/SBgQ4apzbNQyW+KrUb8ZvRIwNjb1omUArdoh+Afz7siT 26eyIjAL31v4GI/HaHkyADZlObfgYTiqes+Hcf4dcJGmVZ2QuhscwrKVQx+VCcV8ffVs bYlPZ8lZw+8nRUB5Jv5TQ/iYqCPQiy1R6kuTy0YcJLINoe/xrbIL1Kg8m3epyADjCX01 vCtEy42x1Of1CpirF0fSopzkNI2YS8YV3NPDfT5+Ix5/wv4hSxwynhcvNbOzzn1YpxU1 66qg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ONBjhvxmmLx/oFEUC29tsSCUvL8weOBm8pkR1Gl2nDk=; b=FUuO8EPHgsEeu6KYwz+xAOBe5IaCduutjjlmEgB+vo/srRSPx5cA9PFM/tlNop2urC iLtwqJFAotdAXBUY9QExgwPu21LTVQSnIXSAkFMSfHJ7RWDU+bijveRQivzXcm7KdlS7 6uk3cFpSAC72ofJz0R7HE78OTXQA6EutYXCofZ6IURyOw6A4YoTY+t8z5sClZDJBTSZb Gyo4E7Jr/gHLzbzHEo7rzZ9K1QmbGrF3IyFDlNsXiI6hSpy9soHvaBFItd7CnOAPkw89 IWDt3zMOIRm3yTrrpEUwBUH3IXD2rtzu3H2KmFGf7s1KbZ4Ix9H1wvCV9CaJw28KgEzB Xniw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1910358edl.294.2020.05.20.10.47.01; Wed, 20 May 2020 10:47:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726893AbgETRng (ORCPT + 99 others); Wed, 20 May 2020 13:43:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32574 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbgETRnf (ORCPT ); Wed, 20 May 2020 13:43:35 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04KHY4Nc081243; Wed, 20 May 2020 13:43:15 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 312bg8rjrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 May 2020 13:43:14 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 04KHfGB7019054; Wed, 20 May 2020 17:43:12 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 313x2j1q2n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 May 2020 17:43:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04KHhADf1900976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 May 2020 17:43:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3914111C04A; Wed, 20 May 2020 17:43:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8FF411C04C; Wed, 20 May 2020 17:43:09 +0000 (GMT) Received: from pomme.tlslab.ibm.com (unknown [9.145.151.133]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 20 May 2020 17:43:09 +0000 (GMT) From: Laurent Dufour To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, paulus@samba.org Cc: groug@kaod.org, mpe@ellerman.id.au, sukadev@linux.ibm.com, linuxram@us.ibm.com Subject: [PATCH v2] KVM: PPC: Book3S HV: relax check on H_SVM_INIT_ABORT Date: Wed, 20 May 2020 19:43:08 +0200 Message-Id: <20200520174308.77820-1-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520193259.0b66db32@bahia.lan> References: <20200520193259.0b66db32@bahia.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.676 definitions=2020-05-20_13:2020-05-20,2020-05-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 bulkscore=0 cotscore=-2147483648 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005200142 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commit 8c47b6ff29e3 ("KVM: PPC: Book3S HV: Check caller of H_SVM_* Hcalls") added checks of secure bit of SRR1 to filter out the Hcall reserved to the Ultravisor. However, the Hcall H_SVM_INIT_ABORT is made by the Ultravisor passing the context of the VM calling UV_ESM. This allows the Hypervisor to return to the guest without going through the Ultravisor. Thus the Secure bit of SRR1 is not set in that particular case. In the case a regular VM is calling H_SVM_INIT_ABORT, this hcall will be filtered out in kvmppc_h_svm_init_abort() because kvm->arch.secure_guest is not set in that case. Fixes: 8c47b6ff29e3 ("KVM: PPC: Book3S HV: Check caller of H_SVM_* Hcalls") Signed-off-by: Laurent Dufour --- arch/powerpc/kvm/book3s_hv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 93493f0cbfe8..6ad1a3b14300 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1099,9 +1099,12 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) ret = kvmppc_h_svm_init_done(vcpu->kvm); break; case H_SVM_INIT_ABORT: - ret = H_UNSUPPORTED; - if (kvmppc_get_srr1(vcpu) & MSR_S) - ret = kvmppc_h_svm_init_abort(vcpu->kvm); + /* + * Even if that call is made by the Ultravisor, the SSR1 value + * is the guest context one, with the secure bit clear as it has + * not yet been secured. So we can't check it here. + */ + ret = kvmppc_h_svm_init_abort(vcpu->kvm); break; default: -- 2.26.2