From patchwork Mon Aug 14 14:24:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110011 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281673obb; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) X-Received: by 10.107.153.141 with SMTP id b135mr19677911ioe.247.1502720783075; Mon, 14 Aug 2017 07:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720783; cv=none; d=google.com; s=arc-20160816; b=ad0O/BbYGrMFuseiTvasUn9d3bnnHsh8NxfL4QR9zYFOrsnE+GZv9P6k3x4V5+TdFg rP5uX4R6QuTtb6ZbpQLt3eUUsL3dx4Rea9LUnVOGSwjZHS+5jZ3sG+7o4a2DHHpNjYgB iDtggqe9eJbcNElKFIq2SarmbEAqyx9n9kLh+KlBuoZuHmPqAcoIC3BD3ndf3WCu4bJH mWQtH/597U1YxI/V8YLEZTKUiz76ZZEN8jwrkgqcCYc/ERhCbJFbfr7ic/XIWHqrgaON XOSMs52FcAHakELramcEPSlpOF9IHNugUxtjgFoNX/dr2/8fFkx3wcs0ksOKNsSDtqPF 1zHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=FuRdgwFbjSR6om4q2GPtlIrF6Eeplyoc9+S3HhowyMQ=; b=DFcVTfM17XaoCpTLGc7i2rgi305P/1P9MaDFSg/iutMUfQ+O8gGxcvQrQGgCEmWe3K Galgm5kf2Pe4W1Vj2O0YIGSYFRRQ70FNyPTUKWUo+1Y/GphzToOeZ7Qsok0LuTQOPeI3 Bc+ye24iowhWmK3OgMY096mU7Hj/66Geq5sCMhfouDqGp9oriiLqshq5kI2gSvj/KC9T IfvvWNYRxDdTkk7l8Ew+KIOsczo8QygpOb65/x4XfYMa0Cm0uuehxDJoZvKNTWMhMYT8 tqJudPCpiz+llSOBGx9/Mneb2FVvw3ARocga8ch/FYfaV0IFfyp827nerBWKMR96kihs giFg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k185si7235147ioe.241.2017.08.14.07.26.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:23 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIl-00016r-2O; Mon, 14 Aug 2017 14:25:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIj-0000qm-W9 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:25:06 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id E4/2A-09901-1C2B1995; Mon, 14 Aug 2017 14:25:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRWlGSWpSXmKPExsVysyfVTffgpom RBseuiFos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBn9K9kKOjgqzq50bmBcwdrFyMUhJLCJUeLg ktMsEM5pRomlrycydjFycrAJaErc+fyJCcQWEZCWuPb5MlicWSBS4vCHH+wgtrBAuMSUFc1gN ouAqkTLnJ3MXYwcHLwCVhKrJyqChCUE5CV2tV1kBbE5gcKdd3eygNhCApYSJ1bPZpvAyL2AkW EVo0ZxalFZapGukYFeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkagbxmAYAfjr2U BhxglOZiURHkTfHojhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwpm6cGCkkWJSanlqRlpkDDDKY tAQHj5II79oNQGne4oLE3OLMdIjUKUZdjlcT/n9jEmLJy89LlRLnfQVSJABSlFGaBzcCFvCXG GWlhHkZgY4S4ilILcrNLEGVf8UozsGoJMxbCXIJT2ZeCdymV0BHMAEd0QdyP29xSSJCSqqBMd H7d31m2Ky+5JJ3ntkOU37+3V2+ItBk3+2NHk1P0+NTZiw63RQzUeiG8drXT/4qbGpf8v/sjJ3 FlllhTMluFmvWLPh94FL/4SlRP298iEs8HzD5bOrdzOhTXffNpbNM9P+uLjMWiL/hzHosy6Hg 5qMFksmnbHjb7p3w/WLNrPmPZ/KKc/Jfw5RYijMSDbWYi4oTARLhFFhzAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1502720704!106249436!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11758 invoked from network); 14 Aug 2017 14:25:05 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-27.messagelabs.com with SMTP; 14 Aug 2017 14:25:05 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A18C480D; Mon, 14 Aug 2017 07:25:04 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B60483F483; Mon, 14 Aug 2017 07:25:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:24:17 +0100 Message-Id: <20170814142418.13267-27-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 26/27] xen/arm: mm: Handling permission flags when adding a new mapping X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Currently, all the new mappings will be read-write non-executable. Allow the caller to use other permissions. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index cd7bcf7aca..fe0646002e 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1022,6 +1022,14 @@ static int create_xen_entries(enum xenmap_operation op, if ( op == RESERVE ) break; pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); + if ( !pte.pt.ro && !pte.pt.xn ) + { + printk("%s: Incorrect combination for addr=%lx\n", + __func__, addr); + return -EINVAL; + } pte.pt.table = 1; write_pte(entry, pte); break;