Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3178103pxb; Tue, 19 Jan 2021 16:20:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqD3h+Hd3ucIRNk/exiJWREtHSo2WQ3csFtnfY/UY4dDUPcBpE4FhI3yeAsoZCk0pmYTLQ X-Received: by 2002:a50:d88c:: with SMTP id p12mr5339145edj.370.1611102002737; Tue, 19 Jan 2021 16:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611102002; cv=none; d=google.com; s=arc-20160816; b=TRPV/MkWUE5c7UhPBHwnNl0XWcc3dm2lhSJav90OlZOREF2J753BSPrp+LfDw9z19i RDe0PY6LrLj6r2Vtc7kgC6oLn7LCj+C9n4ae/Dqd62mImLfT4AsEULKA6LauxxKMxt33 62GBJsGve90oRzDmu/ym5jwidSyTwSJhEJAdmHirETNcZv8GOnRJpyL00HVMy7pveIcp MQ+nYaYZvblCidaFUvn4SLDlrKWS2pZkgIw7fzbzN0TOkWNUZtc7gcuUpBllRNbE/m2u 4M5m6cZYMAOg+edCVzNmVLtOl0lP9I1wGxJgSSbolednvs6AVCY6VtJKlhEgT6fpvdQD byMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=pI8DH5iddocIjC9tQlGBxX2liT4Q6zyunDLbb5JOrMw=; b=mXpvU1Lr1eqTmzMx+uA5EICc6L4NTNHVxB1TNSkzuZjkQD+7L1nHLtDUmYQVRK/103 gAgWqasrbYRRBS5ahJJ+HJwfXa+pIgg2SFHoFB7T2l/Zel4USVec9OVdcF2KgyhkoztY fx1KJQ1B6ubxLK/mx/Hr2niK1icKwHfxEC2wqMCA9Y5q8a3xpvDb+wxckQmCmf1J0mn6 PrXG6PzzkPb3v0ue3dPa9RgMGqmecwZcxFzlFIzAw8KPV8wzeV5+uZfIs0mfhasIkSXO zkFq8r1w6AI/F+z/yIaM8U8hGUEqjyF3TTWxgt6kO+z9IpSbSqb/RMnsX5ZcDuTTshar S6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=UtEPhdcz; 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=pass (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 y15si175599edv.392.2021.01.19.16.19.37; Tue, 19 Jan 2021 16:20:02 -0800 (PST) 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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=UtEPhdcz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392704AbhASNqF (ORCPT + 99 others); Tue, 19 Jan 2021 08:46:05 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34002 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392251AbhASNkR (ORCPT ); Tue, 19 Jan 2021 08:40:17 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10JD41Du008842; Tue, 19 Jan 2021 08:12:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=pI8DH5iddocIjC9tQlGBxX2liT4Q6zyunDLbb5JOrMw=; b=UtEPhdczmSzWrxFSF6SaKEquXTGGVuNUGNYvZQoPWqov6ndoskRUrT+vtd/1kz+nHnvB OpHiMc8lKN/0nmhNLgOXwaNbfL4e5y8H5Yti1y3Y22RPrqEIXX04hdHolfG++aiRPtH0 inyeOTpNtK7RvdShvU0yIFv8CM3QCanoZ4TAzcrADvx2uhDulhityASGVWGpNPp/7+U4 nwz65+kyBY1LeZHhH9CbcIh6CTwu6JYvTlV6d3Zs+egD9yf/SSRKUF7bjuygym2eH+3L TNtPC+1XdmqDxtdURFL2AAMQUvpIiJvXfd/Ke5aWT1zMaR1Xraqp8LmF+iA/UZ5HN0Eh 8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 365xseahnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Jan 2021 08:12:14 -0500 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 10JD4O9n010292; Tue, 19 Jan 2021 08:12:14 -0500 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 365xseahmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Jan 2021 08:12:14 -0500 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10JCvPq1023175; Tue, 19 Jan 2021 13:12:11 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma05fra.de.ibm.com with ESMTP id 363qs89k53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Jan 2021 13:12:11 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10JDC8HG33161546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jan 2021 13:12:08 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62CDFA4059; Tue, 19 Jan 2021 13:12:08 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1AE6A4051; Tue, 19 Jan 2021 13:12:07 +0000 (GMT) Received: from ibm-vm (unknown [9.145.4.167]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 19 Jan 2021 13:12:07 +0000 (GMT) Date: Tue, 19 Jan 2021 14:09:50 +0100 From: Claudio Imbrenda To: Janosch Frank Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, thuth@redhat.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, gor@linux.ibm.com, mihajlov@linux.ibm.com Subject: Re: [PATCH 2/2] s390: mm: Fix secure storage access exception handling Message-ID: <20210119140950.2e41f1bf@ibm-vm> In-Reply-To: <20210119100402.84734-3-frankja@linux.ibm.com> References: <20210119100402.84734-1-frankja@linux.ibm.com> <20210119100402.84734-3-frankja@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-19_04:2021-01-18,2021-01-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=0 adultscore=0 spamscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101190077 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Jan 2021 05:04:02 -0500 Janosch Frank wrote: > Turns out that the bit 61 in the TEID is not always 1 and if that's > the case the address space ID and the address are > unpredictable. Without an address and it's address space ID we can't *its Reviewed-by: Claudio Imbrenda > export memory and hence we can only send a SIGSEGV to the process or > panic the kernel depending on who caused the exception. > > Signed-off-by: Janosch Frank > Fixes: 084ea4d611a3d ("s390/mm: add (non)secure page access > exceptions handlers") Cc: stable@vger.kernel.org > --- > arch/s390/mm/fault.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c > index e30c7c781172..5442937e5b4b 100644 > --- a/arch/s390/mm/fault.c > +++ b/arch/s390/mm/fault.c > @@ -791,6 +791,20 @@ void do_secure_storage_access(struct pt_regs > *regs) struct page *page; > int rc; > > + /* There are cases where we don't have a TEID. */ > + if (!(regs->int_parm_long & 0x4)) { > + /* > + * Userspace could for example try to execute secure > + * storage and trigger this. We should tell it that > it > + * shouldn't do that. > + */ > + if (user_mode(regs)) { > + send_sig(SIGSEGV, current, 0); > + return; > + } else > + panic("Unexpected PGM 0x3d with TEID bit > 61=0"); > + } > + > switch (get_fault_type(regs)) { > case USER_FAULT: > mm = current->mm;