Date: Mon, 25 Nov 2019 07:38:27 +0000 (UTC) From: Ryan Libby <rlibby@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355083 - head/sys/kern Message-ID: <201911250738.xAP7cRbe029576@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rlibby Date: Mon Nov 25 07:38:27 2019 New Revision: 355083 URL: https://svnweb.freebsd.org/changeset/base/355083 Log: sysctl sysctls: wire old buf before output with sysctl lock Several sysctl sysctls output to a user buffer while holding a non-sleepable lock that protects the sysctl topology. They need to wire the output buffer, or else they may try to sleep on a page fault. Reviewed by: cem, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22528 Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Mon Nov 25 07:13:05 2019 (r355082) +++ head/sys/kern/kern_sysctl.c Mon Nov 25 07:38:27 2019 (r355083) @@ -1023,12 +1023,16 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) { int *name = (int *) arg1; u_int namelen = arg2; - int error = 0; + int error; struct sysctl_oid *oid; struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; struct rm_priotracker tracker; char buf[10]; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); while (namelen) { if (!lsp) { @@ -1265,6 +1269,10 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) struct rm_priotracker tracker; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) @@ -1294,6 +1302,10 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) struct rm_priotracker tracker; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) @@ -1318,6 +1330,10 @@ sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; struct rm_priotracker tracker; int error; + + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911250738.xAP7cRbe029576>