From owner-svn-src-all@FreeBSD.ORG Thu Mar 12 23:31:04 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 AF90BB98; Thu, 12 Mar 2015 23:31:04 +0000 (UTC) Received: from relay.mailchannels.net (aso-006-i440.relay.mailchannels.net [23.91.64.121]) by mx1.freebsd.org (Postfix) with ESMTP id AEB5EC8E; Thu, 12 Mar 2015 23:31:03 +0000 (UTC) X-Sender-Id: duocircle|x-authuser|hippie Received: from smtp4.ore.mailhop.org (ip-10-229-11-165.us-west-2.compute.internal [10.229.11.165]) by relay.mailchannels.net (Postfix) with ESMTPA id 8D2C4100A6D; Thu, 12 Mar 2015 23:25:01 +0000 (UTC) X-Sender-Id: duocircle|x-authuser|hippie Received: from smtp4.ore.mailhop.org (smtp4.ore.mailhop.org [10.21.145.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.4.8); Thu, 12 Mar 2015 23:25:01 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: duocircle|x-authuser|hippie X-MailChannels-Auth-Id: duocircle X-MC-Loop-Signature: 1426202701683:833093024 X-MC-Ingress-Time: 1426202701683 Received: from c-73-34-117-227.hsd1.co.comcast.net ([73.34.117.227] helo=ilsoft.org) by smtp4.ore.mailhop.org with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.82) (envelope-from ) id 1YWCTL-00060B-UZ; Thu, 12 Mar 2015 23:25:00 +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 t2CNOpfq014959; Thu, 12 Mar 2015 17:24:51 -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: U2FsdGVkX19f0RL5OiUjwNIYM2EV9BCJ Message-ID: <1426202691.6265.4.camel@freebsd.org> Subject: Re: svn commit: r279932 - head/sys/vm From: Ian Lepore To: Ryan Stone Date: Thu, 12 Mar 2015 17:24:51 -0600 In-Reply-To: References: <201503121806.t2CI6VSU034853@svn.freebsd.org> 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: Thu, 12 Mar 2015 23:31:04 -0000 On Thu, 2015-03-12 at 17:02 -0400, Ryan Stone wrote: > On Thu, Mar 12, 2015 at 2:06 PM, Ian Lepore wrote: > > > Nullterminate strings returned via sysctl. > > > > PR: 195668 > > > > To quote the manpage: > > > The *sbuf* family of functions allows one to safely > > allocate, construct and release bounded null-terminated > > strings in kernel space. > > IMO the sbuf API is broken if we have to explicitly null-terminate the > string ourselves. If we want the nullterm to be counted in the length of data in the buffer (and thus get transmitted back across the syscall boundary) we need to put an explicit counted nullterm byte into the buffer. I had started down the path of making that (counting the nullterm byte as part of the data in the buffer) a feature of sbuf that you could set with a flag, but then whoever added sbuf_new_for_sysctl() didn't propagate the flags field through the new function and I decided to not go off into the weeds making a new flavor of that takes flags. -- Ian