]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
arch: handle arches who do not yet define clone3
authorChristian Brauner <christian@brauner.io>
Thu, 20 Jun 2019 23:26:35 +0000 (01:26 +0200)
committerChristian Brauner <christian@brauner.io>
Thu, 20 Jun 2019 23:54:53 +0000 (01:54 +0200)
This cleanly handles arches who do not yet define clone3.

clone3() was initially placed under __ARCH_WANT_SYS_CLONE under the
assumption that this would cleanly handle all architectures. It does
not.
Architectures such as nios2 or h8300 simply take the asm-generic syscall
definitions and generate their syscall table from it. Since they don't
define __ARCH_WANT_SYS_CLONE the build would fail complaining about
sys_clone3 missing. The reason this doesn't happen for legacy clone is
that nios2 and h8300 provide assembly stubs for sys_clone. This seems to
be done for architectural reasons.

The build failures for nios2 and h8300 were caught int -next luckily.
The solution is to define __ARCH_WANT_SYS_CLONE3 that architectures can
add. Additionally, we need a cond_syscall(clone3) for architectures such
as nios2 or h8300 that generate their syscall table in the way I
explained above.

Fixes: 8f3220a80654 ("arch: wire-up clone3() syscall")
Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Adrian Reber <adrian@lisas.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: linux-api@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: x86@kernel.org
arch/arm/include/asm/unistd.h
arch/arm64/include/asm/unistd.h
arch/x86/include/asm/unistd.h
arch/xtensa/include/asm/unistd.h
kernel/fork.c
kernel/sys_ni.c

index 7a39e77984eff49b0d4209eaeba93b0c9f8a48dd..aa35aa5d68dc47551767aca832808dee3ade00e4 100644 (file)
@@ -40,6 +40,7 @@
 #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 24480c2d95da49b82cc3368d5878a795e15c2192..e4e0523102e247958498c4a20ec4664b5921e4bc 100644 (file)
@@ -48,6 +48,7 @@
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_SYS_CLONE3
 
 #ifndef __COMPAT_SYSCALL_NR
 #include <uapi/asm/unistd.h>
index 146859efd83c60b0ef4b6e08b80a0054b6a3ada4..097589753feceb68cb9be9e1f5255ff4e060117b 100644 (file)
@@ -54,5 +54,6 @@
 # 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 30af4dc3ce7b82cd270dcbc39c2f6023eca48c08..b52236245e515f7ff5da195715ed5d09862a9580 100644 (file)
@@ -3,6 +3,7 @@
 #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 08ff131f26b4a552fe2a486d629f3b7a17226483..98abea9956299aba2d84d36b0da28a2037e34e8e 100644 (file)
@@ -2490,7 +2490,9 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
 
        return _do_fork(&args);
 }
+#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 size)
index 4d9ae5ea6caff8885c9c0a171a3f84bcfc318301..34b76895b81e8363bb06c5f55a1312b99e51e124 100644 (file)
@@ -137,6 +137,8 @@ COND_SYSCALL(capset);
 /* kernel/exit.c */
 
 /* kernel/fork.c */
+/* __ARCH_WANT_SYS_CLONE3 */
+COND_SYSCALL(clone3);
 
 /* kernel/futex.c */
 COND_SYSCALL(futex);