[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-faa379332f3cb3375db1849e27386f8bc9b97da4@git.kernel.org>
Date: Fri, 8 Jul 2016 13:34:37 -0700
From: tip-bot for Thomas Garnier <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: boris.ostrovsky@...cle.com, bp@...en8.de, alpopov@...ecurity.com,
yinghai@...nel.org, linux-kernel@...r.kernel.org,
dan.j.williams@...el.com, peterz@...radead.org, bp@...e.de,
corbet@....net, toshi.kani@....com, dave.hansen@...ux.intel.com,
akpm@...ux-foundation.org, matt@...eblueprint.co.uk,
mingo@...nel.org, keescook@...omium.org, tglx@...utronix.de,
dvyukov@...gle.com, jgross@...e.com, dyoung@...hat.com,
luto@...nel.org, kirill.shutemov@...ux.intel.com,
brgerst@...il.com, torvalds@...ux-foundation.org, bhe@...hat.com,
lv.zheng@...el.com, hpa@...or.com, kuleshovmail@...il.com,
msalter@...hat.com, aneesh.kumar@...ux.vnet.ibm.com,
dvlasenk@...hat.com, thgarnie@...gle.com, schwidefsky@...ibm.com,
jpoimboe@...hat.com, guangrong.xiao@...ux.intel.com,
borntraeger@...ibm.com, jroedel@...e.de, sds@...ho.nsa.gov,
JBeulich@...e.com
Subject: [tip:x86/boot] x86/mm: Add PUD VA support for physical mapping
Commit-ID: faa379332f3cb3375db1849e27386f8bc9b97da4
Gitweb: http://git.kernel.org/tip/faa379332f3cb3375db1849e27386f8bc9b97da4
Author: Thomas Garnier <thgarnie@...gle.com>
AuthorDate: Tue, 21 Jun 2016 17:47:00 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 8 Jul 2016 17:33:46 +0200
x86/mm: Add PUD VA support for physical mapping
Minor change that allows early boot physical mapping of PUD level virtual
addresses. The current implementation expects the virtual address to be
PUD aligned. For KASLR memory randomization, we need to be able to
randomize the offset used on the PUD table.
It has no impact on current usage.
Signed-off-by: Thomas Garnier <thgarnie@...gle.com>
Signed-off-by: Kees Cook <keescook@...omium.org>
Cc: Alexander Kuleshov <kuleshovmail@...il.com>
Cc: Alexander Popov <alpopov@...ecurity.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
Cc: Baoquan He <bhe@...hat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Borislav Petkov <bp@...e.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Christian Borntraeger <borntraeger@...ibm.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Dave Young <dyoung@...hat.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jan Beulich <JBeulich@...e.com>
Cc: Joerg Roedel <jroedel@...e.de>
Cc: Jonathan Corbet <corbet@....net>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Juergen Gross <jgross@...e.com>
Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Lv Zheng <lv.zheng@...el.com>
Cc: Mark Salter <msalter@...hat.com>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Matt Fleming <matt@...eblueprint.co.uk>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephen Smalley <sds@...ho.nsa.gov>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Toshi Kani <toshi.kani@....com>
Cc: Xiao Guangrong <guangrong.xiao@...ux.intel.com>
Cc: Yinghai Lu <yinghai@...nel.org>
Cc: kernel-hardening@...ts.openwall.com
Cc: linux-doc@...r.kernel.org
Link: http://lkml.kernel.org/r/1466556426-32664-4-git-send-email-keescook@chromium.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/mm/init_64.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 6714712..7bf1ddb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -465,7 +465,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
/*
* Create PUD level page table mapping for physical addresses. The virtual
- * and physical address have to be aligned at this level.
+ * and physical address do not have to be aligned at this level. KASLR can
+ * randomize virtual addresses up to this level.
* It returns the last physical address mapped.
*/
static unsigned long __meminit
@@ -474,14 +475,18 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
{
unsigned long pages = 0, paddr_next;
unsigned long paddr_last = paddr_end;
- int i = pud_index(paddr);
+ unsigned long vaddr = (unsigned long)__va(paddr);
+ int i = pud_index(vaddr);
for (; i < PTRS_PER_PUD; i++, paddr = paddr_next) {
- pud_t *pud = pud_page + pud_index(paddr);
+ pud_t *pud;
pmd_t *pmd;
pgprot_t prot = PAGE_KERNEL;
+ vaddr = (unsigned long)__va(paddr);
+ pud = pud_page + pud_index(vaddr);
paddr_next = (paddr & PUD_MASK) + PUD_SIZE;
+
if (paddr >= paddr_end) {
if (!after_bootmem &&
!e820_any_mapped(paddr & PUD_MASK, paddr_next,
@@ -551,7 +556,7 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
/*
* Create page table mapping for the physical memory for specific physical
- * addresses. The virtual and physical addresses have to be aligned on PUD level
+ * addresses. The virtual and physical addresses have to be aligned on PMD level
* down. It returns the last physical address mapped.
*/
unsigned long __meminit
Powered by blists - more mailing lists