linux-mips
[Top] [All Lists]

copy_from_user_page/copy_to_user_page fix

To: linux-mips@linux-mips.org
Subject: copy_from_user_page/copy_to_user_page fix
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Wed, 09 Feb 2005 18:49:47 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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

<Prev in Thread] Current Thread [Next in Thread>