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: Tue, 5 Dec 2023 14:14:55 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Greg KH <greg@...ah.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, tanzirh@...gle.com, 
	Kees Cook <keescook@...omium.org>, Andy Shevchenko <andy@...nel.org>, linux-hardening@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Nick DeSaulniers <nnn@...gle.com>, 
	Andrew Morton <akpm@...ux-foundation.org>, llvm@...ts.linux.dev
Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU

On Tue, Dec 5, 2023 at 1:59 PM Greg KH <greg@...ah.com> wrote:
>
> On Tue, Dec 05, 2023 at 01:51:10PM -0800, Nick Desaulniers wrote:
> > On Tue, Dec 5, 2023 at 1:38 PM Al Viro <viro@...iv.linux.org.uk> wrote:
> > >
> > > It also breeds includes of asm/*.h, by the look of the output, which is
> > > not a good thing in general ;-/  E.g. #include <asm/uaccess.h> *anywhere*
> > > outside of linux/uaccess.h is a bad idea.
> >
> > It's not clear to me when it's ok to #include <asm/*.h>.  Is there a
> > convention here that I'm missing?
>
> General rule, NEVER include asm/*.h, there should be a include/*.h
> instead that works.  So much so that checkpatch.pl should catch this,
> right?

ah, shoot, I was showing Tanzir how to use `b4` for patch development,
and forgot to check this.  Indeed it does.

I can see how the check works (scripts/checkpatch.pl L5881).  Decoding
that will probably help us improve the tooling.

>
> But of course, it doesn't always hold true, there are a few minor
> exceptions, but they are rare.

$ grep -r \\#include lib | grep asm

shows quite a few exceptions, and just in lib/.

For example, lib/math/int_log.c includes asm/bug.h.  Is that a case
where lib/math/int_log.c should be #include 'ing linux/bug.h rather
than asm/bug.h?
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists