summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2022-05-13 10:59:50 +0200
committerArnd Bergmann <arnd@arndb.de>2022-05-13 10:59:50 +0200
commit678e9c3a9389e48507e8f832963ad4290405adbc (patch)
tree5754898221d1a07127214a7e0c96eb5a630662db
parent03a679a1a4ec8fbe44119a6d06eeabdf7944883d (diff)
parent31a088b664d6b0437faf00975b63b17e433aa916 (diff)
downloadlinux-stable-678e9c3a9389e48507e8f832963ad4290405adbc.tar.gz
linux-stable-678e9c3a9389e48507e8f832963ad4290405adbc.tar.bz2
linux-stable-678e9c3a9389e48507e8f832963ad4290405adbc.zip
Merge branch 'asm-generic-headers-cleanup' into asm-generic
A series from Masahiro Yamada to clean up the uapi headers, making sure they can actually be included from user space without additional dependencies on either kernel headers or specific libc versions. * asm-generic-headers-cleanup: sparc: add asm/stat.h to UAPI compile-test coverage powerpc: add asm/stat.h to UAPI compile-test coverage mips: add asm/stat.h to UAPI compile-test coverage riscv: add linux/bpf_perf_event.h to UAPI compile-test coverage kbuild: prevent exported headers from including <stdlib.h>, <stdbool.h> agpgart.h: do not include <stdlib.h> from exported header
-rw-r--r--arch/mips/include/uapi/asm/stat.h20
-rw-r--r--arch/powerpc/include/uapi/asm/stat.h10
-rw-r--r--arch/sparc/include/uapi/asm/stat.h12
-rw-r--r--include/uapi/linux/agpgart.h9
-rw-r--r--usr/dummy-include/stdbool.h7
-rw-r--r--usr/dummy-include/stdlib.h7
-rw-r--r--usr/include/Makefile12
7 files changed, 40 insertions, 37 deletions
diff --git a/arch/mips/include/uapi/asm/stat.h b/arch/mips/include/uapi/asm/stat.h
index 3d2a3b71845c..8a8bb78883a4 100644
--- a/arch/mips/include/uapi/asm/stat.h
+++ b/arch/mips/include/uapi/asm/stat.h
@@ -19,11 +19,11 @@
struct stat {
unsigned st_dev;
long st_pad1[3]; /* Reserved for network id */
- ino_t st_ino;
- mode_t st_mode;
+ __kernel_ino_t st_ino;
+ __kernel_mode_t st_mode;
__u32 st_nlink;
- uid_t st_uid;
- gid_t st_gid;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
unsigned st_rdev;
long st_pad2[2];
long st_size;
@@ -55,11 +55,11 @@ struct stat64 {
unsigned long long st_ino;
- mode_t st_mode;
+ __kernel_mode_t st_mode;
__u32 st_nlink;
- uid_t st_uid;
- gid_t st_gid;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
unsigned long st_rdev;
unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
@@ -96,11 +96,11 @@ struct stat {
unsigned long st_ino;
- mode_t st_mode;
+ __kernel_mode_t st_mode;
__u32 st_nlink;
- uid_t st_uid;
- gid_t st_gid;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
unsigned int st_rdev;
unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
diff --git a/arch/powerpc/include/uapi/asm/stat.h b/arch/powerpc/include/uapi/asm/stat.h
index 7871055e5e32..a28c9a1201fa 100644
--- a/arch/powerpc/include/uapi/asm/stat.h
+++ b/arch/powerpc/include/uapi/asm/stat.h
@@ -29,16 +29,16 @@ struct __old_kernel_stat {
struct stat {
unsigned long st_dev;
- ino_t st_ino;
+ __kernel_ino_t st_ino;
#ifdef __powerpc64__
unsigned long st_nlink;
- mode_t st_mode;
+ __kernel_mode_t st_mode;
#else
- mode_t st_mode;
+ __kernel_mode_t st_mode;
unsigned short st_nlink;
#endif
- uid_t st_uid;
- gid_t st_gid;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
unsigned long st_rdev;
long st_size;
unsigned long st_blksize;
diff --git a/arch/sparc/include/uapi/asm/stat.h b/arch/sparc/include/uapi/asm/stat.h
index 732c41720e24..e03d6f8ec301 100644
--- a/arch/sparc/include/uapi/asm/stat.h
+++ b/arch/sparc/include/uapi/asm/stat.h
@@ -8,11 +8,11 @@
/* 64 bit sparc */
struct stat {
unsigned int st_dev;
- ino_t st_ino;
- mode_t st_mode;
+ __kernel_ino_t st_ino;
+ __kernel_mode_t st_mode;
short st_nlink;
- uid_t st_uid;
- gid_t st_gid;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
unsigned int st_rdev;
long st_size;
long st_atime;
@@ -51,8 +51,8 @@ struct stat64 {
/* 32 bit sparc */
struct stat {
unsigned short st_dev;
- ino_t st_ino;
- mode_t st_mode;
+ __kernel_ino_t st_ino;
+ __kernel_mode_t st_mode;
short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
diff --git a/include/uapi/linux/agpgart.h b/include/uapi/linux/agpgart.h
index f5251045181a..9cc3448c0b5b 100644
--- a/include/uapi/linux/agpgart.h
+++ b/include/uapi/linux/agpgart.h
@@ -52,7 +52,6 @@
#ifndef __KERNEL__
#include <linux/types.h>
-#include <stdlib.h>
struct agp_version {
__u16 major;
@@ -64,10 +63,10 @@ typedef struct _agp_info {
__u32 bridge_id; /* bridge vendor/device */
__u32 agp_mode; /* mode info of bridge */
unsigned long aper_base;/* base of aperture */
- size_t aper_size; /* size of aperture */
- size_t pg_total; /* max pages (swap + system) */
- size_t pg_system; /* max pages (system) */
- size_t pg_used; /* current pages used */
+ __kernel_size_t aper_size; /* size of aperture */
+ __kernel_size_t pg_total; /* max pages (swap + system) */
+ __kernel_size_t pg_system; /* max pages (system) */
+ __kernel_size_t pg_used; /* current pages used */
} agp_info;
typedef struct _agp_setup {
diff --git a/usr/dummy-include/stdbool.h b/usr/dummy-include/stdbool.h
new file mode 100644
index 000000000000..54ff9e9c90ac
--- /dev/null
+++ b/usr/dummy-include/stdbool.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#error "Please do not include <stdbool.h> from exported headers"
+
+#endif /* _STDBOOL_H */
diff --git a/usr/dummy-include/stdlib.h b/usr/dummy-include/stdlib.h
new file mode 100644
index 000000000000..e8c21888e371
--- /dev/null
+++ b/usr/dummy-include/stdlib.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#error "Please do not include <stdlib.h> from exported headers"
+
+#endif /* _STDLIB_H */
diff --git a/usr/include/Makefile b/usr/include/Makefile
index fa9819e022b7..e2615b9b0402 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -15,7 +15,7 @@ UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
# USERCFLAGS might contain sysroot location for CC.
UAPI_CFLAGS += $(USERCFLAGS)
-override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
+override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I $(obj) -I $(srctree)/usr/dummy-include
# The following are excluded for now because they fail to build.
#
@@ -65,21 +65,11 @@ no-header-test += asm/sigcontext.h
no-header-test += linux/if_bonding.h
endif
-ifeq ($(SRCARCH),mips)
-no-header-test += asm/stat.h
-endif
-
ifeq ($(SRCARCH),powerpc)
-no-header-test += asm/stat.h
-no-header-test += linux/bpf_perf_event.h
-endif
-
-ifeq ($(SRCARCH),riscv)
no-header-test += linux/bpf_perf_event.h
endif
ifeq ($(SRCARCH),sparc)
-no-header-test += asm/stat.h
no-header-test += asm/uctx.h
no-header-test += asm/fbio.h
endif