From owner-svn-src-all@FreeBSD.ORG Sun Mar 15 00:16:06 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC74D772; Sun, 15 Mar 2015 00:16:06 +0000 (UTC) Received: from relay.mailchannels.net (ftx-008-i767.relay.mailchannels.net [50.61.143.67]) by mx1.freebsd.org (Postfix) with ESMTP id EF7173EC; Sun, 15 Mar 2015 00:16:03 +0000 (UTC) X-Sender-Id: duocircle|x-authuser|hippie Received: from smtp7.ore.mailhop.org (ip-10-204-4-183.us-west-2.compute.internal [10.204.4.183]) by relay.mailchannels.net (Postfix) with ESMTPA id E388710010B; Sat, 14 Mar 2015 23:58:16 +0000 (UTC) X-Sender-Id: duocircle|x-authuser|hippie Received: from smtp7.ore.mailhop.org (smtp7.ore.mailhop.org [10.83.15.107]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.4.8); Sat, 14 Mar 2015 23:58:18 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: duocircle|x-authuser|hippie X-MailChannels-Auth-Id: duocircle X-MC-Loop-Signature: 1426377498029:1708916054 X-MC-Ingress-Time: 1426377498029 Received: from c-73-34-117-227.hsd1.co.comcast.net ([73.34.117.227] helo=ilsoft.org) by smtp7.ore.mailhop.org with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.82) (envelope-from ) id 1YWvwc-0005BH-SV; Sat, 14 Mar 2015 23:58:15 +0000 Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t2ENwBK5019713; Sat, 14 Mar 2015 17:58:11 -0600 (MDT) (envelope-from ian@freebsd.org) X-Mail-Handler: DuoCircle Outbound SMTP X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@duocircle.com (see https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information for abuse reporting information) X-MHO-User: U2FsdGVkX1+mJ0dj0e0WVJmHGcXncvtz Message-ID: <1426377491.39727.4.camel@freebsd.org> Subject: Re: svn commit: r279997 - head/sys/netinet From: Ian Lepore To: John Baldwin Date: Sat, 14 Mar 2015 17:58:11 -0600 In-Reply-To: <12123739.Rz3jP8R4fM@ralph.baldwin.cx> References: <201503141811.t2EIBPeE006504@svn.freebsd.org> <12123739.Rz3jP8R4fM@ralph.baldwin.cx> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-AuthUser: hippie Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2015 00:16:07 -0000 On Sat, 2015-03-14 at 17:52 -0400, John Baldwin wrote: > On Saturday, March 14, 2015 06:11:25 PM Ian Lepore wrote: > > Author: ian > > Date: Sat Mar 14 18:11:24 2015 > > New Revision: 279997 > > URL: https://svnweb.freebsd.org/changeset/base/279997 > > > > Log: > > Use sbuf_new_for_sysctl() instead of plain sbuf_new() to ensure sysctl > > string returned to userland is nulterminated. > > > > PR: 195668 > > This is not safe. sbuf_printf() is invoked with a lock held, so it isn't > safe for the sbuf code to do a drain here. With sbuf_new_for_sysctl(), > any call to an sbuf routine is a potential page fault, so the handler must > either use sysctl_wire_old_buffer(), or the contents need to be output in > one go. For this case I would prefer to use sbuf_len(sb) + 1 (or add > INCLUDENUL to the args when creating it) and leave the sole SYSCTL_OUT() > at the end. > > You will want to check the one or two other places you converted for this > same issue as well. > Doh! I was trying to keep an eye out for locks, but I missed that one. Fixed in r280014. I'm at that point in a big maintenance task where I've looked at too much code in too short a time, thanks for keeping a watchful eye on all this. -- Ian