linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, arnd@arndb.de
Subject: [PATCH] Decouple build from userspace headers
Date: Tue, 13 Jul 2021 22:47:18 +0300	[thread overview]
Message-ID: <YO3txvw87MjKfdpq@localhost.localdomain> (raw)

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.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 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(-)

--- a/Makefile
+++ b/Makefile
@@ -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
--- a/arch/um/include/shared/irq_user.h
+++ b/arch/um/include/shared/irq_user.h
@@ -7,7 +7,6 @@
 #define __IRQ_USER_H__
 
 #include <sysdep/ptrace.h>
-#include <stdbool.h>
 
 enum um_irq_type {
 	IRQ_READ,
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -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;
--- a/crypto/aegis128-neon-inner.c
+++ b/crypto/aegis128-neon-inner.c
@@ -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);
--- a/drivers/net/wwan/iosm/iosm_ipc_imem.h
+++ b/drivers/net/wwan/iosm/iosm_ipc_imem.h
@@ -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"
--- a/drivers/pinctrl/aspeed/pinmux-aspeed.h
+++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h
@@ -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
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h
@@ -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
--- /dev/null
+++ b/include/stdarg.h
@@ -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
--- a/sound/aoa/codecs/onyx.h
+++ b/sound/aoa/codecs/onyx.h
@@ -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>
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -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>

             reply	other threads:[~2021-07-13 19:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 19:47 Alexey Dobriyan [this message]
2021-07-14  4:54 ` [PATCH] Decouple build from userspace headers Masahiro Yamada
2021-07-14  8:42   ` Alexey Dobriyan
2021-07-14 14:22 ` Christoph Hellwig
2021-07-14 15:54   ` Alexey Dobriyan
2021-07-14 15:56     ` Christoph Hellwig
2021-07-14 17:16       ` Alexey Dobriyan
2021-07-14 17:45 ` [PATCH v2] " Alexey Dobriyan
2021-07-15 21:15   ` [PATCH -mm] fixup "Decouple build from userspace headers" Alexey Dobriyan
2021-07-18 12:36     ` Masahiro Yamada
2021-07-18 13:05       ` Masahiro Yamada
2021-07-16  9:03   ` [PATCH v2] Decouple build from userspace headers Anders Roxell
2021-07-16 10:10     ` Alexey Dobriyan
2021-07-16 13:04       ` Anders Roxell
2021-07-18 13:11       ` Masahiro Yamada
2021-07-20 16:13         ` Anders Roxell

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=YO3txvw87MjKfdpq@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).