* Re: [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header
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
2025-08-19 9:26 ` kernel test robot
1 sibling, 1 reply; 6+ messages in thread
From: Kees Cook @ 2025-08-19 4:06 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, dhowells,
gustavoars, aleksander.lobakin, tstruk
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header
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-19 9:26 ` kernel test robot
1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-08-19 9:26 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: llvm, oe-kbuild-all, netdev, edumazet, pabeni, andrew+netdev,
horms, Jakub Kicinski, dhowells, kees, gustavoars,
aleksander.lobakin, tstruk
Hi Jakub,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/stddef-don-t-include-compiler_types-h-in-the-uAPI-header/20250819-022023
base: net-next/main
patch link: https://lore.kernel.org/r/20250818181848.799566-1-kuba%40kernel.org
patch subject: [PATCH net-next] stddef: don't include compiler_types.h in the uAPI header
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250819/202508191741.O5OYysnF-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250819/202508191741.O5OYysnF-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508191741.O5OYysnF-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
In file included from <built-in>:3:
In file included from lib/vdso/gettimeofday.c:5:
In file included from include/vdso/auxclock.h:5:
In file included from include/uapi/linux/time.h:5:
>> include/linux/types.h:265:21: error: field has incomplete type 'struct task_struct'
265 | struct task_struct __rcu *task;
| ^
include/linux/types.h:265:9: note: forward declaration of 'struct task_struct'
265 | struct task_struct __rcu *task;
| ^
>> include/linux/types.h:265:26: error: expected ';' at end of declaration list
265 | struct task_struct __rcu *task;
| ^
| ;
In file included from <built-in>:3:
In file included from lib/vdso/gettimeofday.c:6:
In file included from include/vdso/datapage.h:7:
In file included from include/linux/compiler.h:5:
In file included from include/linux/compiler_types.h:89:
>> include/linux/compiler_attributes.h:55:9: warning: '__always_inline' macro redefined [-Wmacro-redefined]
55 | #define __always_inline inline __attribute__((__In file included from arch/arm64/kernel/vdso32/note.c:11:
In file included from include/linux/elfnote.h:62:
In file included from include/uapi/linux/elf.h:5:
>> include/linux/types.h:265:21: error: field has incomplete type 'struct task_struct'
alw ays_inline__))
| ^
include/uapi/linux/stddef.h:6:9: note: previous definition is here
6 | #define __always_inline inline
| ^
265 | struct task_struct __rcu *task;
| ^
In file included from <built-in>:3:
In file included from lib/vdso/gettimeofday.c:6:
In file included from include/vdso/datapage.h:7:
In file included from include/linux/compiler.h:5:
>> include/linux/compiler_types.h:346:10: warning: '__counted_by' macro redefined [-Wmacro-redefined]
346 | # define __counted_by(member) __attribute__((__counted_by__(member)))
| ^
include/uapi/linux/stddef.h:60:9: note: previous definition is here
60 | #define __counted_by(m)
| ^
In file included from include/linux/types.h:265:9: note: forward declaration of 'struct task_struct'
265 | struct task_struct __rcu *task;
| ^
<built-in>:3:
In file included from lib/vdso/gettimeofday.c:6:
In file included from include/vdso/datapage.h:7:
In file included from include/linux/compiler.h:5:
>> include/linux/compiler_types.h:367include/linux/types.h:265:26: error: expected ';' at end of declaration list
: 265 | struct task_struct __rcu *task;
| ^
| ;
9: warning: '__counted_by_le' macro redefined [-Wmacro-redefined]
367 | #define __counted_by_le(member) __counted_by(member)
| ^
include/uapi/linux/stddef.h:64:9: note: previous definition is here
64 | #define __counted_by_le(m)
| ^
In file included from <built-in>:3:
In file included from lib/vdso/gettimeofday.c:6:
In file included from include/vdso/datapage.h:7:
In file included from include/linux/compiler.h:5:
>> include/linux/compiler_types.h:368:9: warning: '__counted_by_be' macro redefined [-Wmacro-redefined]
368 | #define __counted_by_be(member)
| ^
include/uapi/linux/stddef.h:68:9: note: previous definition is here
68 | #define __counted_by_be(m)
| ^
>> error: expected ';' after struct
>> arch/arm64/kernel/vdso32/note.c:14:1: error: unknown type name '_note_14'
14 | ELFNOTE32("Linux", 0, LINUX_VERSION_CODE);
| ^
include/linux/elfnote.h:95:37: note: expanded from macro 'ELFNOTE32'
95 | #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
| ^
include/linux/elfnote.h:93:2: note: expanded from macro 'ELFNOTE'
93 | _ELFNOTE(size, name, __LINE__, type, desc)
| ^
include/linux/elfnote.h:79:4: note: expanded from macro '_ELFNOTE'
79 | } _ELFNOTE_PASTE(_note_, unique) \
| ^
include/linux/elfnote.h:71:29: note: expanded from macro '_ELFNOTE_PASTE'
71 | #define _ELFNOTE_PASTE(a,b) a##b
| ^
<scratch space>:11:1: note: expanded from here
11 | _note_14
| ^
>> error: expected ';' after struct
>> arch/arm64/kernel/vdso32/note.c:15:1: error: unknown type name '_note_15'
15 | BUILD_SALT;
| ^
include/linux/build-salt.h:16:8: note: expanded from macro 'BUILD_SALT'
16 | ELFNOTE32("Linux", LINUX_ELFNOTE_BUILD_SALT, CONFIG_BUILD_SALT)
| ^
include/linux/elfnote.h:95:37: note: expanded from macro 'ELFNOTE32'
95 | #define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
| ^
include/linux/elfnote.h:93:2: note: expanded from macro 'ELFNOTE'
93 | _ELFNOTE(size, name, __LINE__, type, desc)
| ^
include/linux/elfnote.h:79:4: note: expanded from macro '_ELFNOTE'
79 | } _ELFNOTE_PASTE(_note_, unique) \
| ^
include/linux/elfnote.h:71:29: note: expanded from macro '_ELFNOTE_PASTE'
71 | #define _ELFNOTE_PASTE(a,b) a##b
| ^
<scratch space>:21:1: note: expanded from here
21 | _note_15
| ^
6 errors generated.
make[3]: *** [arch/arm64/kernel/vdso32/Makefile:144: arch/arm64/kernel/vdso32/note.o] Error 1
4 warnings and 2 errors generated.
make[3]: *** [arch/arm64/kernel/vdso32/Makefile:146: arch/arm64/kernel/vdso32/vgettimeofday.o] Error 1
make[3]: Target 'arch/arm64/kernel/vdso32/vdso.so' not remade because of errors.
make[2]: *** [arch/arm64/Makefile:208: vdso_prepare] Error 2
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.
vim +/__always_inline +55 include/linux/compiler_attributes.h
86cffecdeaa278 Kees Cook 2021-11-05 45
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 46 /*
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 47 * Note: users of __always_inline currently do not write "inline" themselves,
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 48 * which seems to be required by gcc to apply the attribute according
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 49 * to its docs (and also "warning: always_inline function might not be
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 50 * inlinable [-Wattributes]" is emitted).
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 51 *
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 52 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-always_005finline-function-attribute
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 53 * clang: mentioned
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 54 */
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 @55 #define __always_inline inline __attribute__((__always_inline__))
a3f8a30f3f0079 Miguel Ojeda 2018-08-30 56
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread