svn commit: r307936 - head/sys/amd64/amd64

Gleb Smirnoff glebius at FreeBSD.org
Tue Oct 25 17:13:47 UTC 2016


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);
 	}
 


More information about the svn-src-head mailing list