[tip:perfcounters/core] perf_counter, x86: Improve interactions with fast-gup, clean up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  7c59abb44f1f8b5637b775d14d01a223dc4f1a2d
Gitweb:     http://git.kernel.org/tip/7c59abb44f1f8b5637b775d14d01a223dc4f1a2d
Author:     Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
AuthorDate: Fri, 19 Jun 2009 16:57:08 -0700
Committer:  Ingo Molnar <mingo@xxxxxxx>
CommitDate: Sat, 20 Jun 2009 15:23:45 +0200

perf_counter, x86: Improve interactions with fast-gup, clean up

Remove the access_ok() logic from get_user_page_fast() and replace
it with a check for canonical addresses. While the access_ok() check
is correct too technically, it is wrong to make it more relaxed
when KERNEL_DS is set.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
 arch/x86/mm/gup.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 2d1d784..71da1bc 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -303,11 +303,16 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	start &= PAGE_MASK;
 	addr = start;
 	len = (unsigned long) nr_pages << PAGE_SHIFT;
+
 	end = start + len;
-	if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
-					(void __user *)start, len)))
+	if (end < start)
 		goto slow_irqon;
 
+#ifdef CONFIG_X86_64
+	if (end >> __VIRTUAL_MASK_SHIFT)
+		goto slow_irqon;
+#endif
+
 	/*
 	 * XXX: batch / limit 'nr', to avoid large irq off latency
 	 * needs some instrumenting to determine the common sizes used by
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux