Skip to contentSkip to conversation

Decouple build from userspace headers

PATCH Superseded Alexey Dobriyan 4 participants 16 messages Jul 13, 2021 – Jul 20, 2021

Subsystems (56)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Decouple build from userspace headers

In theory, userspace headers can be under incompatible license.

Linux by virtue of being OS kernel is fully independent piece of code and should not require anything from userspace.

For this:

* ship minimal <stdarg.h>
2 types, 4 macros

* delete "-isystem"
This is what enables leakage.

* fixup compilation where necessary.

---

 Makefile                                                               |    2 +-
 arch/um/include/shared/irq_user.h                                      |    1 -
 arch/um/os-Linux/signal.c                                              |    2 +-
 crypto/aegis128-neon-inner.c                                           |    2 --
 drivers/net/wwan/iosm/iosm_ipc_imem.h                                  |    1 -
 drivers/pinctrl/aspeed/pinmux-aspeed.h                                 |    1 -
 drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h |    2 --
 include/stdarg.h                                                       |    9 +++++++++
 sound/aoa/codecs/onyx.h                                                |    1 -
 sound/aoa/codecs/tas.c                                                 |    1 -
 10 files changed, 11 insertions(+), 11 deletions(-)
Makefile +1 -1
@@ -978,7 +978,7 @@ KBUILD_CFLAGS += -falign-functions=64
 endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included
-NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+NOSTDINC_FLAGS += -nostdinc
 
 # warn about C99 declaration after statement
 KBUILD_CFLAGS += -Wdeclaration-after-statement
arch/um/include/shared/irq_user.h +0 -1
@@ -7,7 +7,6 @@
 #define __IRQ_USER_H__
 
 #include <sysdep/ptrace.h>
-#include <stdbool.h>
 
 enum um_irq_type {
 	IRQ_READ,
arch/um/os-Linux/signal.c +1 -1
@@ -67,7 +67,7 @@ int signals_enabled;
 #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
 static int signals_blocked;
 #else
-#define signals_blocked false
+#define signals_blocked 0
 #endif
 static unsigned int signals_pending;
 static unsigned int signals_active = 0;
crypto/aegis128-neon-inner.c +0 -2
@@ -15,8 +15,6 @@
 
 #define AEGIS_BLOCK_SIZE	16
 
-#include <stddef.h>
-
 extern int aegis128_have_aes_insn;
 
 void *memcpy(void *dest, const void *src, size_t n);
drivers/net/wwan/iosm/iosm_ipc_imem.h +0 -1
@@ -7,7 +7,6 @@
 #define IOSM_IPC_IMEM_H
 
 #include <linux/skbuff.h>
-#include <stdbool.h>
 
 #include "iosm_ipc_mmio.h"
 #include "iosm_ipc_pcie.h"
drivers/pinctrl/aspeed/pinmux-aspeed.h +0 -1
@@ -5,7 +5,6 @@
 #define ASPEED_PINMUX_H
 
 #include <linux/regmap.h>
-#include <stdbool.h>
 
 /*
  * The ASPEED SoCs provide typically more than 200 pins for GPIO and other
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h +0 -2
@@ -16,8 +16,6 @@
 #ifndef __ISP_LOCAL_H_INCLUDED__
 #define __ISP_LOCAL_H_INCLUDED__
 
-#include <stdbool.h>
-
 #include "isp_global.h"
 
 #include <isp2400_support.h>

new file mode 100644

include/stdarg.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+typedef __builtin_va_list __gnuc_va_list;
+typedef __builtin_va_list va_list;
+#define va_start(v, l)	__builtin_va_start(v, l)
+#define va_end(v)	__builtin_va_end(v)
+#define va_arg(v, T)	__builtin_va_arg(v, T)
+#define va_copy(d, s)	__builtin_va_copy(d, s)
+#endif
sound/aoa/codecs/onyx.h +0 -1
@@ -6,7 +6,6 @@
  */
 #ifndef __SND_AOA_CODEC_ONYX_H
 #define __SND_AOA_CODEC_ONYX_H
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
sound/aoa/codecs/tas.c +0 -1
@@ -58,7 +58,6 @@
  *    and up to the hardware designer to not wire
  *    them up in some weird unusable way.
  */
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
#1 lore raw
Quoted 5 lines · Alexey Dobriyan

In theory, userspace headers can be under incompatible license.

Linux by virtue of being OS kernel is fully independent piece of code and should not require anything from userspace.

As far as I know,
<stdarg.h> was the only exception,
which was borrowed from the compiler.

I like this as long as:
- license is clear (please add SPDX tag to the new header)
- it works for both gcc and clang (I guess the answer is yes)

I think removing <stdbool.h> and <stddef.h> are non-controversial. Mayby, you can split it into 1/2.

include/stdarg.h

Quoted 31 lines

For this:

* ship minimal <stdarg.h>
2 types, 4 macros

* delete "-isystem"
This is what enables leakage.

* fixup compilation where necessary.

---

 Makefile                                                               |    2 +-
 arch/um/include/shared/irq_user.h                                      |    1 -
 arch/um/os-Linux/signal.c                                              |    2 +-
 crypto/aegis128-neon-inner.c                                           |    2 --
 drivers/net/wwan/iosm/iosm_ipc_imem.h                                  |    1 -
 drivers/pinctrl/aspeed/pinmux-aspeed.h                                 |    1 -
 drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h |    2 --
 include/stdarg.h                                                       |    9 +++++++++
 sound/aoa/codecs/onyx.h                                                |    1 -
 sound/aoa/codecs/tas.c                                                 |    1 -
 10 files changed, 11 insertions(+), 11 deletions(-)

new file mode 100644

include/stdarg.h new file +0 -0
@@ -0,0 +1,9 @@

This is a new file, so please add the SPDX tag.
What project did you copy the code from?

If gcc, is it GPL v3 (but not compatible for GPL v2) ? If clang, is it
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Or, can we license this small portion of code
as GPL v2?

include/stdarg.h line 3

Quoted 3 lines
include/stdarg.h new file +3 -0
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+typedef __builtin_va_list __gnuc_va_list;

Where is __gnuc_va_list needed?

BTW, once this is accepted, I'd like to
change all <stdarg.h> to <linux/stdarg.h>.

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw
Quoted 7 lines · Masahiro Yamada
Quoted 5 lines · Alexey Dobriyan

In theory, userspace headers can be under incompatible license.

Linux by virtue of being OS kernel is fully independent piece of code and should not require anything from userspace.

Quoted 8 lines

As far as I know,
<stdarg.h> was the only exception,
which was borrowed from the compiler.

I like this as long as:
- license is clear (please add SPDX tag to the new header)
- it works for both gcc and clang (I guess the answer is yes)

It should. clang version is essentially the same
(with less prehistoric macrology).

Quoted 42 lines

I think removing <stdbool.h> and <stddef.h> are non-controversial. Mayby, you can split it into 1/2.

include/stdarg.h

Quoted 31 lines

For this:

* ship minimal <stdarg.h>
2 types, 4 macros

* delete "-isystem"
This is what enables leakage.

* fixup compilation where necessary.

---

 Makefile                                                               |    2 +-
 arch/um/include/shared/irq_user.h                                      |    1 -
 arch/um/os-Linux/signal.c                                              |    2 +-
 crypto/aegis128-neon-inner.c                                           |    2 --
 drivers/net/wwan/iosm/iosm_ipc_imem.h                                  |    1 -
 drivers/pinctrl/aspeed/pinmux-aspeed.h                                 |    1 -
 drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h |    2 --
 include/stdarg.h                                                       |    9 +++++++++
 sound/aoa/codecs/onyx.h                                                |    1 -
 sound/aoa/codecs/tas.c                                                 |    1 -
 10 files changed, 11 insertions(+), 11 deletions(-)

new file mode 100644

include/stdarg.h new file +0 -0
@@ -0,0 +1,9 @@

This is a new file, so please add the SPDX tag.
What project did you copy the code from?

Quoted 1 line

If gcc, is it GPL v3 (but not compatible for GPL v2) ?

It is GPL 2, brought to you by Debian! I'll add a link.

	http://archive.debian.org/debian/pool/main/g/gcc-4.2/
Quoted 8 lines

If clang, is it
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Or, can we license this small portion of code
as GPL v2?

Quoted 8 lines

include/stdarg.h line 3

Quoted 3 lines
include/stdarg.h new file +3 -0
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+typedef __builtin_va_list __gnuc_va_list;

Where is __gnuc_va_list needed?

BTW, once this is accepted, I'd like to
change all <stdarg.h> to <linux/stdarg.h>.

Yes. I've just realised <stdarg.h> is the wrong place:

gcc -Wp,-MMD,scripts/selinux/genheaders/.genheaders.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/home/ad/linux/linux-1/include/uapi -I/home/ad/linux/linux-1/include -I/home/ad/linux/linux-1/security/selinux/include -I ./scripts/selinux/genheaders -o scripts/selinux/genheaders/genheaders /home/ad/linux/linux-1/scripts/selinux/genheaders/genheaders.c
In file included from /home/ad/linux/linux-1/scripts/selinux/genheaders/genheaders.c:6:
/usr/include/stdio.h:52:9: error: unknown type name ‘__gnuc_va_list’
52 | typedef __gnuc_va_list va_list;

Or maybe <stdarg.h> is the right place by passing all those include directories to userspace helpers is the wrong thing to do.

#3 lore raw
In reply to Alexey Dobriyan

arch/um/os-Linux/signal.c int signals_enabled; · line 70

Quoted 2 lines
arch/um/os-Linux/signal.c +1 -1
-#define signals_blocked false
+#define signals_blocked 0

Why can't we get at the kernel definition of false here?

include/stdarg.h line 9

Quoted 13 lines

new file mode 100644

include/stdarg.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+typedef __builtin_va_list __gnuc_va_list;
+typedef __builtin_va_list va_list;
+#define va_start(v, l)	__builtin_va_start(v, l)
+#define va_end(v)	__builtin_va_end(v)
+#define va_arg(v, T)	__builtin_va_arg(v, T)
+#define va_copy(d, s)	__builtin_va_copy(d, s)
+#endif

Empty lines before and after the include guards would be nice.

What do we need the __gnuc_va_list typedef for?

Otherwise this looks great. As a follow on maybe move the new header to <linux/stdarg.h> to make clear to everyone that we are using our own version.

#4 lore raw
Quoted 4 lines · Christoph Hellwig

arch/um/os-Linux/signal.c int signals_enabled; · line 70

Quoted 2 lines
arch/um/os-Linux/signal.c +1 -1
-#define signals_blocked false
+#define signals_blocked 0

Why can't we get at the kernel definition of false here?

Variable and other code surrounding this wants "int". I don't really want to expand into bool conversion.

Quoted 16 lines

include/stdarg.h line 9

Quoted 13 lines

new file mode 100644

include/stdarg.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+typedef __builtin_va_list __gnuc_va_list;
+typedef __builtin_va_list va_list;
+#define va_start(v, l)	__builtin_va_start(v, l)
+#define va_end(v)	__builtin_va_end(v)
+#define va_arg(v, T)	__builtin_va_arg(v, T)
+#define va_copy(d, s)	__builtin_va_copy(d, s)
+#endif

Empty lines before and after the include guards would be nice.

Quoted 1 line

What do we need the __gnuc_va_list typedef for?

That's because without __gnuc_va_list something didn't compile. I'm preparing second version with <linux/stdarg.h> where __gnuc_va_list is unnecessary indeed.

Quoted 3 lines

Otherwise this looks great. As a follow on maybe move the new header to <linux/stdarg.h> to make clear to everyone that we are using our own version.

#5 lore raw
Quoted 8 lines · Alexey Dobriyan
Quoted 4 lines · Christoph Hellwig

arch/um/os-Linux/signal.c int signals_enabled; · line 70

Quoted 2 lines
arch/um/os-Linux/signal.c +1 -1
-#define signals_blocked false
+#define signals_blocked 0

Why can't we get at the kernel definition of false here?

Variable and other code surrounding this wants "int". I don't really want to expand into bool conversion.

Maybe split this into a separate prep patch then.

#6 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 8 lines · Alexey Dobriyan
Quoted 4 lines · Christoph Hellwig

arch/um/os-Linux/signal.c int signals_enabled; · line 70

Quoted 2 lines
arch/um/os-Linux/signal.c +1 -1
-#define signals_blocked false
+#define signals_blocked 0

Why can't we get at the kernel definition of false here?

Variable and other code surrounding this wants "int". I don't really want to expand into bool conversion.

Maybe split this into a separate prep patch then.

And get accused of KPI padding? :-)

#7 lore raw

PATCH v2 1/1 Decouple build from userspace headers

In reply to Alexey Dobriyan

First, userspace headers can be under incompatible license.

Second, kernel doesn't require userspace to operate and should not require anything from userspace to be built other than compiler. We would use -ffreestanding too if not builtin function shenanigans.

To decouple:

* ship minimal stdarg.h as <linux/stdarg.h>,
1 type, 4 macros

GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

* delete "-isystem" from command line arguments,
this is what enables header leakage

* fixup/delete include directives where necessary.

---

 Makefile                                                                 |    2 -
 arch/arm/kernel/process.c                                                |    2 -
 arch/arm/mach-bcm/bcm_kona_smc.c                                         |    2 -
 arch/arm64/kernel/process.c                                              |    3 --
 arch/openrisc/kernel/process.c                                           |    2 -
 arch/parisc/kernel/firmware.c                                            |    2 -
 arch/parisc/kernel/process.c                                             |    3 --
 arch/powerpc/kernel/prom.c                                               |    1 
 arch/powerpc/kernel/prom_init.c                                          |    2 -
 arch/powerpc/kernel/rtas.c                                               |    2 -
 arch/powerpc/kernel/udbg.c                                               |    2 -
 arch/s390/boot/pgm_check_info.c                                          |    2 -
 arch/sparc/kernel/process_32.c                                           |    3 --
 arch/sparc/kernel/process_64.c                                           |    3 --
 arch/um/include/shared/irq_user.h                                        |    1 
 arch/um/include/shared/os.h                                              |    1 
 arch/um/os-Linux/signal.c                                                |    2 -
 arch/um/os-Linux/util.c                                                  |    1 
 arch/x86/boot/boot.h                                                     |    2 -
 crypto/aegis128-neon-inner.c                                             |    2 -
 drivers/block/xen-blkback/xenbus.c                                       |    1 
 drivers/firmware/efi/libstub/efi-stub-helper.c                           |    2 -
 drivers/firmware/efi/libstub/vsprintf.c                                  |    2 -
 drivers/gpu/drm/amd/display/dc/dc_helper.c                               |    2 -
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h                          |    1 
 drivers/gpu/drm/drm_print.c                                              |    2 -
 drivers/gpu/drm/msm/disp/msm_disp_snapshot.h                             |    1 
 drivers/isdn/capi/capiutil.c                                             |    2 -
 drivers/macintosh/macio-adb.c                                            |    1 
 drivers/macintosh/via-cuda.c                                             |    2 -
 drivers/macintosh/via-macii.c                                            |    2 -
 drivers/macintosh/via-pmu.c                                              |    2 -
 drivers/net/wireless/intersil/orinoco/hermes.c                           |    1 
 drivers/net/wwan/iosm/iosm_ipc_imem.h                                    |    1 
 drivers/pinctrl/aspeed/pinmux-aspeed.h                                   |    1 
 drivers/scsi/elx/efct/efct_driver.h                                      |    1 
 drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h   |    2 -
 drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h   |    2 -
 drivers/staging/media/atomisp/pci/ia_css_env.h                           |    2 -
 drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h |    2 -
 drivers/staging/media/atomisp/pci/sh_css_internal.h                      |    2 -
 drivers/xen/xen-scsiback.c                                               |    2 -
 fs/befs/debug.c                                                          |    2 -
 fs/reiserfs/prints.c                                                     |    2 -
 fs/ufs/super.c                                                           |    2 -
 include/acpi/platform/acgcc.h                                            |    2 -
 include/linux/filter.h                                                   |    2 -
 include/linux/kernel.h                                                   |    2 -
 include/linux/mISDNif.h                                                  |    1 
 include/linux/printk.h                                                   |    2 -
 include/linux/stdarg.h                                                   |   11 ++++++++++
 include/linux/string.h                                                   |    2 -
 kernel/debug/kdb/kdb_support.c                                           |    1 
 lib/debug_info.c                                                         |    3 --
 lib/kasprintf.c                                                          |    2 -
 lib/kunit/string-stream.h                                                |    2 -
 lib/vsprintf.c                                                           |    2 -
 mm/kfence/report.c                                                       |    2 -
 net/batman-adv/log.c                                                     |    2 -
 sound/aoa/codecs/onyx.h                                                  |    1 
 sound/aoa/codecs/tas.c                                                   |    1 
 sound/core/info.c                                                        |    1 
 62 files changed, 44 insertions(+), 77 deletions(-)
Makefile +1 -1
@@ -978,7 +978,7 @@ KBUILD_CFLAGS += -falign-functions=64
 endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included
-NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+NOSTDINC_FLAGS += -nostdinc
 
 # warn about C99 declaration after statement
 KBUILD_CFLAGS += -Wdeclaration-after-statement
arch/arm/kernel/process.c +0 -2
@@ -5,8 +5,6 @@
  *  Copyright (C) 1996-2000 Russell King - Converted to ARM.
  *  Original Copyright (C) 1995  Linus Torvalds
  */
-#include <stdarg.h>
-
 #include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
arch/arm/mach-bcm/bcm_kona_smc.c +0 -2
@@ -10,8 +10,6 @@
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
-#include <stdarg.h>
 #include <linux/smp.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
arch/arm64/kernel/process.c +0 -3
@@ -6,9 +6,6 @@
  * Copyright (C) 1996-2000 Russell King - Converted to ARM.
  * Copyright (C) 2012 ARM Ltd.
  */
-
-#include <stdarg.h>
-
 #include <linux/compat.h>
 #include <linux/efi.h>
 #include <linux/elf.h>
arch/openrisc/kernel/process.c +0 -2
@@ -14,8 +14,6 @@
  */
 
 #define __KERNEL_SYSCALLS__
-#include <stdarg.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
arch/parisc/kernel/firmware.c +1 -1
@@ -51,7 +51,7 @@
  *					prumpf	991016	
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/delay.h>
 #include <linux/init.h>
arch/parisc/kernel/process.c +0 -3
@@ -17,9 +17,6 @@
  *    Copyright (C) 2001-2014 Helge Deller <[email protected]>
  *    Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
  */
-
-#include <stdarg.h>
-
 #include <linux/elf.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
arch/powerpc/kernel/prom.c +0 -1
@@ -11,7 +11,6 @@
 
 #undef DEBUG
 
-#include <stdarg.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/init.h>
arch/powerpc/kernel/prom_init.c +1 -1
@@ -14,7 +14,7 @@
 /* we cannot use FORTIFY as it brings in new symbols */
 #define __NO_FORTIFY
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/init.h>
arch/powerpc/kernel/rtas.c +1 -1
@@ -7,7 +7,7 @@
  * Copyright (C) 2001 IBM.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/spinlock.h>
arch/powerpc/kernel/udbg.c +1 -1
@@ -5,7 +5,7 @@
  * c 2001 PPC 64 Team, IBM Corp
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/console.h>
arch/s390/boot/pgm_check_info.c +1 -1
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <asm/stacktrace.h>
@@ -8,7 +9,6 @@
 #include <asm/setup.h>
 #include <asm/sclp.h>
 #include <asm/uv.h>
-#include <stdarg.h>
 #include "boot.h"
 
 const char hex_asc[] = "0123456789abcdef";
arch/sparc/kernel/process_32.c +0 -3
@@ -8,9 +8,6 @@
 /*
  * This file handles the architecture-dependent parts of process handling..
  */
-
-#include <stdarg.h>
-
 #include <linux/elfcore.h>
 #include <linux/errno.h>
 #include <linux/module.h>
arch/sparc/kernel/process_64.c +0 -3
@@ -9,9 +9,6 @@
 /*
  * This file handles the architecture-dependent parts of process handling..
  */
-
-#include <stdarg.h>
-
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/sched.h>
arch/um/include/shared/irq_user.h +0 -1
@@ -7,7 +7,6 @@
 #define __IRQ_USER_H__
 
 #include <sysdep/ptrace.h>
-#include <stdbool.h>
 
 enum um_irq_type {
 	IRQ_READ,
arch/um/include/shared/os.h +0 -1
@@ -8,7 +8,6 @@
 #ifndef __OS_H__
 #define __OS_H__
 
-#include <stdarg.h>
 #include <irq_user.h>
 #include <longjmp.h>
 #include <mm_id.h>
arch/um/os-Linux/signal.c +1 -1
@@ -67,7 +67,7 @@ int signals_enabled;
 #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
 static int signals_blocked;
 #else
-#define signals_blocked false
+#define signals_blocked 0
 #endif
 static unsigned int signals_pending;
 static unsigned int signals_active = 0;
arch/um/os-Linux/util.c +1 -0
@@ -3,6 +3,7 @@
  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  */
 
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
arch/x86/boot/boot.h +1 -1
@@ -18,7 +18,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/edd.h>
 #include <asm/setup.h>
crypto/aegis128-neon-inner.c +0 -2
@@ -15,8 +15,6 @@
 
 #define AEGIS_BLOCK_SIZE	16
 
-#include <stddef.h>
-
 extern int aegis128_have_aes_insn;
 
 void *memcpy(void *dest, const void *src, size_t n);
drivers/block/xen-blkback/xenbus.c +0 -1
@@ -8,7 +8,6 @@
 
 #define pr_fmt(fmt) "xen-blkback: " fmt
 
-#include <stdarg.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
 #include <xen/events.h>
drivers/firmware/efi/libstub/efi-stub-helper.c +1 -1
@@ -7,7 +7,7 @@
  * Copyright 2011 Intel Corporation; author Matt Fleming
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/ctype.h>
 #include <linux/efi.h>
drivers/firmware/efi/libstub/vsprintf.c +1 -1
@@ -10,7 +10,7 @@
  * Oh, it's a waste of space, but oh-so-yummy for debugging.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/compiler.h>
 #include <linux/ctype.h>
drivers/gpu/drm/amd/display/dc/dc_helper.c +1 -1
@@ -28,9 +28,9 @@
  */
 
 #include <linux/delay.h>
+#include <linux/stdarg.h>
 
 #include "dm_services.h"
-#include <stdarg.h>
 
 #include "dc.h"
 #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +0 -1
@@ -39,7 +39,6 @@
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <stdarg.h>
 
 #include "atomfirmware.h"
 
drivers/gpu/drm/drm_print.c +1 -1
@@ -25,7 +25,7 @@
 
 #define DEBUG /* for pr_debug() */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/io.h>
 #include <linux/moduleparam.h>
drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +0 -1
@@ -25,7 +25,6 @@
 #include <linux/pm_runtime.h>
 #include <linux/kthread.h>
 #include <linux/devcoredump.h>
-#include <stdarg.h>
 #include "msm_kms.h"
 
 #define MSM_DISP_SNAPSHOT_MAX_BLKS		10
drivers/isdn/capi/capiutil.c +1 -1
@@ -379,7 +379,7 @@ static char *pnames[] =
 	/*2f */ "Useruserdata"
 };
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 /*-------------------------------------------------------*/
 static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
drivers/macintosh/macio-adb.c +0 -1
@@ -2,7 +2,6 @@
 /*
  * Driver for the ADB controller in the Mac I/O (Hydra) chip.
  */
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-cuda.c +1 -1
@@ -9,7 +9,7 @@
  *
  * Copyright (C) 1996 Paul Mackerras.
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-macii.c +0 -2
@@ -23,8 +23,6 @@
  * Apple's "ADB Analyzer" bus sniffer is invaluable:
  *   ftp://ftp.apple.com/developer/Tool_Chest/Devices_-_Hardware/Apple_Desktop_Bus/
  */
-
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-pmu.c +1 -1
@@ -18,7 +18,7 @@
  *    a sleep or a freq. switch
  *
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/errno.h>
drivers/net/wireless/intersil/orinoco/hermes.c +0 -1
@@ -79,7 +79,6 @@
 
 #undef HERMES_DEBUG
 #ifdef HERMES_DEBUG
-#include <stdarg.h>
 
 #define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff)
 
drivers/net/wwan/iosm/iosm_ipc_imem.h +0 -1
@@ -7,7 +7,6 @@
 #define IOSM_IPC_IMEM_H
 
 #include <linux/skbuff.h>
-#include <stdbool.h>
 
 #include "iosm_ipc_mmio.h"
 #include "iosm_ipc_pcie.h"
