svn commit: r307941 - stable/9/sys/amd64/amd64

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


Author: glebius
Date: Tue Oct 25 17:16:58 2016
New Revision: 307941
URL: https://svnweb.freebsd.org/changeset/base/307941

Log:
  Merge r307936:
    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:
  stable/9/sys/amd64/amd64/sys_machdep.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:16:08 2016	(r307940)
+++ stable/9/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:16:58 2016	(r307941)
@@ -612,6 +612,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))
@@ -624,7 +626,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-stable-9 mailing list