lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225123898.3199.20.camel@calx>
Date:	Mon, 27 Oct 2008 11:11:38 -0500
From:	Matt Mackall <mpm@...enic.com>
To:	Chris Snook <csnook@...hat.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	akpm <akpm@...uxfoundation.org>
Subject: Re: Bloatwatch 2.6.28-rc1: last_sysfs_file

On Sat, 2008-10-25 at 06:38 -0400, Chris Snook wrote: 
> Matt Mackall wrote:
> > On Fri, 2008-10-24 at 15:52 -0500, Matt Mackall wrote:
> >> 2.6.28-rc1 adds 4k for last_sysfs_file debug tracking. That's one hell
> >> of a long sysfs path.
> >>
> >> http://www.selenic.com/bloatwatch/?cmd=compare;v1=2.6.27;v2=2.6.28-rc1;part=/built-in/fs/sysfs
> > 
> > ..especially given that printk is limited to 1k at a time.
> > 
> > 
> > sysfs: shrink last_sysfs_file to a reasonable size
> > 
> > sysfs was reserving 4k to store filenames for debug despite printk being
> > limited to 1k. Shrink this to something more reasonable.
> > 
> > Signed-off-by: Matt Mackall <mpm@...enic.com>
> > 
> > diff -r ac8c82ff3be7 fs/sysfs/file.c
> > --- a/fs/sysfs/file.c	Fri Oct 24 13:13:04 2008 -0500
> > +++ b/fs/sysfs/file.c	Fri Oct 24 16:11:53 2008 -0500
> > @@ -25,7 +25,7 @@
> >  #include "sysfs.h"
> >  
> >  /* used in crash dumps to help with debugging */
> > -static char last_sysfs_file[PATH_MAX];
> > +static char last_sysfs_file[200]; /* allow for disgustingly long paths */
> >  void sysfs_printk_last_file(void)
> >  {
> >  	printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file);
> > 
> > 
> 
> Please don't use magic numbers.  Use a symbolic constant, and modify printk.c to 
> use the same.

I'm explicitly not using a magic number because the relevant magic
number is absurdly large. It is in fact 4 times larger than printk can
print. And its 40 times larger than any path we are liable to encounter.
Inventing a new use-once #define meaning "good enough for debugging
99.99% of sysfs bugs" one line up is not an improvement here.

And why on earth would I modify anything in printk?

-- 
Mathematics is the supreme nostalgia of our time.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