drivers/pinctrl/aspeed/pinmux-aspeed.h +0 -1
@@ -5,7 +5,6 @@
 #define ASPEED_PINMUX_H
 
 #include <linux/regmap.h>
-#include <stdbool.h>
 
 /*
  * The ASPEED SoCs provide typically more than 200 pins for GPIO and other
drivers/scsi/elx/efct/efct_driver.h +0 -1
@@ -10,7 +10,6 @@
 /***************************************************************************
  * OS specific includes
  */
-#include <stdarg.h>
 #include <linux/module.h>
 #include <linux/debugfs.h>
 #include <linux/firmware.h>
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h +0 -2
@@ -16,8 +16,6 @@
 #ifndef __ISP_LOCAL_H_INCLUDED__
 #define __ISP_LOCAL_H_INCLUDED__
 
-#include <stdbool.h>
-
 #include "isp_global.h"
 
 #include <isp2400_support.h>
drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h +1 -1
@@ -16,7 +16,7 @@
 #ifndef __PRINT_SUPPORT_H_INCLUDED__
 #define __PRINT_SUPPORT_H_INCLUDED__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 extern int (*sh_css_printf)(const char *fmt, va_list args);
 /* depends on host supplied print function in ia_css_init() */
drivers/staging/media/atomisp/pci/ia_css_env.h +1 -1
@@ -17,7 +17,7 @@
 #define __IA_CSS_ENV_H
 
 #include <type_support.h>
-#include <stdarg.h> /* va_list */
+#include <linux/stdarg.h> /* va_list */
 #include "ia_css_types.h"
 #include "ia_css_acc_types.h"
 
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +1 -1
@@ -19,7 +19,7 @@
 /*! \file */
 
 #include <type_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include "ia_css_types.h"
 #include "ia_css_binary.h"
 #include "ia_css_frame_public.h"
drivers/staging/media/atomisp/pci/sh_css_internal.h +1 -1
@@ -20,7 +20,7 @@
 #include <math_support.h>
 #include <type_support.h>
 #include <platform_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #if !defined(ISP2401)
 #include "input_formatter.h"
drivers/xen/xen-scsiback.c +0 -2
@@ -33,8 +33,6 @@
 
 #define pr_fmt(fmt) "xen-pvscsi: " fmt
 
-#include <stdarg.h>
-
 #include <linux/module.h>
 #include <linux/utsname.h>
 #include <linux/interrupt.h>
fs/befs/debug.c +1 -1
@@ -14,7 +14,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #ifdef __KERNEL__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/kernel.h>
fs/reiserfs/prints.c +1 -1
@@ -8,7 +8,7 @@
 #include <linux/string.h>
 #include <linux/buffer_head.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 static char error_buf[1024];
 static char fmt_buf[1024];
fs/ufs/super.c +1 -1
@@ -70,7 +70,7 @@
 #include <linux/module.h>
 #include <linux/bitops.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/uaccess.h>
 
include/acpi/platform/acgcc.h +1 -1
@@ -22,7 +22,7 @@ typedef __builtin_va_list va_list;
 #define va_arg(v, l)            __builtin_va_arg(v, l)
 #define va_copy(d, s)           __builtin_va_copy(d, s)
 #else
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #endif
 #endif
 
include/linux/filter.h +0 -2
@@ -5,8 +5,6 @@
 #ifndef __LINUX_FILTER_H__
 #define __LINUX_FILTER_H__
 
-#include <stdarg.h>
-
 #include <linux/atomic.h>
 #include <linux/refcount.h>
 #include <linux/compat.h>
include/linux/kernel.h +1 -1
@@ -2,7 +2,7 @@
 #ifndef _LINUX_KERNEL_H
 #define _LINUX_KERNEL_H
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/align.h>
 #include <linux/limits.h>
 #include <linux/linkage.h>
include/linux/mISDNif.h +0 -1
@@ -18,7 +18,6 @@
 #ifndef mISDNIF_H
 #define mISDNIF_H
 
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
include/linux/printk.h +1 -1
@@ -2,7 +2,7 @@
 #ifndef __KERNEL_PRINTK__
 #define __KERNEL_PRINTK__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>

new file mode 100644

include/linux/stdarg.h new file +11 -0
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+
+typedef __builtin_va_list va_list;
+#define va_start(v, l)	__builtin_va_start(v, l)
+#define va_end(v)	__builtin_va_end(v)
+#define va_arg(v, T)	__builtin_va_arg(v, T)
+#define va_copy(d, s)	__builtin_va_copy(d, s)
+
+#endif
include/linux/string.h +1 -1
@@ -6,7 +6,7 @@
 #include <linux/types.h>	/* for size_t */
 #include <linux/stddef.h>	/* for NULL */
 #include <linux/errno.h>	/* for E2BIG */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <uapi/linux/string.h>
 
 extern char *strndup_user(const char __user *, long);
kernel/debug/kdb/kdb_support.c +0 -1
@@ -10,7 +10,6 @@
  * 03/02/13    added new 2.5 kallsyms <[email protected]>
  */
 
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
lib/debug_info.c +1 -2
@@ -5,8 +5,6 @@
  * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However,
  * adding appropriate #includes is fine.
  */
-#include <stdarg.h>
-
 #include <linux/cred.h>
 #include <linux/crypto.h>
 #include <linux/dcache.h>
@@ -22,6 +20,7 @@
 #include <linux/net.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <net/addrconf.h>
 #include <net/sock.h>
