mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Nathan Chancellor" <nathan@kernel.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>
Cc: 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: Wed, 23 Sep 2026 13:40:57 +0300	[thread overview]
Message-ID: <80690e33ca5d2eb3cdbe5b84f75b2af39e3b8423@intel.com> (raw)
In-Reply-To: <20260917171722.GA356152@ax162>

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?

BR,
Jani.


-- 
Jani Nikula, Intel

      reply	other threads:[~2026-09-23 10:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 10:43 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 [this message]

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=80690e33ca5d2eb3cdbe5b84f75b2af39e3b8423@intel.com \
    --to=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=nathan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®