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:48:53 -0700
From:	Randy Dunlap <rdunlap@...otime.net>
To:	Matthew Wilcox <matthew@....cx>
Cc:	Andi Kleen <ak@...e.de>, Geert Uytterhoeven <geert@...ux-m68k.org>,
	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, 22 Oct 2006 19:36:04 -0600 Matthew Wilcox wrote:

> On Mon, Oct 23, 2006 at 03:31:16AM +0200, Andi Kleen wrote:
> > On Monday 23 October 2006 03:08, Matthew Wilcox wrote:
> > > On Mon, Oct 23, 2006 at 02:42:58AM +0200, Andi Kleen wrote:
> > > > 
> > > > > /*+
> > > > >  * Provides: struct sched
> > > > >  * Provides: total_forks, nr_threads, process_counts, nr_processes()
> > > > >  * Provides: nr_running(), nr_uninterruptible(), nr_active(), nr_iowait(), weighted_cpuload()
> > > > >  */
> > > > 
> > > > That's ugly.  If it needs that i don't think it's a good idea.
> > > > We really want standard C, not some Linux dialect.
> > > 
> > > Um, that's a comment.  It's standard C.
> > 
> > If you require it to do something it isn't a comment anymore -- it would become
> > a language extension.
> 
> How is this any different from __iomem annotations?
> 
> > > Here's the problem.  If a file needs canonicalize_irq(), it should
> > > include <linux/interrupt.h> (which eventually ends up including
> > > asm/irq,h), and not <asm/irq.h> (where it's defined).
> > > If a file needs add_wait_queue(), it should include <linux/wait.h>
> > > (where it's defined) and not <linux/fs.h> (which directly includes
> > > linux/wait.h>.
> > > 
> > > Please define an algorithm which distinguishes the two cases.
> > 
> > Needs are inside {} or in a macro definition
> > So if the identifier happens after #define or inside {} assume the symbol
> > is needed from somewhere else, otherwise it is declared here.
> > 
> > That is likely not 100% foolproof, but should be good enough and
> > the mismatches can be resolved by hand.
> 
> Let me try to explain the problem again, because what you wrote has
> nothing to do with the problem.
> 
> canonicalize_irq() is defined in <asm/irq.h>.  No .c file should be
> including <asm/irq.h> in order to get it.  It should be including
> <linux/interrupt.h>, which will indirectly pull in <asm/irq.h>

We can add #error or #warning to asm/irq.h when that is done &
detected hence caught and will be fixed.
Don't we already have a few like that?  ("don't include this file
directly")  I looked quickly but didn't see them...

> add_wait_queue() is defined in <linux/wait.h>.  .c files wishing to use
> add_wait_queue() should be including <linux/wait.h> rather than relying
> on it being pulled in through some other path.
> 
> This needs annotations to fix, or a big bag of unreliable heuristics.


---
~Randy
-
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