lib/kasprintf.c +1 -1
@@ -5,7 +5,7 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/types.h>
lib/kunit/string-stream.h +1 -1
@@ -11,7 +11,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 struct string_stream_fragment {
 	struct kunit *test;
lib/vsprintf.c +1 -1
@@ -17,7 +17,7 @@
  * - scnprintf and vscnprintf
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/build_bug.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
mm/kfence/report.c +1 -1
@@ -5,7 +5,7 @@
  * Copyright (C) 2020, Google LLC.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/kernel.h>
 #include <linux/lockdep.h>
net/batman-adv/log.c +1 -1
@@ -7,7 +7,7 @@
 #include "log.h"
 #include "main.h"
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include "trace.h"
 
sound/aoa/codecs/onyx.h +0 -1
@@ -6,7 +6,6 @@
  */
 #ifndef __SND_AOA_CODEC_ONYX_H
 #define __SND_AOA_CODEC_ONYX_H
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
sound/aoa/codecs/tas.c +0 -1
@@ -58,7 +58,6 @@
  *    and up to the hardware designer to not wire
  *    them up in some weird unusable way.
  */
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
sound/core/info.c +0 -1
@@ -16,7 +16,6 @@
 #include <linux/utsname.h>
 #include <linux/proc_fs.h>
 #include <linux/mutex.h>
-#include <stdarg.h>
 
 int snd_info_check_reserved_words(const char *str)
 {
#8 lore raw

PATCH 1/1 fixup "Decouple build from userspace headers"

Allow to find SIMD headers where necessary.

---

fold into decouple-build-from-userspace-headers.patch

 arch/arm64/lib/Makefile   |    2 +-
 arch/powerpc/lib/Makefile |    2 +-
 lib/raid6/Makefile        |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/lib/Makefile +1 -1
@@ -8,7 +8,7 @@ lib-y		:= clear_user.o delay.o copy_from_user.o		\
 ifeq ($(CONFIG_KERNEL_MODE_NEON), y)
 obj-$(CONFIG_XOR_BLOCKS)	+= xor-neon.o
 CFLAGS_REMOVE_xor-neon.o	+= -mgeneral-regs-only
-CFLAGS_xor-neon.o		+= -ffreestanding
+CFLAGS_xor-neon.o		+= -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 endif
 
 lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
arch/powerpc/lib/Makefile +1 -1
@@ -64,6 +64,6 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
 obj-$(CONFIG_ALTIVEC)	+= xor_vmx.o xor_vmx_glue.o
-CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
+CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 obj-$(CONFIG_PPC64) += $(obj64-y)
lib/raid6/Makefile +2 -2
@@ -13,7 +13,7 @@ raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
 hostprogs	+= mktables
 
 ifeq ($(CONFIG_ALTIVEC),y)
-altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
+altivec_flags := -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 ifdef CONFIG_CC_IS_CLANG
 # clang ppc port does not yet support -maltivec when -msoft-float is
@@ -33,7 +33,7 @@ endif
 # The GCC option -ffreestanding is required in order to compile code containing
 # ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
 ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
-NEON_FLAGS := -ffreestanding
+NEON_FLAGS := -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 ifeq ($(ARCH),arm)
 NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
 endif
#9 lore raw

Re: [PATCH -mm] fixup "Decouple build from userspace headers"

Quoted 5 lines · Alexey Dobriyan

Allow to find SIMD headers where necessary.

Quoted 8 lines

---

fold into decouple-build-from-userspace-headers.patch

 arch/arm64/lib/Makefile   |    2 +-
 arch/powerpc/lib/Makefile |    2 +-
 lib/raid6/Makefile        |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

OK. Perhaps, we can import <arm_neon.h> and <altivec.h> into the kernel tree as we did for <stdarg.h>,
then remove "-isystem $(shell $(CC) -print-file-name=include)" entirely, but I did not look into it.

If we can avoid the arm_neon.h mess,
we can clean up arch/arm/include/uapi/asm/types.h as well. It is a possible future work.

Anyway, could you add some comments?
(see blew)

arch/arm64/lib/Makefile lib-y := clear_user.o delay.o copy_from_user.o \ · line 11

Quoted 7 lines
arch/arm64/lib/Makefile +0 -1
@@ -8,7 +8,7 @@ lib-y           := clear_user.o delay.o copy_from_user.o                \
 ifeq ($(CONFIG_KERNEL_MODE_NEON), y)
 obj-$(CONFIG_XOR_BLOCKS)       += xor-neon.o
 CFLAGS_REMOVE_xor-neon.o       += -mgeneral-regs-only
-CFLAGS_xor-neon.o              += -ffreestanding

Can you add comment, # for <arm_neon.h>

arch/powerpc/lib/Makefile obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o · line 67

Quoted 11 lines
arch/arm64/lib/Makefile +1 -0
+CFLAGS_xor-neon.o              += -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 endif
 
 lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
arch/powerpc/lib/Makefile +0 -1
@@ -64,6 +64,6 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
 obj-$(CONFIG_ALTIVEC)  += xor_vmx.o xor_vmx_glue.o
-CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)

Can you add comment, # for <altivec.h>

lib/raid6/Makefile raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o · line 16

Quoted 10 lines
arch/powerpc/lib/Makefile +1 -0
+CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 obj-$(CONFIG_PPC64) += $(obj64-y)
lib/raid6/Makefile +0 -1
@@ -13,7 +13,7 @@ raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
 hostprogs      += mktables
 
 ifeq ($(CONFIG_ALTIVEC),y)
-altivec_flags := -maltivec $(call cc-option,-mabi=altivec)

Can you add comment, # for <altivec.h>

lib/raid6/Makefile endif · line 36

Quoted 9 lines
lib/raid6/Makefile +1 -1
+altivec_flags := -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 ifdef CONFIG_CC_IS_CLANG
 # clang ppc port does not yet support -maltivec when -msoft-float is
@@ -33,7 +33,7 @@ endif
 # The GCC option -ffreestanding is required in order to compile code containing
 # ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
 ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
-NEON_FLAGS := -ffreestanding

Can you add comment, # for <arm_neon.h>

Quoted 4 lines
lib/raid6/Makefile +1 -0
+NEON_FLAGS := -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 ifeq ($(ARCH),arm)
 NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
 endif
Signature · 2 lines
Best Regards
Masahiro Yamada
#10 lore raw

Re: [PATCH -mm] fixup "Decouple build from userspace headers"

Quoted 9 lines · Masahiro Yamada
Quoted 7 lines · Alexey Dobriyan

Allow to find SIMD headers where necessary.

---

Quoted 5 lines
Quoted 5 lines

fold into decouple-build-from-userspace-headers.patch

 arch/arm64/lib/Makefile   |    2 +-
 arch/powerpc/lib/Makefile |    2 +-
 lib/raid6/Makefile        |    4 ++--

I did not compile-test it yet, but
I see more <arm_neon.h> inclusion.

crypto/aegis128-neon-inner.c:

#ifdef CONFIG_ARM64
#include <asm/neon-intrinsics.h>

#define AES_ROUND "aese %0.16b, %1.16b \n\t aesmc %0.16b, %0.16b"
#else
#include <arm_neon.h>

#define AES_ROUND "aese.8 %q0, %q1 \n\t aesmc.8 %q0, %q0"
#endif

Can you test crypto/aegis128-neon-inner.c
with CONFIG_ARM64=n (i.e. CONFIG_ARM=y) ?

Quoted 77 lines
Quoted 1 line
 3 files changed, 4 insertions(+), 4 deletions(-)

OK. Perhaps, we can import <arm_neon.h> and <altivec.h> into the kernel tree as we did for <stdarg.h>,
then remove "-isystem $(shell $(CC) -print-file-name=include)" entirely, but I did not look into it.

If we can avoid the arm_neon.h mess,
we can clean up arch/arm/include/uapi/asm/types.h as well. It is a possible future work.

Anyway, could you add some comments?
(see blew)

arch/arm64/lib/Makefile lib-y := clear_user.o delay.o copy_from_user.o \ · line 11

Quoted 7 lines
arch/arm64/lib/Makefile +0 -1
@@ -8,7 +8,7 @@ lib-y           := clear_user.o delay.o copy_from_user.o                \
 ifeq ($(CONFIG_KERNEL_MODE_NEON), y)
 obj-$(CONFIG_XOR_BLOCKS)       += xor-neon.o
 CFLAGS_REMOVE_xor-neon.o       += -mgeneral-regs-only
-CFLAGS_xor-neon.o              += -ffreestanding

Can you add comment, # for <arm_neon.h>

arch/powerpc/lib/Makefile obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o · line 67

Quoted 11 lines
arch/arm64/lib/Makefile +1 -0
+CFLAGS_xor-neon.o              += -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 endif
 
 lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o
arch/powerpc/lib/Makefile +0 -1
@@ -64,6 +64,6 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
 obj-$(CONFIG_ALTIVEC)  += xor_vmx.o xor_vmx_glue.o
-CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)

Can you add comment, # for <altivec.h>

lib/raid6/Makefile raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o · line 16

Quoted 10 lines
arch/powerpc/lib/Makefile +1 -0
+CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 obj-$(CONFIG_PPC64) += $(obj64-y)
lib/raid6/Makefile +0 -1
@@ -13,7 +13,7 @@ raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
 hostprogs      += mktables
 
 ifeq ($(CONFIG_ALTIVEC),y)
-altivec_flags := -maltivec $(call cc-option,-mabi=altivec)

Can you add comment, # for <altivec.h>

lib/raid6/Makefile endif · line 36

Quoted 9 lines
lib/raid6/Makefile +1 -1
+altivec_flags := -maltivec $(call cc-option,-mabi=altivec) -isystem $(shell $(CC) -print-file-name=include)
 
 ifdef CONFIG_CC_IS_CLANG
 # clang ppc port does not yet support -maltivec when -msoft-float is
@@ -33,7 +33,7 @@ endif
 # The GCC option -ffreestanding is required in order to compile code containing
 # ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
 ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
-NEON_FLAGS := -ffreestanding

Can you add comment, # for <arm_neon.h>

lib/raid6/Makefile endif · line 39

Quoted 4 lines
lib/raid6/Makefile +1 -0
+NEON_FLAGS := -ffreestanding -isystem $(shell $(CC) -print-file-name=include)
 ifeq ($(ARCH),arm)
 NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
 endif

--
Best Regards
Masahiro Yamada

Signature · 2 lines
Best Regards
Masahiro Yamada
#11 lore raw
In reply to Alexey Dobriyan
Quoted 15 lines · Alexey Dobriyan

First, userspace headers can be under incompatible license.

Second, kernel doesn't require userspace to operate and should not require anything from userspace to be built other than compiler. We would use -ffreestanding too if not builtin function shenanigans.

To decouple:

* ship minimal stdarg.h as <linux/stdarg.h>,
1 type, 4 macros

GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

Quoted 6 lines

* delete "-isystem" from command line arguments,
this is what enables header leakage

* fixup/delete include directives where necessary.

This patch was included into todays next tag next-20210716 and when I build an arm64 allmodconfig
kernel I see the following error:

