From: Jakub Kicinski <kuba@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
dhowells@redhat.com, gustavoars@kernel.org,
aleksander.lobakin@intel.com, tstruk@gigaio.com
Subject: Re: [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header
Date: Wed, 20 Aug 2025 10:17:52 -0700 [thread overview]
Message-ID: <20250820101752.63be03da@kernel.org> (raw)
In-Reply-To: <202508182056.0D808624D8@keescook>
On Mon, 18 Aug 2025 21:06:10 -0700 Kees Cook wrote:
> > 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.
While staring at the kbuild bot report (which I can't repro :|)
I realized this include is to give kernel's __counted_by and friends
precedence over the empty uAPI-facing defines.
Not sure this is the most fortunate approach, personally I'd rather wrap
our empty user-space-facing defines under ifndef __KERNEL__. I think
it'd be better from "include what you need" perspective. Perhaps stddef
pulling in compiler annotations is expected, dunno...
Would you be okay with:
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 6bbccb43f7e7..4c20c62c4faf 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -32,7 +32,7 @@ fi
sed -E -e '
s/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g
s/__attribute_const__([[:space:]]|$)/\1/g
- s@^#include <linux/compiler(|_types).h>@@
+ s@^#include <linux/compiler.h>@@
s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g
s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g
s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @
diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index b87df1b485c2..9a28f7d9a334 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -2,7 +2,9 @@
#ifndef _UAPI_LINUX_STDDEF_H
#define _UAPI_LINUX_STDDEF_H
+#ifdef __KERNEL__
#include <linux/compiler_types.h>
+#endif
? As you pointed out compiler_types.h is only included under stddef.h
so the special handling in the installation script is easily avoided.
next prev parent reply other threads:[~2025-08-20 17:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 18:18 [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header Jakub Kicinski
2025-08-19 4:06 ` Kees Cook
2025-08-20 17:17 ` Jakub Kicinski [this message]
2025-08-26 2:54 ` Kees Cook
2025-08-26 13:47 ` Jakub Kicinski
2025-08-19 9:26 ` kernel test robot
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=20250820101752.63be03da@kernel.org \
--to=kuba@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=gustavoars@kernel.org \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tstruk@gigaio.com \
/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.