On Sat, 20 Jul 2002, Linus Torvalds wrote:
> It's buggy. It calls smp_processor_id() outside the preemption window,
> see "load_LDT()".
oops. Correct patch that uses get_cpu()/put_cpu() is attached, against
2.5.27. I was wrong when sending the initial fix: there are no header file
dependency issues in 2.5.27 anymore. It compiles & boots.
Ingo
--- linux/include/asm-i386/mmu_context.h.orig Sun Jun 9 07:26:26 2002
+++ linux/include/asm-i386/mmu_context.h Sat Jul 20 22:48:37 2002
@@ -44,7 +44,7 @@
* has a non-default LDT.
*/
if (next->context.size+prev->context.size)
- load_LDT(&next->context);
+ load_LDT_no_preempt(&next->context, cpu);
}
#ifdef CONFIG_SMP
else {
@@ -56,7 +56,7 @@
* tlb flush IPI delivery. We must reload %cr3.
*/
load_cr3(next->pgd);
- load_LDT(&next->context);
+ load_LDT_no_preempt(&next->context, cpu);
}
}
#endif
--- linux/include/asm-i386/desc.h.orig Sun Jun 9 07:26:24 2002
+++ linux/include/asm-i386/desc.h Sat Jul 20 22:49:04 2002
@@ -90,9 +90,8 @@
/*
* load one particular LDT into the current CPU
*/
-static inline void load_LDT (mm_context_t *pc)
+static inline void load_LDT_no_preempt (mm_context_t *pc, int cpu)
{
- int cpu = smp_processor_id();
void *segments = pc->ldt;
int count = pc->size;
@@ -103,6 +102,13 @@
set_ldt_desc(cpu, segments, count);
__load_LDT(cpu);
+}
+static inline void load_LDT (mm_context_t *pc)
+{
+ int cpu = get_cpu();
+
+ load_LDT_no_preempt(pc, cpu);
+ put_cpu();
}
#endif /* !__ASSEMBLY__ */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Jul 23 2002 - 22:00:33 EST