Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp859138imu; Wed, 23 Jan 2019 06:58:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN7hv5DUKPkeRjG7MVTuERvw7RzIen3HmUvxkrKD6BvowQOQZqtW/8mvJQgTDdRWO2wReqg/ X-Received: by 2002:aa7:85d7:: with SMTP id z23mr2314235pfn.205.1548255538533; Wed, 23 Jan 2019 06:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548255538; cv=none; d=google.com; s=arc-20160816; b=nSQiTmDkHSBV0f7taeurTYTGmJMaGcuCgIml9cxtJ9dtWC552UQt7jg8NXnYTnd3m1 wDHcTui1bqjKLewCNel1IcW/gixHGvJ4LoL9TcsRQlxooqNA8U3PnHv840YLM9S61sBg BFijWl3++59pz8a4c6QEeSc6IHkNmnsiBLZSzh7/QqCsVQaqOOc+ZON4tD83BU+lGiDr jatCluWlkp5EDA0lhQboX22LE5aFBikRUC2YUNh2Qe/RzAjBKEce1nW/t0ObLSfDtoks nNduHQmtu50AMAX49zWxrz8e0UmvxW9DX31JjhUUnu2UidmMT2B7+9MsIOD3dx1bIurp 899g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0WzAEL2+nx+ZLQHNgNtnqhO5Hl0kbzE3M/nBLj6qrvo=; b=NUotyVpw4wDQIerst2hSmrrlaLqSXXrp/VO5drrCrdLomprFkUte+zjEJHlubvBFEx twa9UcrchHYgFRqutkeK3xz2OO94LxVACjoTeRhAN4GVA0N5YzaP88+1G0WhcrdnTvm1 96eXYP3zLE+IGGsiCJ1E9U9+CgNWb+N9u3MinSot9TLvgw0voZfoupF57Nqwvr5rCYsv AaxETLS2tvGDonD3I37dqr4YaBNJskSoSk3klkogpOs1k1ALi2zB/QX6cbELOJhHMJdF ebFAeZ2Ym8GJINMxufPnXvd3mmQZrL8zf0X6WZNpMrBdmhTbv76JQdWPcGF+ZOmC6LcL 20sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=h8tCjVnR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si18554854pls.73.2019.01.23.06.58.42; Wed, 23 Jan 2019 06:58:58 -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=@oracle.com header.s=corp-2018-07-02 header.b=h8tCjVnR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726029AbfAWO5h (ORCPT + 99 others); Wed, 23 Jan 2019 09:57:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:52556 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbfAWO5h (ORCPT ); Wed, 23 Jan 2019 09:57:37 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0NErfH7103115; Wed, 23 Jan 2019 14:56:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=0WzAEL2+nx+ZLQHNgNtnqhO5Hl0kbzE3M/nBLj6qrvo=; b=h8tCjVnRme9dM+Wk135i8T/ZfmOBbswLUeguuWpA476j8jFGsnZYs2oEI/ixYZVL1Ban P1l7dnMO3no3e+sjrPqGaFIWJj2VWogjSnZEADpX9usnhhmollS6uwuanJyXG3KlU3AL oqfUq7xJP+ME3KQlpyKiEauGeU3LvavXC0RnPaQBwoq71Gv6QVIcSQ2Xcmh9hQl+z85P ERSOdPyEqpNy1vjJPGYzKxfNHFQxkro5810rwERhvOFqbcCx/mOqBonAptGqOjz6xDfi w1sxaaxiLw3SWq3iUxfWjZA14q+TimKxbumIj4bm42M9B4pfe2fLEuK7/5IKLV1q58LP wg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2q3vhrt6u8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jan 2019 14:56:47 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0NEukfS015615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jan 2019 14:56:46 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0NEuhbu032386; Wed, 23 Jan 2019 14:56:43 GMT Received: from Konrads-MacBook-Pro.local (/75.104.64.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Jan 2019 06:56:42 -0800 Date: Wed, 23 Jan 2019 09:56:03 -0500 From: Konrad Rzeszutek Wilk To: Khalid Aziz Cc: juergh@gmail.com, tycho@tycho.ws, jsteckli@amazon.de, ak@linux.intel.com, torvalds@linux-foundation.org, liran.alon@oracle.com, keescook@google.com, Juerg Haefliger , deepa.srinivasan@oracle.com, chris.hyser@oracle.com, tyhicks@canonical.com, dwmw@amazon.co.uk, andrew.cooper3@citrix.com, jcm@redhat.com, boris.ostrovsky@oracle.com, kanth.ghatraju@oracle.com, joao.m.martins@oracle.com, jmattson@google.com, pradeep.vincent@oracle.com, john.haxby@oracle.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, hch@lst.de, steven.sistare@oracle.com, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tycho Andersen Subject: Re: [RFC PATCH v7 07/16] arm64/mm, xpfo: temporarily map dcache regions Message-ID: <20190123145551.GD19289@Konrads-MacBook-Pro.local> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9144 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=839 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901230112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 02:09:39PM -0700, Khalid Aziz wrote: > From: Juerg Haefliger > > If the page is unmapped by XPFO, a data cache flush results in a fatal > page fault, so let's temporarily map the region, flush the cache, and then > unmap it. > > v6: actually flush in the face of xpfo, and temporarily map the underlying > memory so it can be flushed correctly > > CC: linux-arm-kernel@lists.infradead.org > Signed-off-by: Juerg Haefliger > Signed-off-by: Tycho Andersen > Signed-off-by: Khalid Aziz > --- > arch/arm64/mm/flush.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c > index 30695a868107..f12f26b60319 100644 > --- a/arch/arm64/mm/flush.c > +++ b/arch/arm64/mm/flush.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -28,9 +29,15 @@ > void sync_icache_aliases(void *kaddr, unsigned long len) > { > unsigned long addr = (unsigned long)kaddr; > + unsigned long num_pages = XPFO_NUM_PAGES(addr, len); Is it possible that the 'len' is more than 32 pages? Or say 1000's of pages? Which would blow away your stack. > + void *mapping[num_pages]; > > if (icache_is_aliasing()) { > + xpfo_temp_map(kaddr, len, mapping, > + sizeof(mapping[0]) * num_pages); > __clean_dcache_area_pou(kaddr, len); > + xpfo_temp_unmap(kaddr, len, mapping, > + sizeof(mapping[0]) * num_pages); > __flush_icache_all(); > } else { > flush_icache_range(addr, addr + len); > -- > 2.17.1 >