Skip to contentSkip to conversation

Bogus tls from gdt

PATCH In review Zachary Amsden 2 participants 2 messages Sep 22, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Bogus tls from gdt

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.

arch/i386/kernel/cpu/common.c +0 -6
Index: linux-2.6.14-rc1/arch/i386/kernel/cpu/common.c
===================================================================
@@ -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);
 
Acked-by on v1 1/3
#1 lore raw
Quoted 6 lines · Zachary Amsden

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.

Ingo