Skip to contentSkip to conversation

x86: fix initialization of 'l' bit in ldt descriptors

PATCH Applied Jeremy Fitzhardinge 2 participants 2 messages Jul 27, 2008 – Jul 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix initialization of 'l' bit in ldt descriptors

Make sure that fill_ldt() initializes the 'l' bit in the descriptor. It always sets it to 0, ignoring 'lm' in user_desc, preserving original x86_64 behaviour.

Previously it was leaving 'l' uninitialized.

Cc Glauber de Oliveira Costa <[email protected]>

---
include/asm-x86/desc.h | 5 +++++

1 file changed, 5 insertions(+)
include/asm-x86/desc.h +0 -0
diff -r c79984cfb996 include/asm-x86/desc.h
@@ -24,6 +24,9 @@
	desc->d = info->seg_32bit;
	desc->g = info->limit_in_pages;
	desc->base2 = (info->base_addr & 0xff000000) >> 24;

+ /* Don't allow setting of the lm bit. It is useless anyways
+ because 64bit system calls require __USER_CS. */
+ desc->l = 0;
}

extern struct desc_ptr idt_descr;

Applied
#1 lore raw
Quoted 5 lines · Jeremy Fitzhardinge

Make sure that fill_ldt() initializes the 'l' bit in the descriptor. It always sets it to 0, ignoring 'lm' in user_desc, preserving original x86_64 behaviour.

Previously it was leaving 'l' uninitialized.

applied to tip/x86/xen. (will propagate it to x86/urgent after a bit of testing) Thanks,

Ingo