mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
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>
This commit is contained in:
parent
fbb5c0606f
commit
505d66d1ab
@ -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
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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_ */
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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>
|
||||
|
@ -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_ */
|
||||
|
@ -28,4 +28,6 @@
|
||||
# define __ARCH_WANT_SYS_VFORK
|
||||
# define __ARCH_WANT_SYS_CLONE
|
||||
|
||||
#define __ARCH_BROKEN_SYS_CLONE3
|
||||
|
||||
#include <uapi/asm/unistd.h>
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -4,6 +4,5 @@
|
||||
*/
|
||||
|
||||
#define __ARCH_WANT_SYS_CLONE
|
||||
#define __ARCH_WANT_SYS_CLONE3
|
||||
|
||||
#include <asm-generic/unistd.h>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user