# to reproduce this build locally: tuxmake --target-arch=arm64
--kconfig=allmodconfig --toolchain=gcc-11 --wrapper=none
--environment=KBUILD_BUILD_TIMESTAMP=@1626414793
--environment=KBUILD_BUILD_USER=tuxmake
--environment=KBUILD_BUILD_HOST=tuxmake --runtime=podman
--image=docker.io/tuxmake/arm64_gcc-11
KCONFIG_ALLCONFIG=arch/arm64/configs/defconfig config default kernel
modules
make --silent --keep-going --jobs=32
O=/home/anders/.cache/tuxmake/builds/current
KCONFIG_ALLCONFIG=arch/arm64/configs/defconfig ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- allmodconfig
make --silent --keep-going --jobs=32
O=/home/anders/.cache/tuxmake/builds/current
KCONFIG_ALLCONFIG=arch/arm64/configs/defconfig ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
In file included from
/home/anders/src/kernel/testing/crypto/aegis128-neon-inner.c:7:
/home/anders/src/kernel/testing/arch/arm64/include/asm/neon-intrinsics.h:33:10:
fatal error: arm_neon.h: No such file or directory
   33 | #include <arm_neon.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [/home/anders/src/kernel/testing/scripts/Makefile.build:272:
crypto/aegis128-neon-inner.o] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [/home/anders/src/kernel/testing/Makefile:1990: crypto] Error 2
make[1]: Target '__all' not remade because of errors.
make: *** [Makefile:227: __sub-make] Error 2
make: Target '__all' not remade because of errors.

If I revert this patch I can build it.

Cheers,
Anders

Quoted 755 lines

---

 Makefile                                                                 |    2 -
 arch/arm/kernel/process.c                                                |    2 -
 arch/arm/mach-bcm/bcm_kona_smc.c                                         |    2 -
 arch/arm64/kernel/process.c                                              |    3 --
 arch/openrisc/kernel/process.c                                           |    2 -
 arch/parisc/kernel/firmware.c                                            |    2 -
 arch/parisc/kernel/process.c                                             |    3 --
 arch/powerpc/kernel/prom.c                                               |    1
 arch/powerpc/kernel/prom_init.c                                          |    2 -
 arch/powerpc/kernel/rtas.c                                               |    2 -
 arch/powerpc/kernel/udbg.c                                               |    2 -
 arch/s390/boot/pgm_check_info.c                                          |    2 -
 arch/sparc/kernel/process_32.c                                           |    3 --
 arch/sparc/kernel/process_64.c                                           |    3 --
 arch/um/include/shared/irq_user.h                                        |    1
 arch/um/include/shared/os.h                                              |    1
 arch/um/os-Linux/signal.c                                                |    2 -
 arch/um/os-Linux/util.c                                                  |    1
 arch/x86/boot/boot.h                                                     |    2 -
 crypto/aegis128-neon-inner.c                                             |    2 -
 drivers/block/xen-blkback/xenbus.c                                       |    1
 drivers/firmware/efi/libstub/efi-stub-helper.c                           |    2 -
 drivers/firmware/efi/libstub/vsprintf.c                                  |    2 -
 drivers/gpu/drm/amd/display/dc/dc_helper.c                               |    2 -
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h                          |    1
 drivers/gpu/drm/drm_print.c                                              |    2 -
 drivers/gpu/drm/msm/disp/msm_disp_snapshot.h                             |    1
 drivers/isdn/capi/capiutil.c                                             |    2 -
 drivers/macintosh/macio-adb.c                                            |    1
 drivers/macintosh/via-cuda.c                                             |    2 -
 drivers/macintosh/via-macii.c                                            |    2 -
 drivers/macintosh/via-pmu.c                                              |    2 -
 drivers/net/wireless/intersil/orinoco/hermes.c                           |    1
 drivers/net/wwan/iosm/iosm_ipc_imem.h                                    |    1
 drivers/pinctrl/aspeed/pinmux-aspeed.h                                   |    1
 drivers/scsi/elx/efct/efct_driver.h                                      |    1
 drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h   |    2 -
 drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h   |    2 -
 drivers/staging/media/atomisp/pci/ia_css_env.h                           |    2 -
 drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h |    2 -
 drivers/staging/media/atomisp/pci/sh_css_internal.h                      |    2 -
 drivers/xen/xen-scsiback.c                                               |    2 -
 fs/befs/debug.c                                                          |    2 -
 fs/reiserfs/prints.c                                                     |    2 -
 fs/ufs/super.c                                                           |    2 -
 include/acpi/platform/acgcc.h                                            |    2 -
 include/linux/filter.h                                                   |    2 -
 include/linux/kernel.h                                                   |    2 -
 include/linux/mISDNif.h                                                  |    1
 include/linux/printk.h                                                   |    2 -
 include/linux/stdarg.h                                                   |   11 ++++++++++
 include/linux/string.h                                                   |    2 -
 kernel/debug/kdb/kdb_support.c                                           |    1
 lib/debug_info.c                                                         |    3 --
 lib/kasprintf.c                                                          |    2 -
 lib/kunit/string-stream.h                                                |    2 -
 lib/vsprintf.c                                                           |    2 -
 mm/kfence/report.c                                                       |    2 -
 net/batman-adv/log.c                                                     |    2 -
 sound/aoa/codecs/onyx.h                                                  |    1
 sound/aoa/codecs/tas.c                                                   |    1
 sound/core/info.c                                                        |    1
 62 files changed, 44 insertions(+), 77 deletions(-)
Makefile +1 -1
@@ -978,7 +978,7 @@ KBUILD_CFLAGS += -falign-functions=64
 endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included
-NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+NOSTDINC_FLAGS += -nostdinc
 
 # warn about C99 declaration after statement
 KBUILD_CFLAGS += -Wdeclaration-after-statement
arch/arm/kernel/process.c +0 -2
@@ -5,8 +5,6 @@
  *  Copyright (C) 1996-2000 Russell King - Converted to ARM.
  *  Original Copyright (C) 1995  Linus Torvalds
  */
-#include <stdarg.h>
-
 #include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
arch/arm/mach-bcm/bcm_kona_smc.c +0 -2
@@ -10,8 +10,6 @@
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
-#include <stdarg.h>
 #include <linux/smp.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
arch/arm64/kernel/process.c +0 -3
@@ -6,9 +6,6 @@
  * Copyright (C) 1996-2000 Russell King - Converted to ARM.
  * Copyright (C) 2012 ARM Ltd.
  */
-
-#include <stdarg.h>
-
 #include <linux/compat.h>
 #include <linux/efi.h>
 #include <linux/elf.h>
arch/openrisc/kernel/process.c +0 -2
@@ -14,8 +14,6 @@
  */
 
 #define __KERNEL_SYSCALLS__
-#include <stdarg.h>
-
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
arch/parisc/kernel/firmware.c +1 -1
@@ -51,7 +51,7 @@
  *                                     prumpf  991016
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/delay.h>
 #include <linux/init.h>
arch/parisc/kernel/process.c +0 -3
@@ -17,9 +17,6 @@
  *    Copyright (C) 2001-2014 Helge Deller <[email protected]>
  *    Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
  */
-
-#include <stdarg.h>
-
 #include <linux/elf.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
arch/powerpc/kernel/prom.c +0 -1
@@ -11,7 +11,6 @@
 
 #undef DEBUG
 
-#include <stdarg.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/init.h>
arch/powerpc/kernel/prom_init.c +1 -1
@@ -14,7 +14,7 @@
 /* we cannot use FORTIFY as it brings in new symbols */
 #define __NO_FORTIFY
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/init.h>
arch/powerpc/kernel/rtas.c +1 -1
@@ -7,7 +7,7 @@
  * Copyright (C) 2001 IBM.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/spinlock.h>
arch/powerpc/kernel/udbg.c +1 -1
@@ -5,7 +5,7 @@
  * c 2001 PPC 64 Team, IBM Corp
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/console.h>
arch/s390/boot/pgm_check_info.c +1 -1
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <asm/stacktrace.h>
@@ -8,7 +9,6 @@
 #include <asm/setup.h>
 #include <asm/sclp.h>
 #include <asm/uv.h>
-#include <stdarg.h>
 #include "boot.h"
 
 const char hex_asc[] = "0123456789abcdef";
arch/sparc/kernel/process_32.c +0 -3
@@ -8,9 +8,6 @@
 /*
  * This file handles the architecture-dependent parts of process handling..
  */
