From: Arvind Sankar <nivedita@alum.mit.edu>
To: linux-efi@vger.kernel.org
Subject: [PATCH] efi/x86: Mark kernel rodata non-executable
Date: Fri, 17 Jul 2020 15:45:26 -0400 [thread overview]
Message-ID: <20200717194526.3452089-1-nivedita@alum.mit.edu> (raw)
When remapping the kernel rodata section RO in the EFI pagetables, the
protection flags that were used for the text section are being reused,
but the rodata section should not be marked executable.
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
arch/x86/platform/efi/efi_64.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 8e364c4c6768..7caa65837356 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -268,6 +268,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
npages = (__end_rodata - __start_rodata) >> PAGE_SHIFT;
rodata = __pa(__start_rodata);
pfn = rodata >> PAGE_SHIFT;
+
+ pf = _PAGE_NX | _PAGE_ENC;
if (kernel_map_pages_in_pgd(pgd, pfn, rodata, npages, pf)) {
pr_err("Failed to map kernel rodata 1:1\n");
return 1;
--
2.26.2
next reply other threads:[~2020-07-17 19:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 19:45 Arvind Sankar [this message]
2020-07-18 6:42 ` [PATCH] efi/x86: Mark kernel rodata non-executable Ard Biesheuvel
2020-08-22 13:39 ` [tip: efi/urgent] efi/x86: Mark kernel rodata non-executable for mixed mode tip-bot2 for Arvind Sankar
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=20200717194526.3452089-1-nivedita@alum.mit.edu \
--to=nivedita@alum.mit.edu \
--cc=linux-efi@vger.kernel.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.