Date: Sat, 14 Mar 2015 17:58:11 -0600 From: Ian Lepore <ian@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r279997 - head/sys/netinet Message-ID: <1426377491.39727.4.camel@freebsd.org> In-Reply-To: <12123739.Rz3jP8R4fM@ralph.baldwin.cx> References: <201503141811.t2EIBPeE006504@svn.freebsd.org> <12123739.Rz3jP8R4fM@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1426377491.39727.4.camel>