]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
clone3: drop __ARCH_WANT_SYS_CLONE3 macro
authorArnd Bergmann <arnd@arndb.de>
Wed, 8 May 2024 15:13:34 +0000 (17:13 +0200)
committerArnd Bergmann <arnd@arndb.de>
Wed, 10 Jul 2024 12:23:38 +0000 (14:23 +0200)
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>
24 files changed:
arch/arc/include/uapi/asm/unistd.h
arch/arm/include/asm/unistd.h
arch/arm64/include/uapi/asm/unistd.h
arch/csky/include/uapi/asm/unistd.h
arch/hexagon/include/uapi/asm/unistd.h
arch/loongarch/include/uapi/asm/unistd.h
arch/m68k/include/asm/unistd.h
arch/mips/include/asm/unistd.h
arch/nios2/include/uapi/asm/unistd.h
arch/openrisc/include/uapi/asm/unistd.h
arch/parisc/include/asm/unistd.h
arch/powerpc/include/asm/unistd.h
arch/riscv/include/uapi/asm/unistd.h
arch/s390/include/asm/unistd.h
arch/sh/include/asm/unistd.h
arch/sparc/include/asm/unistd.h
arch/x86/include/asm/unistd.h
arch/xtensa/include/asm/unistd.h
include/uapi/asm-generic/unistd.h
kernel/fork.c
kernel/sys_ni.c
tools/arch/arm64/include/uapi/asm/unistd.h
tools/arch/loongarch/include/uapi/asm/unistd.h
tools/include/uapi/asm-generic/unistd.h

index fa2713ae6bea5ced219309914d2924904676de6e..5eafa111516238306be7775fbcdb8db863543808 100644 (file)
@@ -21,7 +21,6 @@
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_TIME32_SYSCALLS
index 3676e82cf95c4731770ec1eac4c75f730986b866..9fb00973c6084e32a9941ee0a224e4cbe9fb8a1f 100644 (file)
@@ -37,7 +37,6 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 /*
  * Unimplemented (or alternatively implemented) syscalls
index ce2ee8f1e361091e462cd658257709bf09fc9c84..9306726337fe005e3cf3e1ffd38dc6356191fa95 100644 (file)
@@ -19,7 +19,6 @@
 #define __ARCH_WANT_NEW_STAT
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_MEMFD_SECRET
 
 #include <asm-generic/unistd.h>
index e0594b6370a658382478782501c338614e2bb76e..d529d04328765cf750b65371b748f3accca93b61 100644 (file)
@@ -3,7 +3,6 @@
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_NEW_STAT
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_TIME32_SYSCALLS
 #define __ARCH_WANT_SYNC_FILE_RANGE2
index 21ae22306b5dce7f63f67aedbe48078a15eb757b..4bea7428e7473f035887599bd280116de7f92716 100644 (file)
@@ -38,4 +38,6 @@
 #define __ARCH_WANT_TIME32_SYSCALLS
 #define __ARCH_WANT_SYNC_FILE_RANGE2
 
+#define __ARCH_BROKEN_SYS_CLONE3
+
 #include <asm-generic/unistd.h>
index fcb668984f0336fa77740deb7b40b410450cd885..191614b9b207360750cea3b9eef982d08e27c336 100644 (file)
@@ -1,5 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 #include <asm-generic/unistd.h>
index 4ae52414cd9d4392e509d0301161ac28b4d44956..2e0047cf86f838487ceb84a5e78e80f3bc2316c6 100644 (file)
@@ -30,6 +30,5 @@
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
-#define __ARCH_WANT_SYS_CLONE3
 
 #endif /* _ASM_M68K_UNISTD_H_ */
index 25a5253db7f45fc94e523c49fb779060d0adf44a..ba83d3fb0a848c87e373310b9f18a4734713279f 100644 (file)
@@ -58,7 +58,6 @@
 # endif
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 /* whitelists for checksyscalls */
 #define __IGNORE_fadvise64_64
index 0b4bb1d41b286e653b6c876d25241e062395ec5e..d2bc5ac975fb040384d33b2737c27d6b33a19336 100644 (file)
@@ -23,6 +23,8 @@
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_TIME32_SYSCALLS
 
+#define __ARCH_BROKEN_SYS_CLONE3
+
 /* Use the standard ABI for syscalls */
 #include <asm-generic/unistd.h>
 
index fae34c60fa88f2d68e45ba251c186cc0f867a822..566f8c4f8047ee08aa02af511debe615d3cd902a 100644 (file)
@@ -24,7 +24,6 @@
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_TIME32_SYSCALLS
 
 #include <asm-generic/unistd.h>
index e38f9a90ac154c2d7296ed2a75d2e9ed6b3d7453..98851ff7699a861d0bdb321225e5a09e2990e6ba 100644 (file)
@@ -160,7 +160,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)       \
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_COMPAT_SYS_SENDFILE
 #define __ARCH_WANT_COMPAT_STAT
 
index 659a996c75aa8cbae741457c531cc2d0df58d02a..027ef94a12fbdd3dfe84f4418414c9c5e04055c9 100644 (file)
@@ -51,7 +51,6 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 #endif         /* __ASSEMBLY__ */
 #endif /* _ASM_POWERPC_UNISTD_H_ */
index 950ab3fd4409b7b5a9e110a4ad2bc68b4b689a05..328520defc1389ae9faeca8914ef61447350a644 100644 (file)
@@ -20,7 +20,6 @@
 #define __ARCH_WANT_SET_GET_RLIMIT
 #endif /* __LP64__ */
 
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_MEMFD_SECRET
 
 #include <asm-generic/unistd.h>
index 4260bc5ce7f8134d7aed6a3e9df21d7f7680847d..70fc671397dad21bd611864d908a4f97471baf17 100644 (file)
@@ -35,6 +35,5 @@
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 #endif /* _ASM_S390_UNISTD_H_ */
index d6e1262501368ad625a915da8d5ec1c5020f3090..3d7f35650a13dbd2aece069b64cc8ce0dc4b6f65 100644 (file)
@@ -28,4 +28,6 @@
 # define __ARCH_WANT_SYS_VFORK
 # define __ARCH_WANT_SYS_CLONE
 
+#define __ARCH_BROKEN_SYS_CLONE3
+
 #include <uapi/asm/unistd.h>
index d6bc76706a7aa416dab25cdb6e6e82f54cb9891e..3380411a4537b160cea0ded288df78e331015af2 100644 (file)
@@ -49,6 +49,8 @@
 #define __ARCH_WANT_COMPAT_STAT
 #endif
 
+#define __ARCH_BROKEN_SYS_CLONE3
+
 #ifdef __32bit_syscall_numbers__
 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
  * it never had the plain ones and there is no value to adding those
index 761173ccc33cab5b29664afc0655e57ea0a0487f..6c9e5bdd391603173480d4b3e5fe65153f1b9690 100644 (file)
@@ -56,6 +56,5 @@
 # define __ARCH_WANT_SYS_FORK
 # define __ARCH_WANT_SYS_VFORK
 # define __ARCH_WANT_SYS_CLONE
-# define __ARCH_WANT_SYS_CLONE3
 
 #endif /* _ASM_X86_UNISTD_H */
index b52236245e515f7ff5da195715ed5d09862a9580..30af4dc3ce7b82cd270dcbc39c2f6023eca48c08 100644 (file)
@@ -3,7 +3,6 @@
 #define _XTENSA_UNISTD_H
 
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 #include <uapi/asm/unistd.h>
 
 #define __ARCH_WANT_NEW_STAT
