Author: glebius
Date: Tue Oct 25 17:14:50 2016
New Revision: 307938
URL: https://svnweb.freebsd.org/changeset/base/307938

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

Modified: stable/11/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- stable/11/sys/amd64/amd64/sys_machdep.c     Tue Oct 25 17:13:58 2016        
(r307937)
+++ stable/11/sys/amd64/amd64/sys_machdep.c     Tue Oct 25 17:14:50 2016        
(r307938)
@@ -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);
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to