From patchwork Mon Feb 22 14:29:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62586 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1292086lbl; Mon, 22 Feb 2016 07:06:25 -0800 (PST) X-Received: by 10.66.119.202 with SMTP id kw10mr33583563pab.110.1456153585193; Mon, 22 Feb 2016 07:06:25 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 70si40276549pfn.223.2016.02.22.07.06.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 07:06:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXs31-0002Un-VA; Mon, 22 Feb 2016 15:05:15 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXrUi-000403-Ut for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 14:30:26 +0000 Received: by mail-wm0-x232.google.com with SMTP id a4so165290056wme.1 for ; Mon, 22 Feb 2016 06:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0Ez8ylmVOB/mr+WQFPcE3ssfU8X2vO3aIuJ/oWOR52Q=; b=MVjSpPJTItKEnkHRFnO8jbI2Xqq4mp0nv8kzhymumiy+fxdnslWo5RA2xXc7X/PeoC KeSLxam76ForGivbsd+hApBNNvaxQbXh1BcUXIcO7FNoql36+xhfhneXYYJgUopoT3xv aWotuy0YPHx7AlPHzfN0qiefBBT6XjzJB0eMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0Ez8ylmVOB/mr+WQFPcE3ssfU8X2vO3aIuJ/oWOR52Q=; b=SLMrDklicYkr/Fy1PGqMxnKJ12lKBgEOJ+mbeMZShYo0Jr3xd5fYHjYWgp1Jggh0+n lBRSmfgTsE3cLNAyNFk5vuKbiEbvA7Py/Ivh7jygSwu8GHkymcoPrG05EQbWE8qQp6aI baZDg1eRM/MRRKvhzbcvJL5AgvL50k0hL1+jjdUZj4PDteqC5fvv4hfo9au7PviBb1Nf hCJtfN24pS8LHvvQTBawbwpO6RnfvU6yEX8NJU1RXJZdWkiOi5sm6U4iv6PXueHgz/zY GVNwOfU91OwAgV0orqOzuDwNYiQJnKRwIbuanF/zg2eI+cT+rlwxuj4KG1TIRF1fjUWt nd2A== X-Gm-Message-State: AG10YOTgxHcnYdev6sRV/egyodqXrsEKYq4aPOkm7blVAIdHG67Xw1us+/sS1koMp3gmaeYv X-Received: by 10.194.250.35 with SMTP id yz3mr31448780wjc.173.1456151367305; Mon, 22 Feb 2016 06:29:27 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id e19sm21402599wmd.1.2016.02.22.06.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 06:29:26 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, matt@codeblueprint.co.uk, sai.praneeth.prakhya@intel.com Subject: [PATCH 5/5] arm*: efi: take the Memory Attributes table into account Date: Mon, 22 Feb 2016 15:29:15 +0100 Message-Id: <1456151355-25943-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456151355-25943-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456151158-25849-4-git-send-email-ard.biesheuvel@linaro.org> <1456151355-25943-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_062950_248609_CCE6C871 X-CRM114-Status: GOOD ( 11.56 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, pjones@redhat.com, linux@arm.linux.org.uk, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Call into the generic memory attributes table support code at the appropriate times during the init sequence so that the UEFI Runtime Services region are mapped according to the strict permissions it specifies. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/efi.h | 2 ++ drivers/firmware/efi/arm-init.c | 1 + drivers/firmware/efi/arm-runtime.c | 3 +++ 3 files changed, 6 insertions(+) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 8e88a696c9cb..4dafc89f373a 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -14,6 +14,8 @@ extern void efi_init(void); int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); +#define efi_set_mapping_permissions efi_create_mapping + #define efi_call_virt(f, ...) \ ({ \ efi_##f##_t *__f; \ diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index aa1f743152a2..022f11157acd 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -202,6 +202,7 @@ void __init efi_init(void) return; reserve_regions(); + efi_memattr_init(); early_memunmap(memmap.map, params.mmap_size); memblock_mark_nomap(params.mmap & PAGE_MASK, PAGE_ALIGN(params.mmap_size + diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 3a3911641049..848ede1587dc 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -65,6 +65,9 @@ static bool __init efi_virtmap_init(void) return false; } } + + if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions)) + return false; return true; }