Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393765

[PATCH v3 2/4] x86, boot: PUD VA support for physical mapping (x86_64)

From Thomas Garnier <thgarnie@google.com>
Newsgroups linux.kernel
Subject [PATCH v3 2/4] x86, boot: PUD VA support for physical mapping (x86_64)
Date 2016-05-03 21:40 +0200
Message-ID <ruOkO-5Mr-17@gated-at.bofh.it> (permalink)
References <ruOkN-5Mr-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Minor change that allows early boot physical mapping of PUD level virtual
addresses. The current implementation expect 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@google.com>
---
Based on next-20160502
---
 arch/x86/mm/init_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 89d9747..6adfbce 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -526,10 +526,10 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
 {
 	unsigned long pages = 0, next;
 	unsigned long last_map_addr = end;
-	int i = pud_index(addr);
+	int i = pud_index((unsigned long)__va(addr));
 
 	for (; i < PTRS_PER_PUD; i++, addr = next) {
-		pud_t *pud = pud_page + pud_index(addr);
+		pud_t *pud = pud_page + pud_index((unsigned long)__va(addr));
 		pmd_t *pmd;
 		pgprot_t prot = PAGE_KERNEL;
 
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/4] x86, boot: KASLR memory randomization Thomas Garnier <thgarnie@google.com> - 2016-05-03 21:40 +0200
  [PATCH v3 2/4] x86, boot: PUD VA support for physical mapping (x86_64) Thomas Garnier <thgarnie@google.com> - 2016-05-03 21:40 +0200
  [PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization Thomas Garnier <thgarnie@google.com> - 2016-05-03 21:40 +0200
    Re: [PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization Kees Cook <keescook@chromium.org> - 2016-05-10 20:30 +0200
      Re: [PATCH v3 4/4] x86, boot: Memory hotplug support for KASLR memory randomization Thomas Garnier <thgarnie@google.com> - 2016-05-10 20:50 +0200

csiph-web