index d4cc26932ff47b504c65665671beb3c2e1233304..5bf6148cac2b93e36f362236545e2e6eb473d5ff 100644 (file)
@@ -776,12 +776,8 @@ __SYSCALL(__NR_fsmount, sys_fsmount)
 __SYSCALL(__NR_fspick, sys_fspick)
 #define __NR_pidfd_open 434
 __SYSCALL(__NR_pidfd_open, sys_pidfd_open)
-
-#ifdef __ARCH_WANT_SYS_CLONE3
 #define __NR_clone3 435
 __SYSCALL(__NR_clone3, sys_clone3)
-#endif
-
 #define __NR_close_range 436
 __SYSCALL(__NR_close_range, sys_close_range)
 #define __NR_openat2 437
index 99076dbe27d83f93d704882d4f5c09ae103af303..02f322424c49c485170383fc7a8d1811970d75ef 100644 (file)
@@ -2941,8 +2941,6 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
 }
 #endif
 
-#ifdef __ARCH_WANT_SYS_CLONE3
-
 noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
                                              struct clone_args __user *uargs,
                                              size_t usize)
@@ -3086,6 +3084,11 @@ SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
        struct kernel_clone_args kargs;
        pid_t set_tid[MAX_PID_NS_LEVEL];
 
+#ifdef __ARCH_BROKEN_SYS_CLONE3
+#warning clone3() entry point is missing, please fix
+       return -ENOSYS;
+#endif
+
        kargs.set_tid = set_tid;
 
        err = copy_clone_args_from_user(&kargs, uargs, size);
@@ -3097,7 +3100,6 @@ SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size)
 
        return kernel_clone(&kargs);
 }
-#endif
 
 void walk_process_tree(struct task_struct *top, proc_visitor visitor, void *data)
 {
index b696b85ac63e0bf1fa0568e6cbe574ab8de3dd80..2ef820a2d067df4fae8edb7a4cc06a2a1153f137 100644 (file)
@@ -76,8 +76,6 @@ COND_SYSCALL(timerfd_gettime32);
 COND_SYSCALL(acct);
 COND_SYSCALL(capget);
 COND_SYSCALL(capset);
-/* __ARCH_WANT_SYS_CLONE3 */
-COND_SYSCALL(clone3);
 COND_SYSCALL(futex);
 COND_SYSCALL(futex_time32);
 COND_SYSCALL(set_robust_list);
index ce2ee8f1e361091e462cd658257709bf09fc9c84..9306726337fe005e3cf3e1ffd38dc6356191fa95 100644 (file)
@@ -19,7 +19,6 @@
 #define __ARCH_WANT_NEW_STAT
 #define __ARCH_WANT_SET_GET_RLIMIT
 #define __ARCH_WANT_TIME32_SYSCALLS
-#define __ARCH_WANT_SYS_CLONE3
 #define __ARCH_WANT_MEMFD_SECRET
 
 #include <asm-generic/unistd.h>
index 0c743344e92deaa02fa43ce0a7f44c18a5471fd3..8eeaac0087c3eeafa13098e006f21d584037111a 100644 (file)
@@ -4,6 +4,5 @@
  */
 
 #define __ARCH_WANT_SYS_CLONE
-#define __ARCH_WANT_SYS_CLONE3
 
 #include <asm-generic/unistd.h>
index d983c48a3b6af1753108a43ad95eb839e95e5e6b..a00d53d027235a4a27760cb9aac33048ab641420 100644 (file)
@@ -776,12 +776,8 @@ __SYSCALL(__NR_fsmount, sys_fsmount)
 __SYSCALL(__NR_fspick, sys_fspick)
 #define __NR_pidfd_open 434
 __SYSCALL(__NR_pidfd_open, sys_pidfd_open)
-
-#ifdef __ARCH_WANT_SYS_CLONE3
 #define __NR_clone3 435
 __SYSCALL(__NR_clone3, sys_clone3)
-#endif
-
 #define __NR_close_range 436
 __SYSCALL(__NR_close_range, sys_close_range)
 #define __NR_openat2 437