From patchwork Wed Mar 30 16:38:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64724 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2714839lbc; Wed, 30 Mar 2016 10:13:10 -0700 (PDT) X-Received: by 10.98.8.14 with SMTP id c14mr14810088pfd.42.1459357989947; Wed, 30 Mar 2016 10:13:09 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 25si7705671pfh.120.2016.03.30.10.13.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 10:13:09 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=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 1alJf3-0001Ag-J1; Wed, 30 Mar 2016 17:12:05 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1alJ9d-0008Lx-46 for linux-arm-kernel@lists.infradead.org; Wed, 30 Mar 2016 16:40:28 +0000 Received: by mail-wm0-x22c.google.com with SMTP id p65so79899319wmp.0 for ; Wed, 30 Mar 2016 09:39:16 -0700 (PDT) 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=+dy3KmMNX4+LjLgRcnX5YKFE3ClRkH0/GoBfNIoeZRU=; b=jRvUJgE0LiTEDTG4m4AOM6FrCyRYZPesBUK2A5/M8zrgLR4XXt8/38SDn9xTFaD+Nt lLQx8o+ntAhULxDXAUBSbPBEDH+sYMbcOTR2i6r0zVB52/8GjtSfMU7qQszhCZzqpziJ vnGZ9KD9KQMUWL2C4imEhHAffQxlknWu8lVJU= 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=+dy3KmMNX4+LjLgRcnX5YKFE3ClRkH0/GoBfNIoeZRU=; b=MtMU3q1ELRy2J9Cm5AvVdxD00VEhgTmGBwQOYSUL3OtEVcYPjCSk2du37elFAvDOJB 5hfXnxSByGQzCHlba9+wrynaNikf2tkKWg8/W0+68UJyWlcwTAufX7GdrppeO5KAaMtP X1fnMuWamAAD+hchlWTBkBWRU8MDJM9q2s8PjYcJVgCjTXLkdOC56PlAetBZzvT/3jEI xgIAwJ+pOC66vyJYA5fYb34Mj9pawiCo6IvpVQHNYtXxfmhwnnOSXP2Oj6oGuBybeuiG OKzb2/5HxoTOu1utEeNxy93rzbiSZ0Ap/3YLN4ZiB+mfeQy87tGP71+syCM5sSslcm+7 7uwA== X-Gm-Message-State: AD7BkJJFdtGVHM+oE2JtRaaIDiAHxNuIgNglyvvIuMAoffhOKS+LztGjdyX6BvLnx2OKa4H7 X-Received: by 10.28.125.71 with SMTP id y68mr16565232wmc.30.1459355955332; Wed, 30 Mar 2016 09:39:15 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id l124sm5233151wmf.11.2016.03.30.09.39.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 09:39:14 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt@codeblueprint.co.uk, mark.rutland@arm.com, linux@arm.linux.org.uk Subject: [PATCH v2 5/5] arm*: efi: take the Memory Attributes table into account Date: Wed, 30 Mar 2016 18:38:53 +0200 Message-Id: <1459355933-13529-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459355933-13529-1-git-send-email-ard.biesheuvel@linaro.org> References: <1459355933-13529-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160330_093937_965973_7AED8D08 X-CRM114-Status: GOOD ( 11.38 ) 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:22c 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: Ard Biesheuvel , catalin.marinas@arm.com, will.deacon@arm.com, leif.lindholm@linaro.org, sai.praneeth.prakhya@intel.com, pjones@redhat.com 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 d5df9849544c..9941a4f2f66f 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -204,6 +204,7 @@ void __init efi_init(void) return; reserve_regions(); + efi_memattr_init(); early_memunmap(memmap.map, params.mmap_size); memblock_reserve(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 b0cfe208c14c..bf1f6ffc9218 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -75,6 +75,9 @@ static bool __init efi_virtmap_init(void) set_bit(EFI_SYSTEM_TABLES, &efi.flags); } } + + if (efi_memattr_apply_permissions(&efi_mm, efi_set_mapping_permissions)) + return false; return true; }