Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clone3: drop __ARCH_WANT_SYS_CLONE3 macro

When clone3() was introduced, it was not obvious how each architecture
deals with setting up the stack and keeping the register contents in
a fork()-like system call, so this was left for the architecture
maintainers to implement, with __ARCH_WANT_SYS_CLONE3 defined by those
that already implement it.

Five years later, we still have a few architectures left that are missing
clone3(), and the macro keeps getting in the way as it's fundamentally
different from all the other __ARCH_WANT_SYS_* macros that are meant
to provide backwards-compatibility with applications using older
syscalls that are no longer provided by default.

Address this by reversing the polarity of the macro, adding an
__ARCH_BROKEN_SYS_CLONE3 macro to all architectures that don't
already provide the syscall, and remove __ARCH_WANT_SYS_CLONE3
from all the other ones.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+13 -29
-1
arch/arc/include/uapi/asm/unistd.h
··· 21 21 #define __ARCH_WANT_SET_GET_RLIMIT 22 22 #define __ARCH_WANT_SYS_EXECVE 23 23 #define __ARCH_WANT_SYS_CLONE 24 - #define __ARCH_WANT_SYS_CLONE3 25 24 #define __ARCH_WANT_SYS_VFORK 26 25 #define __ARCH_WANT_SYS_FORK 27 26 #define __ARCH_WANT_TIME32_SYSCALLS
-1
arch/arm/include/asm/unistd.h
··· 37 37 #define __ARCH_WANT_SYS_FORK 38 38 #define __ARCH_WANT_SYS_VFORK 39 39 #define __ARCH_WANT_SYS_CLONE 40 - #define __ARCH_WANT_SYS_CLONE3 41 40 42 41 /* 43 42 * Unimplemented (or alternatively implemented) syscalls
-1
arch/arm64/include/uapi/asm/unistd.h
··· 19 19 #define __ARCH_WANT_NEW_STAT 20 20 #define __ARCH_WANT_SET_GET_RLIMIT 21 21 #define __ARCH_WANT_TIME32_SYSCALLS 22 - #define __ARCH_WANT_SYS_CLONE3 23 22 #define __ARCH_WANT_MEMFD_SECRET 24 23 25 24 #include <asm-generic/unistd.h>
-1
arch/csky/include/uapi/asm/unistd.h
··· 3 3 #define __ARCH_WANT_STAT64 4 4 #define __ARCH_WANT_NEW_STAT 5 5 #define __ARCH_WANT_SYS_CLONE 6 - #define __ARCH_WANT_SYS_CLONE3 7 6 #define __ARCH_WANT_SET_GET_RLIMIT 8 7 #define __ARCH_WANT_TIME32_SYSCALLS 9 8 #define __ARCH_WANT_SYNC_FILE_RANGE2
+2
arch/hexagon/include/uapi/asm/unistd.h
··· 38 38 #define __ARCH_WANT_TIME32_SYSCALLS 39 39 #define __ARCH_WANT_SYNC_FILE_RANGE2 40 40 41 + #define __ARCH_BROKEN_SYS_CLONE3 42 + 41 43 #include <asm-generic/unistd.h>
-1
arch/loongarch/include/uapi/asm/unistd.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 2 #define __ARCH_WANT_SYS_CLONE 3 - #define __ARCH_WANT_SYS_CLONE3 4 3 5 4 #include <asm-generic/unistd.h>
-1
arch/m68k/include/asm/unistd.h
··· 30 30 #define __ARCH_WANT_SYS_SIGPROCMASK 31 31 #define __ARCH_WANT_SYS_FORK 32 32 #define __ARCH_WANT_SYS_VFORK 33 - #define __ARCH_WANT_SYS_CLONE3 34 33 35 34 #endif /* _ASM_M68K_UNISTD_H_ */
-1
arch/mips/include/asm/unistd.h
··· 58 58 # endif 59 59 #define __ARCH_WANT_SYS_FORK 60 60 #define __ARCH_WANT_SYS_CLONE 61 - #define __ARCH_WANT_SYS_CLONE3 62 61 63 62 /* whitelists for checksyscalls */ 64 63 #define __IGNORE_fadvise64_64
+2
arch/nios2/include/uapi/asm/unistd.h
··· 23 23 #define __ARCH_WANT_SET_GET_RLIMIT 24 24 #define __ARCH_WANT_TIME32_SYSCALLS 25 25 26 + #define __ARCH_BROKEN_SYS_CLONE3 27 + 26 28 /* Use the standard ABI for syscalls */ 27 29 #include <asm-generic/unistd.h> 28 30
-1
arch/openrisc/include/uapi/asm/unistd.h
··· 24 24 #define __ARCH_WANT_SET_GET_RLIMIT 25 25 #define __ARCH_WANT_SYS_FORK 26 26 #define __ARCH_WANT_SYS_CLONE 27 - #define __ARCH_WANT_SYS_CLONE3 28 27 #define __ARCH_WANT_TIME32_SYSCALLS 29 28 30 29 #include <asm-generic/unistd.h>
-1
arch/parisc/include/asm/unistd.h
··· 160 160 #define __ARCH_WANT_SYS_FORK 161 161 #define __ARCH_WANT_SYS_VFORK 162 162 #define __ARCH_WANT_SYS_CLONE 163 - #define __ARCH_WANT_SYS_CLONE3 164 163 #define __ARCH_WANT_COMPAT_SYS_SENDFILE 165 164 #define __ARCH_WANT_COMPAT_STAT 166 165
-1
arch/powerpc/include/asm/unistd.h
··· 51 51 #define __ARCH_WANT_SYS_FORK 52 52 #define __ARCH_WANT_SYS_VFORK 53 53 #define __ARCH_WANT_SYS_CLONE 54 - #define __ARCH_WANT_SYS_CLONE3 55 54 56 55 #endif /* __ASSEMBLY__ */ 57 56 #endif /* _ASM_POWERPC_UNISTD_H_ */
-1
arch/riscv/include/uapi/asm/unistd.h
··· 20 20 #define __ARCH_WANT_SET_GET_RLIMIT 21 21 #endif /* __LP64__ */ 22 22 23 - #define __ARCH_WANT_SYS_CLONE3 24 23 #define __ARCH_WANT_MEMFD_SECRET 25 24 26 25 #include <asm-generic/unistd.h>
-1
arch/s390/include/asm/unistd.h
··· 35 35 #define __ARCH_WANT_SYS_FORK 36 36 #define __ARCH_WANT_SYS_VFORK 37 37 #define __ARCH_WANT_SYS_CLONE 38 - #define __ARCH_WANT_SYS_CLONE3 39 38 40 39 #endif /* _ASM_S390_UNISTD_H_ */
+2
arch/sh/include/asm/unistd.h
··· 28 28 # define __ARCH_WANT_SYS_VFORK 29 29 # define __ARCH_WANT_SYS_CLONE 30 30 31 + #define __ARCH_BROKEN_SYS_CLONE3 32 + 31 33 #include <uapi/asm/unistd.h>
+2
arch/sparc/include/asm/unistd.h
··· 49 49 #define __ARCH_WANT_COMPAT_STAT 50 50 #endif 51 51 52 + #define __ARCH_BROKEN_SYS_CLONE3 53 + 52 54 #ifdef __32bit_syscall_numbers__ 53 55 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 54 56 * it never had the plain ones and there is no value to adding those
-1
arch/x86/include/asm/unistd.h
··· 56 56 # define __ARCH_WANT_SYS_FORK 57 57 # define __ARCH_WANT_SYS_VFORK 58 58 # define __ARCH_WANT_SYS_CLONE 59 - # define __ARCH_WANT_SYS_CLONE3 60 59 61 60 #endif /* _ASM_X86_UNISTD_H */
-1
arch/xtensa/include/asm/unistd.h
··· 3 3 #define _XTENSA_UNISTD_H 4 4 5 5 #define __ARCH_WANT_SYS_CLONE 6 - #define __ARCH_WANT_SYS_CLONE3 7 6 #include <uapi/asm/unistd.h> 8 7 9 8 #define __ARCH_WANT_NEW_STAT
-4
include/uapi/asm-generic/unistd.h
··· 776 776 __SYSCALL(__NR_fspick, sys_fspick) 777 777 #define __NR_pidfd_open 434 778 778 __SYSCALL(__NR_pidfd_open, sys_pidfd_open) 779 - 780 - #ifdef __ARCH_WANT_SYS_CLONE3 781 779 #define __NR_clone3 435 782 780 __SYSCALL(__NR_clone3, sys_clone3) 783 - #endif 784 - 785 781 #define __NR_close_range 436 786 782 __SYSCALL(__NR_close_range, sys_close_range) 787 783 #define __NR_openat2 437
+5 -3
kernel/fork.c
··· 2941 2941 } 2942 2942 #endif 2943 2943 2944 - #ifdef __ARCH_WANT_SYS_CLONE3 2945 - 2946 2944 noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, 2947 2945 struct clone_args __user *uargs, 2948 2946 size_t usize) ··· 3084 3086 struct kernel_clone_args kargs; 3085 3087 pid_t set_tid[MAX_PID_NS_LEVEL]; 3086 3088 3089 + #ifdef __ARCH_BROKEN_SYS_CLONE3 3090 + #warning clone3() entry point is missing, please fix 3091 + return -ENOSYS; 3092 + #endif 3093 + 3087 3094 kargs.set_tid = set_tid; 3088 3095 3089 3096 err = copy_clone_args_from_user(&kargs, uargs, size); ··· 3100 3097 3101 3098 return kernel_clone(&kargs); 3102 3099 } 3103 - #endif 3104 3100 3105 3101 void walk_process_tree(struct task_struct *top, proc_visitor visitor, void *data) 3106 3102 {
-2
kernel/sys_ni.c
··· 76 76 COND_SYSCALL(acct); 77 77 COND_SYSCALL(capget); 78 78 COND_SYSCALL(capset); 79 - /* __ARCH_WANT_SYS_CLONE3 */ 80 - COND_SYSCALL(clone3); 81 79 COND_SYSCALL(futex); 82 80 COND_SYSCALL(futex_time32); 83 81 COND_SYSCALL(set_robust_list);
-1
tools/arch/arm64/include/uapi/asm/unistd.h
··· 19 19 #define __ARCH_WANT_NEW_STAT 20 20 #define __ARCH_WANT_SET_GET_RLIMIT 21 21 #define __ARCH_WANT_TIME32_SYSCALLS 22 - #define __ARCH_WANT_SYS_CLONE3 23 22 #define __ARCH_WANT_MEMFD_SECRET 24 23 25 24 #include <asm-generic/unistd.h>
-1
tools/arch/loongarch/include/uapi/asm/unistd.h
··· 4 4 */ 5 5 6 6 #define __ARCH_WANT_SYS_CLONE 7 - #define __ARCH_WANT_SYS_CLONE3 8 7 9 8 #include <asm-generic/unistd.h>
-4
tools/include/uapi/asm-generic/unistd.h
··· 776 776 __SYSCALL(__NR_fspick, sys_fspick) 777 777 #define __NR_pidfd_open 434 778 778 __SYSCALL(__NR_pidfd_open, sys_pidfd_open) 779 - 780 - #ifdef __ARCH_WANT_SYS_CLONE3 781 779 #define __NR_clone3 435 782 780 __SYSCALL(__NR_clone3, sys_clone3) 783 - #endif 784 - 785 781 #define __NR_close_range 436 786 782 __SYSCALL(__NR_close_range, sys_close_range) 787 783 #define __NR_openat2 437