mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 2.6.17-rc5] i386: fix get_segment_eip() with vm86 segments
@ 2006-05-30  2:52 Chuck Ebbert
  0 siblings, 0 replies; only message in thread
From: Chuck Ebbert @ 2006-05-30  2:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Linus Torvalds, Zachary Amsden

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 <76306.1226@compuserve.com>

--- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-30  2:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-30  2:52 [patch 2.6.17-rc5] i386: fix get_segment_eip() with vm86 segments Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®