* [PATCH v2 0/5] kbuild: uapi: various fixes
@ 2025-08-13 6:16 Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:16 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
Various fixes and promotion of warnings to real errors.
I didn't add Fixes: tags as digging up the original changes would be
cumbersome as the code moved a lot over the years.
Backporting this doesn't make sense anyways.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Drop patch "kbuild: uapi: only update hdrtest output on success"
- Pick up review tags from Nicolas
- Link to v1: https://lore.kernel.org/r/20250812-kbuild-hdrtest-fixes-v1-0-7ad2af66cd58@linutronix.de
---
Thomas Weißschuh (5):
kbuild: uapi: rerun header tests when headers_check.pl changes
kbuild: uapi: fail header test on compiler warnings
kbuild: uapi: upgrade warning on asm/types.h inclusion to error
kbuild: uapi: upgrade check_sizetypes() warning to error
kbuild: uapi: upgrade check_declarations() warning to error
usr/include/Makefile | 4 ++--
usr/include/headers_check.pl | 9 ++++-----
2 files changed, 6 insertions(+), 7 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250811-kbuild-hdrtest-fixes-1bf147b3ddd3
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
@ 2025-08-13 6:16 ` Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:16 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
If the checks change they need to be rerun.
Add a Makefile dependency so this happens.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
usr/include/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/include/Makefile b/usr/include/Makefile
index f02f41941b60c88d921da2b955076bbff7884c1c..c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -85,7 +85,7 @@ quiet_cmd_hdrtest = HDRTEST $<
$(PERL) $(src)/headers_check.pl $(obj) $<; \
touch $@
-$(obj)/%.hdrtest: $(obj)/%.h FORCE
+$(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE
$(call if_changed_dep,hdrtest)
# Since GNU Make 4.3, $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) works.
--
2.50.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
@ 2025-08-13 6:16 ` Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:16 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
Compiler warnings also indicate issues with the headers.
Make sure they don't go unnoticed.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
usr/include/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/include/Makefile b/usr/include/Makefile
index c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2..61a7dd4fc05f004d785c64c0019ad846c84719d5 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -80,7 +80,7 @@ always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/
# Include the header twice to detect missing include guard.
quiet_cmd_hdrtest = HDRTEST $<
cmd_hdrtest = \
- $(CC) $(c_flags) -fsyntax-only -x c /dev/null \
+ $(CC) $(c_flags) -fsyntax-only -Werror -x c /dev/null \
$(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
$(PERL) $(src)/headers_check.pl $(obj) $<; \
touch $@
--
2.50.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
@ 2025-08-13 6:16 ` Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:16 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
No usages of '#include <asm/types.h> in the UAPI headers exist anymore.
Make sure it stays this way.
Add a semicolon to the end of the previous printf call to keep the
syntax valid.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
| 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 2b70bfa5558e64518808a22f2f926291da6e47a9..36307a137cc1e109e3e1c253f66f3e5935499fc8 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -98,9 +98,8 @@ sub check_asm_types
if ($line =~ m/^\s*#\s*include\s+<asm\/types.h>/) {
$linux_asm_types = 1;
printf STDERR "$filename:$lineno: " .
- "include of <linux/types.h> is preferred over <asm/types.h>\n"
- # Warn until headers are all fixed
- #$ret = 1;
+ "include of <linux/types.h> is preferred over <asm/types.h>\n";
+ $ret = 1;
}
}
--
2.50.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
` (2 preceding siblings ...)
2025-08-13 6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
@ 2025-08-13 6:16 ` Thomas Weißschuh
2025-10-06 8:53 ` Geert Uytterhoeven
2025-10-06 19:00 ` Nathan Chancellor
2025-08-13 6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor
5 siblings, 2 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:16 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
No problematic type usages exist anymore.
Make sure it stays this way.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
| 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 36307a137cc1e109e3e1c253f66f3e5935499fc8..36349b21cef5d55241b68ca24dabe6a321b7ce27 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -159,7 +159,6 @@ sub check_sizetypes
"found __[us]{8,16,32,64} type " .
"without #include <linux/types.h>\n";
$linux_types = 2;
- # Warn until headers are all fixed
- #$ret = 1;
+ $ret = 1;
}
}
--
2.50.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() warning to error
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
` (3 preceding siblings ...)
2025-08-13 6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
@ 2025-08-13 6:17 ` Thomas Weißschuh
2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor
5 siblings, 0 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2025-08-13 6:17 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh
No problematic declarations exist anymore.
Make sure it stays this way.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
| 1 +
1 file changed, 1 insertion(+)
--git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 36349b21cef5d55241b68ca24dabe6a321b7ce27..21c2fb9520e6af2d6ebf2decce69f6eea64efd88 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -74,6 +74,7 @@ sub check_declarations
printf STDERR "$filename:$lineno: " .
"userspace cannot reference function or " .
"variable defined in the kernel\n";
+ $ret = 1;
}
}
--
2.50.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/5] kbuild: uapi: various fixes
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
` (4 preceding siblings ...)
2025-08-13 6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
@ 2025-08-14 19:11 ` Nathan Chancellor
5 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2025-08-14 19:11 UTC (permalink / raw)
To: Nicolas Schier, Thomas Weißschuh
Cc: linux-kbuild, linux-kernel, Nicolas Schier
On Wed, 13 Aug 2025 08:16:55 +0200, Thomas Weißschuh wrote:
> Various fixes and promotion of warnings to real errors.
>
> I didn't add Fixes: tags as digging up the original changes would be
> cumbersome as the code moved a lot over the years.
> Backporting this doesn't make sense anyways.
>
>
> [...]
Applied, thanks!
[1/5] kbuild: uapi: rerun header tests when headers_check.pl changes
https://git.kernel.org/kbuild/c/d4b7080be277c
[2/5] kbuild: uapi: fail header test on compiler warnings
https://git.kernel.org/kbuild/c/3788d69db18d3
[3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error
https://git.kernel.org/kbuild/c/24b1bd64ee403
[4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
https://git.kernel.org/kbuild/c/c3a9d74ee413b
[5/5] kbuild: uapi: upgrade check_declarations() warning to error
https://git.kernel.org/kbuild/c/b8d762c983053
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
2025-08-13 6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
@ 2025-10-06 8:53 ` Geert Uytterhoeven
2025-10-06 19:00 ` Nathan Chancellor
1 sibling, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-10-06 8:53 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
Nicolas Schier
Hi Thomas,
On Fri, 15 Aug 2025 at 03:26, Thomas Weißschuh
<thomas.weissschuh@linutronix.de> wrote:
> No problematic type usages exist anymore.
>
> Make sure it stays this way.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>
Thanks for your patch, which is now commit c3a9d74ee413bdb3 ("kbuild:
uapi: upgrade check_sizetypes() warning to error") upstream,
> --- a/usr/include/headers_check.pl
> +++ b/usr/include/headers_check.pl
> @@ -159,7 +159,6 @@ sub check_sizetypes
> "found __[us]{8,16,32,64} type " .
> "without #include <linux/types.h>\n";
> $linux_types = 2;
> - # Warn until headers are all fixed
> - #$ret = 1;
> + $ret = 1;
> }
> }
Unfortunately not all of them have been fixed.
On m68k all{yes,mod}config:
usr/include/asm/bootinfo-amiga.h:18: found __[us]{8,16,32,64} type
without #include <linux/types.h>
make[6]: *** [usr/include/Makefile:89:
usr/include/asm/bootinfo-amiga.hdrtest] Error 1
As this is a false positive, I have sent a fix for headers_check.
"[PATCH] kbuild: uapi: Strip comments before size type check"
https://lore.kernel.org/6e68ab921a728caea4f3f37bfae9b1896edfa97a.1759740354.git.geert@linux-m68k.org
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
2025-08-13 6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
2025-10-06 8:53 ` Geert Uytterhoeven
@ 2025-10-06 19:00 ` Nathan Chancellor
2025-10-08 19:52 ` Nicolas Schier
1 sibling, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2025-10-06 19:00 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nicolas Schier, linux-kbuild, linux-kernel, Nicolas Schier
On Wed, Aug 13, 2025 at 08:16:59AM +0200, Thomas Weißschuh wrote:
> No problematic type usages exist anymore.
>
> Make sure it stays this way.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>
> ---
> usr/include/headers_check.pl | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
> index 36307a137cc1e109e3e1c253f66f3e5935499fc8..36349b21cef5d55241b68ca24dabe6a321b7ce27 100755
> --- a/usr/include/headers_check.pl
> +++ b/usr/include/headers_check.pl
> @@ -159,7 +159,6 @@ sub check_sizetypes
> "found __[us]{8,16,32,64} type " .
> "without #include <linux/types.h>\n";
> $linux_types = 2;
> - # Warn until headers are all fixed
> - #$ret = 1;
> + $ret = 1;
> }
> }
>
> --
> 2.50.1
>
Geert's regression report and subsequent fix made me look a little
closer at this check. Is it even useful to do this anymore now that we
compile test the headers? If these types are found without the
appropriate include, won't there just be an error? Or is this to avoid
the case where a system header may transitively include types.h so the
compile would succeed but the header is not as contained as it could be?
Cheers,
Nathan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
2025-10-06 19:00 ` Nathan Chancellor
@ 2025-10-08 19:52 ` Nicolas Schier
2025-10-09 16:56 ` Nathan Chancellor
0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Schier @ 2025-10-08 19:52 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Thomas Weißschuh, linux-kbuild, linux-kernel
On Mon, Oct 06, 2025 at 12:00:48PM -0700, Nathan Chancellor wrote:
> On Wed, Aug 13, 2025 at 08:16:59AM +0200, Thomas Weißschuh wrote:
> > No problematic type usages exist anymore.
> >
> > Make sure it stays this way.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > Reviewed-by: Nicolas Schier <nsc@kernel.org>
> > ---
> > usr/include/headers_check.pl | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
> > index 36307a137cc1e109e3e1c253f66f3e5935499fc8..36349b21cef5d55241b68ca24dabe6a321b7ce27 100755
> > --- a/usr/include/headers_check.pl
> > +++ b/usr/include/headers_check.pl
> > @@ -159,7 +159,6 @@ sub check_sizetypes
> > "found __[us]{8,16,32,64} type " .
> > "without #include <linux/types.h>\n";
> > $linux_types = 2;
> > - # Warn until headers are all fixed
> > - #$ret = 1;
> > + $ret = 1;
> > }
> > }
> >
> > --
> > 2.50.1
> >
>
> Geert's regression report and subsequent fix made me look a little
> closer at this check. Is it even useful to do this anymore now that we
> compile test the headers? If these types are found without the
> appropriate include, won't there just be an error? Or is this to avoid
> the case where a system header may transitively include types.h so the
> compile would succeed but the header is not as contained as it could be?
Good question. I think you're right, that header compiling should be
enough.
I cannot think of a sensible way that with successful header compile
test for an UAPI header file that is not contained.
Setting USERCFLAGS='-include something/like/types.h' during header
compilation may hide a missing '#include <linux/types.h>', but I don't
think that this is a good reason to keep the checking.
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
2025-10-08 19:52 ` Nicolas Schier
@ 2025-10-09 16:56 ` Nathan Chancellor
0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2025-10-09 16:56 UTC (permalink / raw)
To: Nicolas Schier; +Cc: Thomas Weißschuh, linux-kbuild, linux-kernel
On Wed, Oct 08, 2025 at 09:52:02PM +0200, Nicolas Schier wrote:
> Good question. I think you're right, that header compiling should be
> enough.
>
> I cannot think of a sensible way that with successful header compile
> test for an UAPI header file that is not contained.
>
> Setting USERCFLAGS='-include something/like/types.h' during header
> compilation may hide a missing '#include <linux/types.h>', but I don't
> think that this is a good reason to keep the checking.
Yeah that seems extremely unlikely to me...
Okay, I think I will send Geert's fix for 6.18 then send a patch in a
couple of weeks that removes this check from headers_check.pl
altogether for 6.19.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-10-09 16:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
2025-08-13 6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
2025-10-06 8:53 ` Geert Uytterhoeven
2025-10-06 19:00 ` Nathan Chancellor
2025-10-08 19:52 ` Nicolas Schier
2025-10-09 16:56 ` Nathan Chancellor
2025-08-13 6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox