Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Dec 2017 05:16:23 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r327415 - stable/11/sys/kern
Message-ID:  <201712310516.vBV5GN7F042066@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sun Dec 31 05:16:23 2017
New Revision: 327415
URL: https://svnweb.freebsd.org/changeset/base/327415

Log:
  MFC r324045:
  
      sysctl: remove target buffer read/write checks prior to calling the handler
  
      Said checks were inherently racy anyway as jokers could unmap target areas
      before the handler got around to accessing them.
  
      This saves time by avoiding locking the address space.

Modified:
  stable/11/sys/kern/kern_sysctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_sysctl.c
==============================================================================
--- stable/11/sys/kern/kern_sysctl.c	Sun Dec 31 05:14:40 2017	(r327414)
+++ stable/11/sys/kern/kern_sysctl.c	Sun Dec 31 05:16:23 2017	(r327415)
@@ -1982,16 +1982,9 @@ userland_sysctl(struct thread *td, int *name, u_int na
 		}
 	}
 	req.validlen = req.oldlen;
+	req.oldptr = old;
 
-	if (old) {
-		if (!useracc(old, req.oldlen, VM_PROT_WRITE))
-			return (EFAULT);
-		req.oldptr= old;
-	}
-
 	if (new != NULL) {
-		if (!useracc(new, newlen, VM_PROT_READ))
-			return (EFAULT);
 		req.newlen = newlen;
 		req.newptr = new;
 	}



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