copy_from_user_page/copy_to_user_page fix

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

 



Yet another dcache aliasing problem.

Since access_process_vm() in kernel 2.6 does not call
flush_cache_page(), it seems copy_to_user_page()/copy_from_user_page()
should flush data cache to resolve aliasing.

Without this fix, gdb will not work correctly.  Could you apply?

diff -u linux-mips/include/asm-mips/cacheflush.h linux/include/asm-mips/cacheflush.h
--- linux-mips/include/asm-mips/cacheflush.h	2004-08-14 19:55:59.000000000 +0900
+++ linux/include/asm-mips/cacheflush.h	2005-02-09 17:55:39.402702039 +0900
@@ -56,11 +56,17 @@
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len)		\
 do {									\
+	if (cpu_has_dc_aliases)						\
+		flush_cache_page(vma, vaddr);				\
 	memcpy(dst, (void *) src, len);					\
 	flush_icache_page(vma, page);					\
 } while (0)
 #define copy_from_user_page(vma, page, vaddr, dst, src, len)		\
-	memcpy(dst, src, len)
+do {									\
+	if (cpu_has_dc_aliases)						\
+		flush_cache_page(vma, vaddr);				\
+	memcpy(dst, src, len);						\
+} while (0)
 
 extern void (*flush_cache_sigtramp)(unsigned long addr);
 extern void (*flush_icache_all)(void);

---
Atsushi Nemoto


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux