All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org
Cc: catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Ard Biesheuvel
	<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH v2 5/5] arm*: efi: take the Memory Attributes table into account
Date: Wed, 30 Mar 2016 18:38:53 +0200	[thread overview]
Message-ID: <1459355933-13529-6-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1459355933-13529-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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 <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 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(+)

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;
 }
 
-- 
2.5.0

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/5] arm*: efi: take the Memory Attributes table into account
Date: Wed, 30 Mar 2016 18:38:53 +0200	[thread overview]
Message-ID: <1459355933-13529-6-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1459355933-13529-1-git-send-email-ard.biesheuvel@linaro.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 <ard.biesheuvel@linaro.org>
---
 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(+)

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;
 }
 
-- 
2.5.0

  parent reply	other threads:[~2016-03-30 16:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 16:38 [PATCH v2 0/5] UEFI: memory attribute table support Ard Biesheuvel
2016-03-30 16:38 ` Ard Biesheuvel
     [not found] ` <1459355933-13529-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-03-30 16:38   ` [PATCH v2 1/5] ARM: efi: apply strict permissons for UEFI Runtime Services regions Ard Biesheuvel
2016-03-30 16:38     ` Ard Biesheuvel
2016-03-30 16:38   ` [PATCH v2 2/5] arm64: " Ard Biesheuvel
2016-03-30 16:38     ` Ard Biesheuvel
     [not found]     ` <1459355933-13529-3-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-05-18  0:40       ` Shanker Donthineni
2016-05-18  0:40         ` Shanker Donthineni
     [not found]         ` <573BB9FE.7050008-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-05-18  6:18           ` Ard Biesheuvel
2016-05-18  6:18             ` Ard Biesheuvel
     [not found]             ` <CAKv+Gu-Tam+QiXc_f0e+x8hNc4rxP_-59NdaCHkF9h=4Rd+XeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-18 13:06               ` Shanker Donthineni
2016-05-18 13:06                 ` Shanker Donthineni
     [not found]                 ` <573C68DA.8080009-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-05-18 13:08                   ` Ard Biesheuvel
2016-05-18 13:08                     ` Ard Biesheuvel
2016-03-30 16:38   ` [PATCH v2 3/5] efi: add support for the EFI_MEMORY_ATTRIBUTES_TABLE config table Ard Biesheuvel
2016-03-30 16:38     ` Ard Biesheuvel
2016-03-30 16:38   ` [PATCH v2 4/5] efi: implement generic support for the Memory Attributes table Ard Biesheuvel
2016-03-30 16:38     ` Ard Biesheuvel
     [not found]     ` <1459355933-13529-5-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-01 12:36       ` Ard Biesheuvel
2016-04-01 12:36         ` Ard Biesheuvel
2016-04-08 15:56       ` Matt Fleming
2016-04-08 15:56         ` Matt Fleming
     [not found]         ` <20160408155608.GQ2701-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-04-11 14:09           ` Ard Biesheuvel
2016-04-11 14:09             ` Ard Biesheuvel
     [not found]             ` <CAKv+Gu-TMb0MTnzXXjczvxaWvZphu7M1-MMdjCrZ7A2CvCc2WQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-12 19:57               ` Matt Fleming
2016-04-12 19:57                 ` Matt Fleming
     [not found]                 ` <20160412195727.GG2829-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-04-13  8:29                   ` Ard Biesheuvel
2016-04-13  8:29                     ` Ard Biesheuvel
     [not found]                     ` <CAKv+Gu-bLN16YKei3togReQBNo+ScQVf7ek2NJEZAEyii2JEcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-13 10:24                       ` Matt Fleming
2016-04-13 10:24                         ` Matt Fleming
     [not found]                         ` <20160413102408.GL2829-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-04-13 10:24                           ` Ard Biesheuvel
2016-04-13 10:24                             ` Ard Biesheuvel
2016-03-30 16:38   ` Ard Biesheuvel [this message]
2016-03-30 16:38     ` [PATCH v2 5/5] arm*: efi: take the Memory Attributes table into account Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459355933-13529-6-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org \
    --cc=pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.