Date: Mon, 6 Jul 2015 16:07:22 +0000 (UTC) From: Patrick Kelsey <pkelsey@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285208 - head/sys/kern Message-ID: <201507061607.t66G7M72037818@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pkelsey Date: Mon Jul 6 16:07:21 2015 New Revision: 285208 URL: https://svnweb.freebsd.org/changeset/base/285208 Log: Don't acquire sysctlmemlock in userland_sysctl() when the old value pointer is NULL, as in that case there are no userland pages that could potentially be wired. It is common for old to be NULL and oldlenp to be non-NULL in calls to userland_sysctl(), as this is used to probe for the length of a variable-length sysctl entry before retrieving a value. Note that it is typical for such calls to be made with an uninitialized value in *oldlenp, so sysctlmemlock was essentially being acquired at random (depending on the uninitialized value in *oldlenp being > PAGE_SIZE or not) for these calls prior to this patch. Differential Revision: https://reviews.freebsd.org/D2987 Reviewed by: mjg, kib Approved by: jmallett (mentor) MFC after: 1 month Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Mon Jul 6 14:09:00 2015 (r285207) +++ head/sys/kern/kern_sysctl.c Mon Jul 6 16:07:21 2015 (r285208) @@ -1784,7 +1784,7 @@ userland_sysctl(struct thread *td, int * ktrsysctl(name, namelen); #endif - if (req.oldlen > PAGE_SIZE) { + if (req.oldptr && req.oldlen > PAGE_SIZE) { memlocked = 1; sx_xlock(&sysctlmemlock); } else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507061607.t66G7M72037818>