From: Zachary Amsden <zach@vmware.com>

The per-CPU initialization code is copying in bogus data into
thread->tls_array.  Note that it copies &per_cpu(cpu_gdt_table, cpu), not
&per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_TLS_MIN).  That is totally broken and
unnecessary.  Make the initialization explicitly NULL.

Signed-off-by: Zachary Amsden <zach@vmware.com
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/i386/kernel/cpu/common.c |    6 ------
 include/asm-i386/processor.h  |    1 +
 2 files changed, 1 insertion(+), 6 deletions(-)

diff -puN arch/i386/kernel/cpu/common.c~i386--remove-unnecessary-tls-init arch/i386/kernel/cpu/common.c
--- 25/arch/i386/kernel/cpu/common.c~i386--remove-unnecessary-tls-init	Wed Aug 17 13:33:42 2005
+++ 25-akpm/arch/i386/kernel/cpu/common.c	Wed Aug 17 13:33:42 2005
@@ -607,12 +607,6 @@ void __devinit cpu_init(void)
 	cpu_gdt_descr[cpu].address =
 	    (unsigned long)&per_cpu(cpu_gdt_table, cpu);
 
-	/*
-	 * Set up the per-thread TLS descriptor cache:
-	 */
-	memcpy(thread->tls_array, &per_cpu(cpu_gdt_table, cpu),
-		GDT_ENTRY_TLS_ENTRIES * 8);
-
 	load_gdt(&cpu_gdt_descr[cpu]);
 	load_idt(&idt_descr);
 
diff -puN include/asm-i386/processor.h~i386--remove-unnecessary-tls-init include/asm-i386/processor.h
--- 25/include/asm-i386/processor.h~i386--remove-unnecessary-tls-init	Wed Aug 17 13:33:42 2005
+++ 25-akpm/include/asm-i386/processor.h	Wed Aug 17 13:33:42 2005
@@ -364,6 +364,7 @@ struct thread_struct {
 };
 
 #define INIT_THREAD  {							\
+	.tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES-1 ] = { 0,0 } },	\
 	.vm86_info = NULL,						\
 	.sysenter_cs = __KERNEL_CS,					\
 	.io_bitmap_ptr = NULL,						\
_