On Wed, Jul 17, 2024, at 07:08, Linus Torvalds wrote: > On Tue, 16 Jul 2024 at 21:57, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > ./arch/arm64/include/generated/uapi/asm/unistd_64.h > ./arch/arm64/include/generated/asm/syscall_table_32.h > ./arch/arm64/include/generated/asm/syscall_table_64.h > ./arch/arm64/include/generated/asm/unistd_32.h > ./arch/arm64/include/generated/asm/unistd_compat_32.h > ./include/generated/autoconf.h > ./usr/include/asm/unistd_64.h > I've tried to come up with a patch that avoids including asm/unistd.h in most files, which would give some relief and hopefully let you get through the merge window in case we can't figure out my Makefile bug quickly. It's only a small drop in the ocean of excessive header inclusions, but it's still a step in the right direction I think. I'll do some more testing on other architectures with this patch so I can send you something that works. You can also just revert the three arm64 commits for now d2a4a07190f4 arm64: rework compat syscall macros e632bca07c8e arm64: generate 64-bit syscall.tbl 7fe33e9f662c arm64: convert unistd_32.h to syscall.tbl format since the patch to remove uapi/asm-generic/unistd.h wasn't part of the 6.11 series yet and nothing else depends on the arm64 conversion. Arnd extern const unsigned long sys_call_table[]; diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index f08408b6e826..274b67f02f3e 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c @@ -13,7 +13,7 @@ #include <linux/export.h> #include <linux/sched.h> #include <linux/slab.h> -#include <linux/syscalls.h> +#include <linux/syscalls_api.h> #include <asm/cpufeature.h> #include <asm/syscall.h> diff --git a/fs/proc/base.c b/fs/proc/base.c index 72a1acd03675..9a535916dc03 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -92,6 +92,7 @@ #include <linux/sched/coredump.h> #include <linux/sched/debug.h> #include <linux/sched/stat.h> +#include <linux/syscalls_api.h> #include <linux/posix-timers.h> #include <linux/time_namespace.h> #include <linux/resctrl.h> diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index e6c00e860951..5144b80027be 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -3,7 +3,6 @@ #define _LINUX_BINFMTS_H #include <linux/sched.h> -#include <linux/unistd.h> #include <asm/exec.h> #include <uapi/linux/binfmts.h> diff --git a/include/linux/compat.h b/include/linux/compat.h index 56cebaff0c91..89c307da6e5d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -17,7 +17,6 @@ #include <linux/fs.h> #include <linux/aio_abi.h> /* for aio_context_t */ #include <linux/uaccess.h> -#include <linux/unistd.h> #include <asm/compat.h> #include <asm/siginfo.h> diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 90507d4afcd6..f1ddc1eb9290 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -9,13 +9,6 @@ #include <linux/bug.h> /* For BUG_ON. */ #include <linux/pid_namespace.h> /* For task_active_pid_ns. */ #include <uapi/linux/ptrace.h> -#include <linux/seccomp.h> - -/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */ -struct syscall_info { - __u64 sp; - struct seccomp_data data; -}; extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, unsigned int gup_flags); @@ -397,8 +390,6 @@ static inline void user_single_step_report(struct pt_regs *regs) #define exception_ip(x) instruction_pointer(x) #endif -extern int task_current_syscall(struct task_struct *target, struct syscall_info *info); - extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact); /* diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fff820c3e93e..2613b8f264bb 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -86,7 +86,6 @@ struct mnt_id_req; #include <linux/bug.h> #include <linux/sem.h> #include <asm/siginfo.h> -#include <linux/unistd.h> #include <linux/quota.h> #include <linux/key.h> #include <linux/personality.h> diff --git a/include/linux/syscalls_api.h b/include/linux/syscalls_api.h index 23e012b04db4..bf997576453f 100644 --- a/include/linux/syscalls_api.h +++ b/include/linux/syscalls_api.h @@ -1 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef _LINUX_SYSCALLS_API_H +#define _LINUX_SYSCALLS_API_H + #include <linux/syscalls.h> +#include <linux/seccomp.h> +#include <asm/syscall.h> + +/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */ +struct syscall_info { + __u64 sp; + struct seccomp_data data; +}; + +extern int task_current_syscall(struct task_struct *target, struct syscall_info *info); + +#endif diff --git a/include/trace/syscall.h b/include/trace/syscall.h index 8e193f3a33b3..0dfe926e70df 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h @@ -3,7 +3,6 @@ #define _TRACE_SYSCALL_H #include <linux/tracepoint.h> -#include <linux/unistd.h> #include <linux/trace_events.h> #include <linux/thread_info.h> diff --git a/include/uapi/linux/lsm.h b/include/uapi/linux/lsm.h index 33d8c9f4aa6b..523a53f12d4f 100644 --- a/include/uapi/linux/lsm.h +++ b/include/uapi/linux/lsm.h @@ -11,7 +11,6 @@ #include <linux/stddef.h> #include <linux/types.h> -#include <linux/unistd.h> /** * struct lsm_ctx - LSM context information diff --git a/kernel/exit.c b/kernel/exit.c index be81342caf1b..a78a6e97615a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -13,6 +13,7 @@ #include <linux/sched/task.h> #include <linux/sched/task_stack.h> #include <linux/sched/cputime.h> +#include <linux/seccomp.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/capability.h> diff --git a/kernel/ptrace.c b/kernel/ptrace.c index d5f89f9ef29f..1067da7a8409 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -14,6 +14,7 @@ #include <linux/sched/mm.h> #include <linux/sched/coredump.h> #include <linux/sched/task.h> +#include <linux/seccomp.h> #include <linux/errno.h> #include <linux/mm.h> #include <linux/highmem.h> diff --git a/lib/syscall.c b/lib/syscall.c index 006e256d2264..5fb67b3699b9 100644 --- a/lib/syscall.c +++ b/lib/syscall.c @@ -3,7 +3,7 @@ #include <linux/sched.h> #include <linux/sched/task_stack.h> #include <linux/export.h> -#include <asm/syscall.h> +#include <linux/syscalls_api.h> static int collect_syscall(struct task_struct *target, struct syscall_info *info) {