freebsd at jdc.parodius.com
Fri Dec 23 22:54:47 UTC 2011
On Fri, Dec 23, 2011 at 03:21:06PM -0700, Charlie Martin wrote:
> In the course of looking at Jeremy's reponse to my query about a
> mystery panic, I noted his recommendation that PRINTF_BUFR_SIZE be
> set to 256. Ever-obedient, I went to set the value, and discovered
> instead that the conf file already has it set to 4096.
> As he says below, there are concerns about setting the value too
> high causing "major issues".
> I being Christmas and all I hate to ask Jeremy to dig up the post he
> mentioned, but wonder if anyone can clue me in on what the major
> issues might be?
As Andriy pointed out, potential stack overflow is the concern. The
buffer size defined in the config file is allocated on the stack (e.g.
char buf). The concern was mentioned by Kris Kenneway (and this
is the post I eluded to):
When I was doing FreeBSD "stuff" as part of the Project, I added this to
my Commonly Reported Issues wiki page since it comes up quite often.
Search for "BUFR".
John Baldwin also chimed in with some insights a few years later:
I had a conversation with John (I thought publicly but I can't find it;
it's probably in my mail archives though) about this, as he has some
ideas on how to solve it but he would need the time to work on it.
I'll point out, however, that ddb(4) and dtrace debug (I think for
debugging dtrace itself, not sure) kernel bits both use this same
methodology (allocated buffer on the stack). See DDB_BUFR_SIZE and
Linux solved this problem in a roundabout way, by implementing a "ring
buffer" for klogd (kernel logging daemon). The below document looks
daunting given its length and diagrams, but it's actually quite clever
(well I thought so anyway):
> On 12/22/2011 05:07 PM, Jeremy Chadwick wrote:
> >Also, be aware that the above stack trace is interspersed. Ultimately
> >you get to clean up the output yourself. This is a long-standing
> >problem with FreeBSD which can be helped but only slightly/barely by
> >using "options PRINTF_BUFR_SIZE=256" in your kernel configuration (the
> >default configs have a value of 128. Do not increase the value too
> >high, there are concerns about it causing major issues; I can dig up the
> >post that says that, but I'd rather not).
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, US |
| Making life hard for others since 1977. PGP 4BD6C0CB |
More information about the freebsd-stable