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]
Date:	Sun, 22 Oct 2006 18:31:11 -0600
From:	Matthew Wilcox <matthew@....cx>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Randy Dunlap <rdunlap@...otime.net>,
	Stefan Richter <stefanr@...6.in-berlin.de>,
	Al Viro <viro@....linux.org.uk>,
	Linus Torvalds <torvalds@...l.org>,
	Alexey Dobriyan <adobriyan@...il.com>,
	Linux Kernel Development <linux-kernel@...r.kernel.org>,
	linux-arch@...r.kernel.org
Subject: Re: dealing with excessive includes

On Sun, Oct 22, 2006 at 07:58:53PM +0200, Geert Uytterhoeven wrote:
> On Fri, 20 Oct 2006, Randy Dunlap wrote:
> > Yes, we have lots of header include indirection going on.
> > I don't know of a good tool to detect/fix it.
> 
> BTW, what about making sure all header files are self-contained (i.e. all
> header files include all stuff they need)? This would make it easier for the
> users to know which files to include.

I was wondering about putting in some tags in comments in the headers and
using scripts to parse them out.  Something like:

/*+
 * Provides: struct sched
 * Provides: total_forks, nr_threads, process_counts, nr_processes()
 * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
 */

(you should be able to have multiple /*+ blocks in the file, multiple
Provides: lines and multiple things provided on a line.  Functions are
tagged with a trailing (), structs with the leading 'struct' and
everything else is a variable.)

Not only does that tell a script unambiguously which header needs to
be included for what function, struct definition and variable, it also
tells the programmer what header to include for what function.

This would have the benefit over automated analysis that you can put
Provides: irq_canonicalize() in <linux/interrupt.h> despite it being
actually defined in <asm/irq.h> (there's probably better examples
than this).

The script could warn for both unnecessary headers included and warn for
headers which weren't included but should be.  The warnings would start
out fairly useful and improve as we added more Provides: lines.

Anyone want to code this, or just pick holes in it?
-
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