[PATCH] x86: fix initialization of 'l' bit in ldt descriptors

From: Jeremy Fitzhardinge
Date: Sun Jul 27 2008 - 11:42:46 EST


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.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Cc: Glauber de Oliveira Costa <gcosta@xxxxxxxxxx>
---
include/asm-x86/desc.h | 5 +++++
1 file changed, 5 insertions(+)

diff -r c79984cfb996 include/asm-x86/desc.h
--- a/include/asm-x86/desc.h Fri Jul 25 16:09:12 2008 -0700
+++ b/include/asm-x86/desc.h Sun Jul 27 08:31:08 2008 -0700
@@ -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;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/