svn commit: r327415 - stable/11/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sun Dec 31 05:16:24 UTC 2017


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


More information about the svn-src-all mailing list