[Lguest] should lg_cpu.ssh1 be u16 ?

Matias Zabaljauregui zabaljauregui at gmail.com
Sun May 24 05:26:05 EST 2009


Rusty, 

I just realized that our ss1 member in lg_cpu is u8. 
I guess this is not an issue with Linux because it always stores __KERNEL_DS (index for the 13th GDT entry)
so 8 bits are enough. But I'm asking myself what happens if the kernel data segment descriptor 
gets moved to some higher GDT entry or we get to support other guests some day?  

Just in case you consider its worth to apply (it doesn't fix any present issue), here is the patch:

regards


Segment selectors are 16-bit long. Fix lg_cpu.ss1 definition.

Signed-off-by: Matias Zabaljauregui <zabaljauregui at gmail.com>

---
 drivers/lguest/lg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index af92a17..edd2ed5 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -49,7 +49,7 @@ struct lg_cpu {
 	u32 cr2;
 	int ts;
 	u32 esp1;
-	u8 ss1;
+	u16 ss1;
 
 	/* Bitmap of what has changed: see CHANGED_* above. */
 	int changed;
-- 
1.5.6.3






More information about the Lguest mailing list