[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-dc4fac84f8e66b147921ebdc385e767d5def7422@git.kernel.org>
Date: Fri, 20 May 2016 03:13:28 -0700
From: tip-bot for Andy Lutomirski <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: gorcunov@...il.com, brgerst@...il.com, peterz@...radead.org,
bp@...en8.de, oleg@...hat.com, dvlasenk@...hat.com,
luto@...capital.net, mingo@...nel.org, 0x7f454c46@...il.com,
xemul@...allels.com, linux-kernel@...r.kernel.org, hpa@...or.com,
luto@...nel.org, b7.10110111@...il.com,
torvalds@...ux-foundation.org, tglx@...utronix.de
Subject: [tip:x86/urgent] x86/mm: Switch from TASK_SIZE to TASK_SIZE_MAX in
the page fault code
Commit-ID: dc4fac84f8e66b147921ebdc385e767d5def7422
Gitweb: http://git.kernel.org/tip/dc4fac84f8e66b147921ebdc385e767d5def7422
Author: Andy Lutomirski <luto@...nel.org>
AuthorDate: Tue, 10 May 2016 14:10:29 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 20 May 2016 09:10:03 +0200
x86/mm: Switch from TASK_SIZE to TASK_SIZE_MAX in the page fault code
x86's page fault handlers had two TASK_SIZE uses that should have
been TASK_SIZE_MAX. I don't think that either one had a visible
effect, but this makes the code clearer and should save a few bytes
of text.
(And I eventually want to eradicate TASK_SIZE. This will help.)
Reported-by: Cyrill Gorcunov <gorcunov@...il.com>
Signed-off-by: Andy Lutomirski <luto@...nel.org>
Cc: Andy Lutomirski <luto@...capital.net>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Dmitry Safonov <0x7f454c46@...il.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Pavel Emelyanov <xemul@...allels.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ruslan Kabatsayev <b7.10110111@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/1242fb23b0d05c3069dbf5758ac55d26bc114bef.1462914565.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/mm/fault.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 5ce1ed0..7d1fa7c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -292,7 +292,7 @@ void vmalloc_sync_all(void)
return;
for (address = VMALLOC_START & PMD_MASK;
- address >= TASK_SIZE && address < FIXADDR_TOP;
+ address >= TASK_SIZE_MAX && address < FIXADDR_TOP;
address += PMD_SIZE) {
struct page *page;
@@ -854,8 +854,13 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
return;
}
#endif
- /* Kernel addresses are always protection faults: */
- if (address >= TASK_SIZE)
+
+ /*
+ * To avoid leaking information about the kernel page table
+ * layout, pretend that user-mode accesses to kernel addresses
+ * are always protection faults.
+ */
+ if (address >= TASK_SIZE_MAX)
error_code |= PF_PROT;
if (likely(show_unhandled_signals))
Powered by blists - more mailing lists