From: "Andi Kleen" Fix bug introduced with the TLS system calls in 2.5. The LDT descriptor needs two entries, not one. It would overlap into the TLS range, which means setting an LDT would corrupt the first TLS descriptor. Noticed by Jan Beulich Signed-off-by: Andi Kleen Cc: Signed-off-by: Andrew Morton --- 25-akpm/arch/x86_64/kernel/head.S | 3 +-- 25-akpm/include/asm-x86_64/segment.h | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff -puN arch/x86_64/kernel/head.S~x86_64-fix-ldt-descriptor arch/x86_64/kernel/head.S --- 25/arch/x86_64/kernel/head.S~x86_64-fix-ldt-descriptor Wed Mar 23 15:39:00 2005 +++ 25-akpm/arch/x86_64/kernel/head.S Wed Mar 23 15:39:00 2005 @@ -377,9 +377,8 @@ ENTRY(cpu_gdt_table) .quad 0x00affa000000ffff /* __USER_CS */ .quad 0x00cf9a000000ffff /* __KERNEL32_CS */ .quad 0,0 /* TSS */ - .quad 0 /* LDT */ + .quad 0,0 /* LDT */ .quad 0,0,0 /* three TLS descriptors */ - .quad 0 /* unused now */ .quad 0x00009a000000ffff /* __KERNEL16_CS - 16bit PM for S3 wakeup. */ /* base must be patched for real base address. */ gdt_end: diff -puN include/asm-x86_64/segment.h~x86_64-fix-ldt-descriptor include/asm-x86_64/segment.h --- 25/include/asm-x86_64/segment.h~x86_64-fix-ldt-descriptor Wed Mar 23 15:39:00 2005 +++ 25-akpm/include/asm-x86_64/segment.h Wed Mar 23 15:39:00 2005 @@ -24,10 +24,9 @@ #define GDT_ENTRY_TLS 1 #define GDT_ENTRY_TSS 8 /* needs two entries */ -#define GDT_ENTRY_LDT 10 -#define GDT_ENTRY_TLS_MIN 11 -#define GDT_ENTRY_TLS_MAX 13 -/* 14 free */ +#define GDT_ENTRY_LDT 10 /* needs two entries */ +#define GDT_ENTRY_TLS_MIN 12 +#define GDT_ENTRY_TLS_MAX 14 #define GDT_ENTRY_KERNELCS16 15 #define GDT_ENTRY_TLS_ENTRIES 3 _