Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2016 17:13:46 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r307936 - head/sys/amd64/amd64
Message-ID:  <201610251713.u9PHDkq2076226@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue Oct 25 17:13:46 2016
New Revision: 307936
URL: https://svnweb.freebsd.org/changeset/base/307936

Log:
  The argument validation in r296956 was not enough to close all possible
  overflows in sysarch(2).
  
  Submitted by:	Kun Yang <kun.yang chaitin.com>
  Patch by:	kib
  Security:	SA-16:15

Modified:
  head/sys/amd64/amd64/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- head/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:11:20 2016	(r307935)
+++ head/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:13:46 2016	(r307936)
@@ -608,6 +608,8 @@ amd64_set_ldt(td, uap, descs)
 		largest_ld = uap->start + uap->num;
 		if (largest_ld > max_ldt_segment)
 			largest_ld = max_ldt_segment;
+		if (largest_ld < uap->start)
+			return (EINVAL);
 		i = largest_ld - uap->start;
 		mtx_lock(&dt_lock);
 		bzero(&((struct user_segment_descriptor *)(pldt->ldt_base))
@@ -620,7 +622,8 @@ amd64_set_ldt(td, uap, descs)
 		/* verify range of descriptors to modify */
 		largest_ld = uap->start + uap->num;
 		if (uap->start >= max_ldt_segment ||
-		    largest_ld > max_ldt_segment)
+		    largest_ld > max_ldt_segment ||
+		    largest_ld < uap->start)
 			return (EINVAL);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610251713.u9PHDkq2076226>