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


Groups > linux.kernel > #1443750

[PATCH 06/11] x86/mm/64: In vmalloc_fault(), use CR3 instead of current->active_mm

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 06/11] x86/mm/64: In vmalloc_fault(), use CR3 instead of current->active_mm
Date 2016-07-14 22:30 +0200
Message-ID <rUVqG-5SB-43@gated-at.bofh.it> (permalink)
References <rUVqF-5SB-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If we get a vmalloc fault while current->active_mm->pgd doesn't
match CR3, we'll crash without this change.  I've seen this failure
mode on heavily instrumented kernels with virtually mapped stacks.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 7d1fa7cd2374..ca44e2e7fd00 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -439,7 +439,7 @@ static noinline int vmalloc_fault(unsigned long address)
 	 * happen within a race in page table update. In the later
 	 * case just flush:
 	 */
-	pgd = pgd_offset(current->active_mm, address);
+	pgd = (pgd_t *)__va(read_cr3()) + pgd_index(address);
 	pgd_ref = pgd_offset_k(address);
 	if (pgd_none(*pgd_ref))
 		return -1;
-- 
2.7.4

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


Thread

[PATCH 00/11] x86: misc prep patches for virtually mapped stacks Andy Lutomirski <luto@kernel.org> - 2016-07-14 22:30 +0200
  [PATCH 09/11] x86: Move addr_limit to thread_struct Andy Lutomirski <luto@kernel.org> - 2016-07-14 22:30 +0200
    [tip:x86/mm] x86/uaccess: Move thread_info::addr_limit to  thread_struct tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-07-15 14:10 +0200
  [PATCH 06/11] x86/mm/64: In vmalloc_fault(), use CR3 instead of current->active_mm Andy Lutomirski <luto@kernel.org> - 2016-07-14 22:30 +0200
    [tip:x86/mm] x86/mm/64: In vmalloc_fault(), use CR3 instead of  current->active_mm tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-07-15 14:10 +0200
  [PATCH 11/11] x86/smp: Remove unnecessary initialization of thread_info::cpu Andy Lutomirski <luto@kernel.org> - 2016-07-14 22:30 +0200
    [tip:x86/mm] x86/smp: Remove unnecessary initialization of  thread_info::cpu tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-07-15 14:10 +0200

csiph-web