Skip to contentSkip to conversation

linux-2.6.18/x86-64: extend numeric user mode selector checks

PATCH New Jan Beulich 1 participant 1 message Oct 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/x86-64: extend numeric user mode selector checks

... to also cover Xen provided ones

arch/x86_64/mm/fault-xen.c +4 -3
@@ -146,7 +146,8 @@ static noinline int is_prefetch(struct p
 			/* Could check the LDT for lm, but for now it's good
 			   enough to assume that long mode only uses well known
 			   segments or kernel. */
-			scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS);
+			scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS)
+				    || (regs->cs == FLAT_USER_CS64);
 			break;
 			
 		case 0x60:
@@ -575,8 +576,8 @@ bad_area_nosemaphore:
 		   these addresses are not reachable. Just detect this
 		   case and return.  Any code segment in LDT is
 		   compatibility mode. */
-		if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) &&
-		    (address >> 32))
+		if ((regs->cs == __USER32_CS || regs->cs == FLAT_USER_CS32 ||
+		     (regs->cs & (1<<2))) && (address >> 32))
 			return;
 
 		if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {