[patch 2.6.17-rc5] i386: fix get_segment_eip() with vm86 segments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to check for vm86 mode first before looking at selector
privilege bits.

Segment limit is always base + 64k and only the low 16 bits of
EIP are significant in vm86 mode.

Signed-off-by: Chuck Ebbert <[email protected]>

--- 2.6.17-rc5-32.orig/arch/i386/mm/fault.c
+++ 2.6.17-rc5-32/arch/i386/mm/fault.c
@@ -77,12 +77,15 @@ static inline unsigned long get_segment_
 	unsigned seg = regs->xcs & 0xffff;
 	u32 seg_ar, seg_limit, base, *desc;
 
+	/* Unlikely, but must come before segment checks. */
+	if (unlikely(regs->eflags & VM_MASK)) {
+		base = seg << 4;
+		*eip_limit = base + 0xffff;
+		return base + (eip & 0xffff);
+	}
+
 	/* The standard kernel/user address space limit. */
 	*eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg;
-
-	/* Unlikely, but must come before segment checks. */
-	if (unlikely((regs->eflags & VM_MASK) != 0))
-		return eip + (seg << 4);
 	
 	/* By far the most common cases. */
 	if (likely(seg == __USER_CS || seg == __KERNEL_CS))
-- 
Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux