linux-kernel-test/arch/x86
Ingo Molnar 9a24d04a3c x86: fix global_flush_tlb() bug
While we were reviewing pageattr_32/64.c for unification,
Thomas Gleixner noticed the following serious SMP bug in
global_flush_tlb():

	down_read(&init_mm.mmap_sem);
	list_replace_init(&deferred_pages, &l);
	up_read(&init_mm.mmap_sem);

this is SMP-unsafe because list_replace_init() done on two CPUs in
parallel can corrupt the list.

This bug has been introduced about a year ago in the 64-bit tree:

       commit ea7322decb
       Author: Andi Kleen <ak@suse.de>
       Date:   Thu Dec 7 02:14:05 2006 +0100

       [PATCH] x86-64: Speed and clean up cache flushing in change_page_attr

                down_read(&init_mm.mmap_sem);
        -       dpage = xchg(&deferred_pages, NULL);
        +       list_replace_init(&deferred_pages, &l);
                up_read(&init_mm.mmap_sem);

the xchg() based version was SMP-safe, but list_replace_init() is not.
So this "cleanup" introduced a nasty bug.

why this bug never become prominent is a mystery - it can probably be
explained with the (still) relative obscurity of the x86_64 architecture.

the safe fix for now is to write-lock init_mm.mmap_sem.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2007-10-19 12:19:26 +02:00
..
boot [x86] remove uses of magic macros for boot_params access 2007-10-16 17:38:31 -07:00
crypto x86_64: move crypto 2007-10-11 11:17:03 +02:00
ia32 sysctl: x86_64 remove unnecessary binary paths 2007-10-18 14:37:22 -07:00
kernel sparse pointer use of zero as null 2007-10-18 14:37:31 -07:00
lib x86: rename .i assembler includes to .h 2007-10-17 20:16:29 +02:00
mach-default x86: clean up struct irqaction initializers 2007-10-17 20:16:06 +02:00
mach-es7000 i386: es7000 minor cleanups 2007-10-17 20:16:15 +02:00
mach-generic i386: make struct apic_probe static 2007-10-17 20:15:54 +02:00
mach-visws [x86] remove uses of magic macros for boot_params access 2007-10-16 17:38:31 -07:00
mach-voyager x86: expand /proc/interrupts to include missing vectors, v2 2007-10-17 20:16:53 +02:00
math-emu kbuild: fix up CFLAGS usage 2007-10-14 21:49:42 +02:00
mm x86: fix global_flush_tlb() bug 2007-10-19 12:19:26 +02:00
oprofile i386: make Oprofile call shutdown() only once per session 2007-10-17 20:15:14 +02:00
pci x86: pci use pci=bfsort for HP DL385 G2 and DL585 G2 2007-10-17 20:15:46 +02:00
power i386: move power 2007-10-11 11:16:34 +02:00
vdso x86: vdso linker script cleanup 2007-10-17 20:17:06 +02:00
video i386: move video 2007-10-11 11:16:56 +02:00
xen Merge ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-x86 2007-10-17 13:13:16 -07:00