Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2016 17:16:08 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r307940 - stable/10/sys/amd64/amd64
Message-ID:  <201610251716.u9PHG85X076520@repo.freebsd.org>

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

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

Modified: stable/10/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:15:32 2016	(r307939)
+++ stable/10/sys/amd64/amd64/sys_machdep.c	Tue Oct 25 17:16:08 2016	(r307940)
@@ -619,6 +619,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))
@@ -631,7 +633,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?201610251716.u9PHG85X076520>