Re: [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header

Kees Cook
2025-08-19T04:06:11Z

On Mon, Aug 18, 2025 at 11:18:48AM -0700, Jakub Kicinski wrote:
> [...]
> header. There is a hack in scripts/headers_install.sh which
> strips includes of compiler.h and compiler_types.h.

This looks like the last user of compiler_types.h in include/uapi, so
it'd probably be best to also remove portion of the hack from
scripts/headers_install.sh while you're at it.

> [...]
> understanding knows what that chain would be, given
> kernel doesn't include uAPI stddef.h, and user space
> has the compiler headers stripped.

Uh, yes it does:

$ git grep uapi/linux/stddef.h
include/linux/stddef.h:#include <uapi/linux/stddef.h>

> [...]
> Since nothing needs this include, let's remove it.

But yes, nothing uses compiler_types.h via uapi/linux/stddef.h. That
does seem to be true.

I find the change of subject between stddef.h ("nothing includes the
uapi header") and compiler_types.h ("nothing needs this include") to be
confusing in the commit log. :)

> [...]
> Builds pass on x86, arm64, csky, m68k, riscv32.
> The direct motivation for the change is that the includes
> of compiler.h and co. make it hard to include uAPI headers
> from tools/.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

If you can clear that up and everything is building, then this change
would be fine my me.

--
Kees Cook