svn commit: r324045 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Wed Sep 27 01:31:53 UTC 2017


Author: mjg
Date: Wed Sep 27 01:31:52 2017
New Revision: 324045
URL: https://svnweb.freebsd.org/changeset/base/324045

Log:
  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.
  
  MFC after:	1 week

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Wed Sep 27 01:27:43 2017	(r324044)
+++ head/sys/kern/kern_sysctl.c	Wed Sep 27 01:31:52 2017	(r324045)
@@ -2061,16 +2061,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