All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	linux-kernel@vger.kernel.org,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Jason Gunthorpe" <jgg@nvidia.com>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: add header check facility as a manually run static analyzer
Date: Fri, 25 Sep 2026 20:44:18 +0100	[thread overview]
Message-ID: <20260925194418.GA3652012@ax162> (raw)
In-Reply-To: <80690e33ca5d2eb3cdbe5b84f75b2af39e3b8423@intel.com>

On Wed, Sep 23, 2026 at 01:40:57PM +0300, Jani Nikula wrote:
> On Thu, 17 Sep 2026, Nathan Chancellor <nathan@kernel.org> wrote:
> > On Thu, Sep 17, 2026 at 11:05:32AM +0200, Thomas Weißschuh wrote:
> >> On 2026-09-16 16:13:19-0700, Nathan Chancellor wrote:
> >> > include/uapi already has its own header checking infrastructure under
> >> > CONFIG_UAPI_HEADER_TEST and usr/include/Makefile, which avoids this with
> >> > a no-header-test list that includes many of the files listed in these
> >> > messages. To be honest, we should probably forbid HEADER_CHECK from
> >> > including 'include/uapi' and refer people to use CONFIG_UAPI_HEADER_TEST
> >> > instead, as there are other differences like being built under a
> >> > different C standard or C++ and such that the existing infrastructure
> >> > handles.
> >> 
> >> Testing the UAPI headers here too would still be valuable.
> >> CONFIG_UAPI_HEADER_TEST tests the headers from the perspective of
> >> userspace after they have undergone processing. The kernel build
> >> might see the same headers quite differently.
> >> 
> >> For instance the example from above:
> >> 
> >> ./../include/uapi/linux/input.h:29:6: warning: ‘__BITS_PER_LONG’ is not defined, evaluates to ‘0’ [-Wundef]
> >>    29 | #if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) && !defined(__KERNEL__)
> >>       |      ^~~~~~~~~~~~~~~
> >> ./../include/uapi/linux/input.h:34:9: error: unknown type name ‘__kernel_ulong_t’
> >>    34 |         __kernel_ulong_t __sec;
> >>       |         ^~~~~~~~~~~~~~~~
> >> 
> >> These are legitimate issues, the inclusion of the necessary header is
> >> gated behind #ifndef __KERNEL__ although it should not be.
> >
> > Hmmm, fair enough. I guess we can leave this functionality in place for
> > UAPI headers then but I just worry about people doing what Randy did and
> > reporting these issues when they are already known and handled in some
> > other way. Maybe the UAPI header test could grow an "internal kernel
> > usage" check similar to the other checks that it has at some point then
> > we could forbid HEADER_CHECK=include/uapi but it is fine for now.
> 
> Do you think the patch at hand is good to go, then? Anything further you
> need from me?

I don't have any other comments or objections. I will give a few days
for other folks to comment on it before I apply it to the kbuild tree.

-- 
Cheers,
Nathan

  reply	other threads:[~2026-09-25 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 10:43 [PATCH] kbuild: add header check facility as a manually run static analyzer Jani Nikula
2026-09-16 22:24 ` Randy Dunlap
2026-09-16 23:13   ` Nathan Chancellor
2026-09-17  2:26     ` Randy Dunlap
2026-09-17  8:14     ` Jani Nikula
2026-09-17  9:05     ` Thomas Weißschuh
2026-09-17 11:58       ` Jason Gunthorpe
2026-09-17 17:17       ` Nathan Chancellor
2026-09-23 10:40         ` Jani Nikula
2026-09-25 19:44           ` Nathan Chancellor [this message]
2026-10-02 20:21 ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925194418.GA3652012@ax162 \
    --to=nathan@kernel.org \
    --cc=jani.nikula@intel.com \
    --cc=jgg@nvidia.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=masahiroy@kernel.org \
    --cc=nsc@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.