linux/include
Atsushi Nemoto 77fff4ae2b [PATCH] Fix COW D-cache aliasing on fork
Problem:

1. There is a process containing two thread (T1 and T2).  The
   thread T1 calls fork().  Then dup_mmap() function called on T1 context.

static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
	...
	flush_cache_mm(current->mm);
	...	/* A */
	(write-protect all Copy-On-Write pages)
	...	/* B */
	flush_tlb_mm(current->mm);
	...

2. When preemption happens between A and B (or on SMP kernel), the
   thread T2 can run and modify data on COW pages without page fault
   (modified data will stay in cache).

3. Some time after fork() completed, the thread T2 may cause a page
   fault by write-protect on a COW page.

4. Then data of the COW page will be copied to newly allocated
   physical page (copy_cow_page()).  It reads data via kernel mapping.
   The kernel mapping can have different 'color' with user space
   mapping of the thread T2 (dcache aliasing).  Therefore
   copy_cow_page() will copy stale data.  Then the modified data in
   cache will be lost.

In order to allow architecture code to deal with this problem allow
architecture code to override copy_user_highpage() by defining
__HAVE_ARCH_COPY_USER_HIGHPAGE in <asm/page.h>.

The main part of this patch was originally written by Ralf Baechle;
Atushi Nemoto did the the debugging.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:27:07 -08:00
..
acpi [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
asm-alpha [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-arm [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-arm26 [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-avr32 [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
asm-cris [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-frv [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-generic Make sure we populate the initroot filesystem late enough 2006-12-11 12:12:04 -08:00
asm-h8300 [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-i386 [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-ia64 [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-m32r [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-m68k [PATCH] remove the broken BLK_DEV_SWIM_IOP driver 2006-12-13 09:05:53 -08:00
asm-m68knommu [PATCH] cleanup asm/setup.h userspace visibility 2006-12-07 08:39:46 -08:00
asm-mips [MIPS] IP27: Don't drag <asm/sn/arch.h> into topology.h. 2006-12-12 01:46:24 +00:00
asm-parisc [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-powerpc [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-ppc Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc 2006-12-11 16:31:42 +11:00
asm-s390 Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6 2006-12-08 11:21:55 -08:00
asm-sh [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-sh64 [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
asm-sparc [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-sparc64 [SPARC64]: Fix several kprobes bugs. 2006-12-10 02:42:03 -08:00
asm-um [PATCH] UML: add generic BUG support 2006-12-08 08:28:39 -08:00
asm-v850 [PATCH] tty: preparatory structures for termios revamp 2006-12-08 08:28:56 -08:00
asm-x86_64 [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
asm-xtensa [PATCH] Xtensa: Add ktermios and minor filename fix 2006-12-13 09:05:50 -08:00
crypto [CRYPTO] lib: table driven multiplications in GF(2^128) 2006-12-06 18:38:55 -08:00
keys
linux [PATCH] Fix COW D-cache aliasing on fork 2006-12-13 09:27:07 -08:00
math-emu
media V4L/DVB (4935): Added the capability of selecting fm gain by tuner 2006-12-10 09:05:52 -02:00
mtd
net [PATCH] hci endianness annotations 2006-12-13 09:05:52 -08:00
pcmcia
rdma IB: Add DMA mapping functions to allow device drivers to interpose 2006-12-12 14:27:41 -08:00
rxrpc
scsi [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
sound Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-12-05 17:01:28 +00:00
video [PATCH] sstfb: add sysfs interface 2006-12-13 09:05:55 -08:00
Kbuild