-
-#include <stdarg.h>
-
 #include <linux/elfcore.h>
 #include <linux/errno.h>
 #include <linux/module.h>
arch/sparc/kernel/process_64.c +0 -3
@@ -9,9 +9,6 @@
 /*
  * This file handles the architecture-dependent parts of process handling..
  */
-
-#include <stdarg.h>
-
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/sched.h>
arch/um/include/shared/irq_user.h +0 -1
@@ -7,7 +7,6 @@
 #define __IRQ_USER_H__
 
 #include <sysdep/ptrace.h>
-#include <stdbool.h>
 
 enum um_irq_type {
        IRQ_READ,
arch/um/include/shared/os.h +0 -1
@@ -8,7 +8,6 @@
 #ifndef __OS_H__
 #define __OS_H__
 
-#include <stdarg.h>
 #include <irq_user.h>
 #include <longjmp.h>
 #include <mm_id.h>
arch/um/os-Linux/signal.c +1 -1
@@ -67,7 +67,7 @@ int signals_enabled;
 #ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
 static int signals_blocked;
 #else
-#define signals_blocked false
+#define signals_blocked 0
 #endif
 static unsigned int signals_pending;
 static unsigned int signals_active = 0;
arch/um/os-Linux/util.c +1 -0
@@ -3,6 +3,7 @@
  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  */
 
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
arch/x86/boot/boot.h +1 -1
@@ -18,7 +18,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/edd.h>
 #include <asm/setup.h>
crypto/aegis128-neon-inner.c +0 -2
@@ -15,8 +15,6 @@
 
 #define AEGIS_BLOCK_SIZE       16
 
-#include <stddef.h>
-
 extern int aegis128_have_aes_insn;
 
 void *memcpy(void *dest, const void *src, size_t n);
drivers/block/xen-blkback/xenbus.c +0 -1
@@ -8,7 +8,6 @@
 
 #define pr_fmt(fmt) "xen-blkback: " fmt
 
-#include <stdarg.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
 #include <xen/events.h>
drivers/firmware/efi/libstub/efi-stub-helper.c +1 -1
@@ -7,7 +7,7 @@
  * Copyright 2011 Intel Corporation; author Matt Fleming
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/ctype.h>
 #include <linux/efi.h>
drivers/firmware/efi/libstub/vsprintf.c +1 -1
@@ -10,7 +10,7 @@
  * Oh, it's a waste of space, but oh-so-yummy for debugging.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/compiler.h>
 #include <linux/ctype.h>
drivers/gpu/drm/amd/display/dc/dc_helper.c +1 -1
@@ -28,9 +28,9 @@
  */
 
 #include <linux/delay.h>
+#include <linux/stdarg.h>
 
 #include "dm_services.h"
-#include <stdarg.h>
 
 #include "dc.h"
 #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +0 -1
@@ -39,7 +39,6 @@
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/delay.h>
-#include <stdarg.h>
 
 #include "atomfirmware.h"
 
drivers/gpu/drm/drm_print.c +1 -1
@@ -25,7 +25,7 @@
 
 #define DEBUG /* for pr_debug() */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/io.h>
 #include <linux/moduleparam.h>
drivers/gpu/drm/msm/disp/msm_disp_snapshot.h +0 -1
@@ -25,7 +25,6 @@
 #include <linux/pm_runtime.h>
 #include <linux/kthread.h>
 #include <linux/devcoredump.h>
-#include <stdarg.h>
 #include "msm_kms.h"
 
 #define MSM_DISP_SNAPSHOT_MAX_BLKS             10
drivers/isdn/capi/capiutil.c +1 -1
@@ -379,7 +379,7 @@ static char *pnames[] =
        /*2f */ "Useruserdata"
 };
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 /*-------------------------------------------------------*/
 static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
drivers/macintosh/macio-adb.c +0 -1
@@ -2,7 +2,6 @@
 /*
  * Driver for the ADB controller in the Mac I/O (Hydra) chip.
  */
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-cuda.c +1 -1
@@ -9,7 +9,7 @@
  *
  * Copyright (C) 1996 Paul Mackerras.
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-macii.c +0 -2
@@ -23,8 +23,6 @@
  * Apple's "ADB Analyzer" bus sniffer is invaluable:
  *   ftp://ftp.apple.com/developer/Tool_Chest/Devices_-_Hardware/Apple_Desktop_Bus/
  */
-
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
drivers/macintosh/via-pmu.c +1 -1
@@ -18,7 +18,7 @@
  *    a sleep or a freq. switch
  *
  */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/errno.h>
drivers/net/wireless/intersil/orinoco/hermes.c +0 -1
@@ -79,7 +79,6 @@
 
 #undef HERMES_DEBUG
 #ifdef HERMES_DEBUG
-#include <stdarg.h>
 
 #define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff)
 
drivers/net/wwan/iosm/iosm_ipc_imem.h +0 -1
@@ -7,7 +7,6 @@
 #define IOSM_IPC_IMEM_H
 
 #include <linux/skbuff.h>
-#include <stdbool.h>
 
 #include "iosm_ipc_mmio.h"
 #include "iosm_ipc_pcie.h"
drivers/pinctrl/aspeed/pinmux-aspeed.h +0 -1
@@ -5,7 +5,6 @@
 #define ASPEED_PINMUX_H
 
 #include <linux/regmap.h>
-#include <stdbool.h>
 
 /*
  * The ASPEED SoCs provide typically more than 200 pins for GPIO and other
drivers/scsi/elx/efct/efct_driver.h +0 -1
@@ -10,7 +10,6 @@
 /***************************************************************************
  * OS specific includes
  */
-#include <stdarg.h>
 #include <linux/module.h>
 #include <linux/debugfs.h>
 #include <linux/firmware.h>
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h +0 -2
@@ -16,8 +16,6 @@
 #ifndef __ISP_LOCAL_H_INCLUDED__
 #define __ISP_LOCAL_H_INCLUDED__
 
-#include <stdbool.h>
-
 #include "isp_global.h"
 
 #include <isp2400_support.h>
drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h +1 -1
@@ -16,7 +16,7 @@
 #ifndef __PRINT_SUPPORT_H_INCLUDED__
 #define __PRINT_SUPPORT_H_INCLUDED__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 extern int (*sh_css_printf)(const char *fmt, va_list args);
 /* depends on host supplied print function in ia_css_init() */
drivers/staging/media/atomisp/pci/ia_css_env.h +1 -1
@@ -17,7 +17,7 @@
 #define __IA_CSS_ENV_H
 
 #include <type_support.h>
-#include <stdarg.h> /* va_list */
+#include <linux/stdarg.h> /* va_list */
 #include "ia_css_types.h"
 #include "ia_css_acc_types.h"
 
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +1 -1
@@ -19,7 +19,7 @@
 /*! \file */
 
 #include <type_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include "ia_css_types.h"
 #include "ia_css_binary.h"
 #include "ia_css_frame_public.h"
drivers/staging/media/atomisp/pci/sh_css_internal.h +1 -1
@@ -20,7 +20,7 @@
 #include <math_support.h>
 #include <type_support.h>
 #include <platform_support.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #if !defined(ISP2401)
 #include "input_formatter.h"
drivers/xen/xen-scsiback.c +0 -2
@@ -33,8 +33,6 @@
 
 #define pr_fmt(fmt) "xen-pvscsi: " fmt
 
-#include <stdarg.h>
-
 #include <linux/module.h>
 #include <linux/utsname.h>
 #include <linux/interrupt.h>
fs/befs/debug.c +1 -1
@@ -14,7 +14,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #ifdef __KERNEL__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/kernel.h>
fs/reiserfs/prints.c +1 -1
@@ -8,7 +8,7 @@
 #include <linux/string.h>
 #include <linux/buffer_head.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 static char error_buf[1024];
 static char fmt_buf[1024];
fs/ufs/super.c +1 -1
@@ -70,7 +70,7 @@
 #include <linux/module.h>
 #include <linux/bitops.h>
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/uaccess.h>
 
include/acpi/platform/acgcc.h +1 -1
@@ -22,7 +22,7 @@ typedef __builtin_va_list va_list;
 #define va_arg(v, l)            __builtin_va_arg(v, l)
 #define va_copy(d, s)           __builtin_va_copy(d, s)
 #else
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #endif
 #endif
 
