Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2017 01:31:52 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324045 - head/sys/kern
Message-ID:  <201709270131.v8R1Vq8E059545@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}



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