Skip to contentSkip to conversation

x86, Fix broken LDT access in VMI

PATCH In review Zachary Amsden 3 participants 3 messages Sep 30, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, Fix broken LDT access in VMI

This one took a long time to rear up because LDT usage is not very common, but the bug is quite serious. It got introduced along with another bug, already fixed, by 75b8bb3e56ca09a467fbbe5229bc68627f7445be

Please apply. Fix should also be headed for stable tree and backported, it is really sadly trivial. Glauber, Ingo, sorry for the offlist posting, somehow the original missed LKML.

Zach

After investigating a JRE failure, I found this bug was introduced a long time ago, and had already managed to survive another bugfix which occurred on the same line. The result is a total failure of the JRE due to LDT selectors not working properly.

arch/x86/kernel/vmi_32.c +1 -1
index 040a95e..411e34f 100644
@@ -234,7 +234,7 @@ static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
 				const void *desc)
 {
 	u32 *ldt_entry = (u32 *)desc;
-	vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
+	vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
 }
 
 static void vmi_load_sp0(struct tss_struct *tss,
#1 lore raw

arch/x86/kernel/vmi_32.c static void vmi_write_ldt_entry(struct desc_struct *dt, int entry, · line 237

Quoted 10 lines · Zachary Amsden

This one took a long time to rear up because LDT usage is not very common, but the bug is quite serious. It got introduced along with another bug, already fixed, by 75b8bb3e56ca09a467fbbe5229bc68627f7445be

Please apply. Fix should also be headed for stable tree and backported, it is really sadly trivial. Glauber, Ingo, sorry for the offlist posting, somehow the original missed LKML.

arch/x86/kernel/vmi_32.c +1 -1
-	vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
+	vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);

oops. Applied to tip/x86/urgent, thanks Zachary!

Ingo

#2 lore raw
Quoted 2 lines · Ingo Molnar

arch/x86/kernel/vmi_32.c static void vmi_write_ldt_entry(struct desc_struct *dt, int entry, · line 237

Quoted 2 lines
arch/x86/kernel/vmi_32.c +1 -1
-     vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
+     vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);

For a few seconds I thought it was diff going mad diff'ing exactly similar lines.

This one could actually use some capitalization to reduce the possibility of similar problems in future - rename to write_IDT_entry and write_LDT_entry perhaps?

Parag