include/linux/filter.h +0 -2
@@ -5,8 +5,6 @@
 #ifndef __LINUX_FILTER_H__
 #define __LINUX_FILTER_H__
 
-#include <stdarg.h>
-
 #include <linux/atomic.h>
 #include <linux/refcount.h>
 #include <linux/compat.h>
include/linux/kernel.h +1 -1
@@ -2,7 +2,7 @@
 #ifndef _LINUX_KERNEL_H
 #define _LINUX_KERNEL_H
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/align.h>
 #include <linux/limits.h>
 #include <linux/linkage.h>
include/linux/mISDNif.h +0 -1
@@ -18,7 +18,6 @@
 #ifndef mISDNIF_H
 #define mISDNIF_H
 
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
include/linux/printk.h +1 -1
@@ -2,7 +2,7 @@
 #ifndef __KERNEL_PRINTK__
 #define __KERNEL_PRINTK__
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>

new file mode 100644

include/linux/stdarg.h new file +11 -0
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef _LINUX_STDARG_H
+#define _LINUX_STDARG_H
+
+typedef __builtin_va_list va_list;
+#define va_start(v, l) __builtin_va_start(v, l)
+#define va_end(v)      __builtin_va_end(v)
+#define va_arg(v, T)   __builtin_va_arg(v, T)
+#define va_copy(d, s)  __builtin_va_copy(d, s)
+
+#endif
include/linux/string.h +1 -1
@@ -6,7 +6,7 @@
 #include <linux/types.h>       /* for size_t */
 #include <linux/stddef.h>      /* for NULL */
 #include <linux/errno.h>       /* for E2BIG */
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <uapi/linux/string.h>
 
 extern char *strndup_user(const char __user *, long);
kernel/debug/kdb/kdb_support.c +0 -1
@@ -10,7 +10,6 @@
  * 03/02/13    added new 2.5 kallsyms <[email protected]>
  */
 
-#include <stdarg.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
lib/debug_info.c +1 -2
@@ -5,8 +5,6 @@
  * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However,
  * adding appropriate #includes is fine.
  */
-#include <stdarg.h>
-
 #include <linux/cred.h>
 #include <linux/crypto.h>
 #include <linux/dcache.h>
@@ -22,6 +20,7 @@
 #include <linux/net.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/stdarg.h>
 #include <linux/types.h>
 #include <net/addrconf.h>
 #include <net/sock.h>
lib/kasprintf.c +1 -1
@@ -5,7 +5,7 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/types.h>
lib/kunit/string-stream.h +1 -1
@@ -11,7 +11,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 struct string_stream_fragment {
        struct kunit *test;
lib/vsprintf.c +1 -1
@@ -17,7 +17,7 @@
  * - scnprintf and vscnprintf
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 #include <linux/build_bug.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
mm/kfence/report.c +1 -1
@@ -5,7 +5,7 @@
  * Copyright (C) 2020, Google LLC.
  */
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include <linux/kernel.h>
 #include <linux/lockdep.h>
net/batman-adv/log.c +1 -1
@@ -7,7 +7,7 @@
 #include "log.h"
 #include "main.h"
 
-#include <stdarg.h>
+#include <linux/stdarg.h>
 
 #include "trace.h"
 
sound/aoa/codecs/onyx.h +0 -1
@@ -6,7 +6,6 @@
  */
 #ifndef __SND_AOA_CODEC_ONYX_H
 #define __SND_AOA_CODEC_ONYX_H
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
sound/aoa/codecs/tas.c +0 -1
@@ -58,7 +58,6 @@
  *    and up to the hardware designer to not wire
  *    them up in some weird unusable way.
  */
-#include <stddef.h>
 #include <linux/i2c.h>
 #include <asm/pmac_low_i2c.h>
 #include <asm/prom.h>
sound/core/info.c +0 -1
@@ -16,7 +16,6 @@
 #include <linux/utsname.h>
 #include <linux/proc_fs.h>
 #include <linux/mutex.h>
-#include <stdarg.h>
 
 int snd_info_check_reserved_words(const char *str)
 {
#12 lore raw
Quoted 11 lines · Anders Roxell
Quoted 1 line · Alexey Dobriyan

In file included from /home/anders/src/kernel/testing/crypto/aegis128-neon-inner.c:7:
/home/anders/src/kernel/testing/arch/arm64/include/asm/neon-intrinsics.h:33:10:
fatal error: arm_neon.h: No such file or directory
33 | #include <arm_neon.h>

      |          ^~~~~~~~~~~~

If I revert this patch I can build it.

Please, see followup fixes or grab new -mm.
https://lore.kernel.org/lkml/[email protected]/

#13 lore raw
Quoted 12 lines · Alexey Dobriyan
Quoted 9 lines · Anders Roxell
Quoted 1 line · Alexey Dobriyan

In file included from /home/anders/src/kernel/testing/crypto/aegis128-neon-inner.c:7:
/home/anders/src/kernel/testing/arch/arm64/include/asm/neon-intrinsics.h:33:10:
fatal error: arm_neon.h: No such file or directory
33 | #include <arm_neon.h>

      |          ^~~~~~~~~~~~
Quoted 4 lines
Quoted 1 line

If I revert this patch I can build it.

Please, see followup fixes or grab new -mm.
https://lore.kernel.org/lkml/[email protected]/

I tried to apply that patch but I got the same build error.

Cheers,
Anders

#14 lore raw
In reply to Alexey Dobriyan
Quoted 12 lines · Alexey Dobriyan
Quoted 9 lines · Anders Roxell
Quoted 1 line · Alexey Dobriyan

In file included from /home/anders/src/kernel/testing/crypto/aegis128-neon-inner.c:7:
/home/anders/src/kernel/testing/arch/arm64/include/asm/neon-intrinsics.h:33:10:
fatal error: arm_neon.h: No such file or directory
33 | #include <arm_neon.h>

      |          ^~~~~~~~~~~~
Quoted 4 lines
Quoted 1 line

If I revert this patch I can build it.

Please, see followup fixes or grab new -mm.
https://lore.kernel.org/lkml/[email protected]/

With the follow-up fix,
this patch is doing many things in a single patch.

Can you split it into a series of smaller patches?

1/4: changes for arch/um/include/shared/irq_user.h
and arch/um/os-Linux/signal.c

2/4: remove wrong <stdbool.h> or <stddef.h> inclusions
(or maybe you need to replace them with <linux/types.h> to keep the affected headers self-contained)

3/4: add include/linux/stdarg.h,
then <stdarg.h> with <linux/stdarg.h>

4/4: move -isystem $(shell $(CC) -print-file-name=include)
to some sub-Makefiles from the top Makefile.

(please note 4/4 will introduce a breakage in linux-next if somebody adds a new <stdarg.h> inclusion in this development cycle.
I hope that will not happen, though)

--
Best Regards
Masahiro Yamada

#15 lore raw
Quoted 46 lines · Masahiro Yamada
Quoted 12 lines · Alexey Dobriyan
Quoted 9 lines · Anders Roxell
Quoted 1 line · Alexey Dobriyan

In file included from /home/anders/src/kernel/testing/crypto/aegis128-neon-inner.c:7:
/home/anders/src/kernel/testing/arch/arm64/include/asm/neon-intrinsics.h:33:10:
fatal error: arm_neon.h: No such file or directory
33 | #include <arm_neon.h>

      |          ^~~~~~~~~~~~
Quoted 4 lines
Quoted 1 line

If I revert this patch I can build it.

Please, see followup fixes or grab new -mm.
https://lore.kernel.org/lkml/[email protected]/

With the follow-up fix,
this patch is doing many things in a single patch.

Can you split it into a series of smaller patches?

1/4: changes for arch/um/include/shared/irq_user.h
and arch/um/os-Linux/signal.c

2/4: remove wrong <stdbool.h> or <stddef.h> inclusions
(or maybe you need to replace them with <linux/types.h> to keep the affected headers self-contained)

3/4: add include/linux/stdarg.h,
then <stdarg.h> with <linux/stdarg.h>

4/4: move -isystem $(shell $(CC) -print-file-name=include)
to some sub-Makefiles from the top Makefile.

Quoted 5 lines

(please note 4/4 will introduce a breakage in linux-next if somebody adds a new <stdarg.h> inclusion in this development cycle.
I hope that will not happen, though)

Would it be possible to drop this patch for now from next since it breaks build daily?

Cheers,
Anders