Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1340448
| From | tip-bot for Sai Praneeth <tipbot@zytor.com>@zytor.com |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:efi/core] x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd() |
| Date | 2016-02-23 10:20 +0100 |
| Message-ID | <r5his-3dd-55@gated-at.bofh.it> (permalink) |
| References | <r39yF-6rV-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 15f003d20782a4079e078d16df57081ebd1fc150
Gitweb: http://git.kernel.org/tip/15f003d20782a4079e078d16df57081ebd1fc150
Author: Sai Praneeth <sai.praneeth.prakhya@intel.com>
AuthorDate: Wed, 17 Feb 2016 12:36:04 +0000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 22 Feb 2016 08:26:28 +0100
x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd()
As part of the preparation for the EFI_MEMORY_RO flag added in the UEFI
2.5 specification, we need the ability to map pages in kernel page
tables without _PAGE_RW being set.
Modify kernel_map_pages_in_pgd() to require its callers to pass _PAGE_RW
if the pages need to be mapped read/write. Otherwise, we'll map the
pages as read-only.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Lee, Chun-Yi <jlee@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1455712566-16727-12-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/mm/pageattr.c | 3 +++
arch/x86/platform/efi/efi_64.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index bf312da..14c38ae 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1971,6 +1971,9 @@ int kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address,
if (!(page_flags & _PAGE_NX))
cpa.mask_clr = __pgprot(_PAGE_NX);
+ if (!(page_flags & _PAGE_RW))
+ cpa.mask_clr = __pgprot(_PAGE_RW);
+
cpa.mask_set = __pgprot(_PAGE_PRESENT | page_flags);
retval = __change_page_attr_set_clr(&cpa, 0);
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index b492521..b0965b2 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -233,7 +233,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
* phys_efi_set_virtual_address_map().
*/
pfn = pa_memmap >> PAGE_SHIFT;
- if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, _PAGE_NX)) {
+ if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, _PAGE_NX | _PAGE_RW)) {
pr_err("Error ident-mapping new memmap (0x%lx)!\n", pa_memmap);
return 1;
}
@@ -262,7 +262,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
pfn = md->phys_addr >> PAGE_SHIFT;
npages = md->num_pages;
- if (kernel_map_pages_in_pgd(pgd, pfn, md->phys_addr, npages, 0)) {
+ if (kernel_map_pages_in_pgd(pgd, pfn, md->phys_addr, npages, _PAGE_RW)) {
pr_err("Failed to map 1:1 memory\n");
return 1;
}
@@ -279,7 +279,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
text = __pa(_text);
pfn = text >> PAGE_SHIFT;
- if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, 0)) {
+ if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, _PAGE_RW)) {
pr_err("Failed to map kernel text 1:1\n");
return 1;
}
@@ -294,7 +294,7 @@ void __init efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages)
static void __init __map_region(efi_memory_desc_t *md, u64 va)
{
- unsigned long flags = 0;
+ unsigned long flags = _PAGE_RW;
unsigned long pfn;
pgd_t *pgd = efi_pgd;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/13] EFI changes for v4.6 part 2 Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[PATCH 08/13] efi/arm: Check for LPAE support before booting a LPAE kernel Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/arm: Check for LPAE support before booting a LPAE kernel tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 11/13] x86/mm/pageattr: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd() Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd() tip-bot for Sai Praneeth <tipbot@zytor.com>@zytor.com - 2016-02-23 10:20 +0100
[PATCH 05/13] arm64: vmlinux.lds.S: Handle .init.rodata.xxx and .init.bss sections Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] arm64/vmlinux.lds.S: Handle .init.rodata.xxx and .init.bss sections tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 03/13] x86/mm/pageattr: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings tip-bot for Sai Praneeth <tipbot@zytor.com>@zytor.com - 2016-02-23 10:20 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-23 18:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-23 19:10 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Borislav Petkov <bp@alien8.de> - 2016-02-23 19:20 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings "H. Peter Anvin" <hpa@zytor.com> - 2016-02-24 03:20 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings "H. Peter Anvin" <hpa@zytor.com> - 2016-02-24 03:20 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Ingo Molnar <mingo@kernel.org> - 2016-02-25 10:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> - 2016-02-24 02:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 03:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-24 15:20 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Borislav Petkov <bp@alien8.de> - 2016-02-24 17:30 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 17:40 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-24 20:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-24 20:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 21:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Sylvain Chouleur <sylvain.chouleur@gmail.com> - 2016-02-29 12:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-03-02 12:30 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-24 20:40 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 21:00 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Ingo Molnar <mingo@kernel.org> - 2016-02-25 10:10 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-25 16:30 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 17:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Borislav Petkov <bp@alien8.de> - 2016-02-24 17:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Andy Lutomirski <luto@amacapital.net> - 2016-02-24 17:50 +0100
Re: [tip:efi/core] x86/mm/pat: Use _PAGE_GLOBAL bit for EFI page table mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-25 17:10 +0100
[PATCH 07/13] efi/arm-init: Use read-only early mappings Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/arm-init: Use read-only early mappings tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 06/13] efi/efistub: Prevent __init annotations from being used Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/efistub: Prevent __init annotations from being used tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:10 +0100
[PATCH 02/13] efi/runtime-wrappers: Run UEFI Runtime Services with interrupts enabled Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/runtime-wrappers: Run UEFI Runtime Services with interrupts enabled tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 13/13] x86/efi: Only map kernel text for EFI mixed mode Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] x86/efi: Only map kernel text for EFI mixed mode tip-bot for Sai Praneeth <tipbot@zytor.com>@zytor.com - 2016-02-23 10:20 +0100
[PATCH 12/13] x86/efi: Map EFI_MEMORY_{XP,RO} memory region bits to EFI page tables Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] x86/efi: Map EFI_MEMORY_{XP,RO} memory region bits to EFI page tables tip-bot for Sai Praneeth <tipbot@zytor.com>@zytor.com - 2016-02-23 10:20 +0100
[PATCH 10/13] efi/arm*: Perform hardware compatibility check Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/arm*: Perform hardware compatibility check tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 09/13] efi/arm64: Check for h/w support before booting a >4 KB granule kernel Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:40 +0100
[tip:efi/core] efi/arm64: Check for h/w support before booting a >4 KB granular kernel tip-bot for Ard Biesheuvel <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
[PATCH 01/13] efi: Reformat GUID tables to follow the format in UEFI spec Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 13:50 +0100
[tip:efi/core] efi: Reformat GUID tables to follow the format in UEFI spec tip-bot for Peter Jones <tipbot@zytor.com>@zytor.com - 2016-02-23 10:30 +0100
csiph-web