From owner-svn-src-head@freebsd.org Wed Sep 27 01:31:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DCC9E27F10; Wed, 27 Sep 2017 01:31:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 355CD83343; Wed, 27 Sep 2017 01:31:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8R1Vq7l059546; Wed, 27 Sep 2017 01:31:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8R1Vq8E059545; Wed, 27 Sep 2017 01:31:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201709270131.v8R1Vq8E059545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 27 Sep 2017 01:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324045 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Sep 2017 01:31:53 -0000 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; }