[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-46aea3873401836abb7f01200e7946e7d518b359@git.kernel.org>
Date: Fri, 15 Jul 2016 05:01:51 -0700
From: tip-bot for Andy Lutomirski <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: luto@...nel.org, mingo@...nel.org, peterz@...radead.org,
brgerst@...il.com, dvlasenk@...hat.com, bp@...en8.de,
tglx@...utronix.de, linux-kernel@...r.kernel.org,
jpoimboe@...hat.com, hpa@...or.com, torvalds@...ux-foundation.org
Subject: [tip:x86/mm] x86/mm/64: In vmalloc_fault(), use CR3 instead of
current->active_mm
Commit-ID: 46aea3873401836abb7f01200e7946e7d518b359
Gitweb: http://git.kernel.org/tip/46aea3873401836abb7f01200e7946e7d518b359
Author: Andy Lutomirski <luto@...nel.org>
AuthorDate: Thu, 14 Jul 2016 13:22:54 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 15 Jul 2016 10:26:27 +0200
x86/mm/64: In vmalloc_fault(), use CR3 instead of current->active_mm
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@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/4650d7674185f165ed8fdf9ac4c5c35c5c179ba8.1468527351.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.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 7d1fa7c..ca44e2e 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;
Powered by blists - more mailing lists