* [PATCH 0/2] clone3 fixes
@ 2019-07-14 19:22 Christian Brauner
2019-07-14 19:22 ` [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Christian Brauner
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-14 19:22 UTC (permalink / raw)
To: linux-kernel; +Cc: arnd, Christian Brauner
Hey everyone,
Here are two small fixes/improvements for the clone3 syscall that I plan
on sending soon.
The first patches reserves the clone3 syscalls number 435 across all
architectures by placing a commit in the corresponding syscall tables of
architectures that do not yet implement clone3. This is done to preserve
the identical numbering for all new syscalls that Arnd introduced.
The second patch dates back to a discussion with Arnd when I suggested
reserving the syscall number. Arnd suggested to ensure that we catch all
arches that do implement clone3 without explicitly setting
__ARCH_WANT_SYS_CLONE3.
Thanks!
Christian
Christian Brauner (2):
arch: mark syscall number 435 reserved for clone3
unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/ia64/kernel/syscalls/syscall.tbl | 1 +
arch/m68k/kernel/syscalls/syscall.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n64.tbl | 1 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
arch/parisc/kernel/syscalls/syscall.tbl | 1 +
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
arch/s390/kernel/syscalls/syscall.tbl | 1 +
arch/sh/kernel/syscalls/syscall.tbl | 1 +
arch/sparc/kernel/syscalls/syscall.tbl | 1 +
include/uapi/asm-generic/unistd.h | 2 ++
12 files changed, 13 insertions(+)
--
2.22.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-14 19:22 [PATCH 0/2] clone3 fixes Christian Brauner
@ 2019-07-14 19:22 ` Christian Brauner
2019-07-15 13:56 ` Christian Borntraeger
2019-07-14 19:22 ` [PATCH 2/2] unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3 Christian Brauner
2019-07-14 20:07 ` [PATCH 0/2] clone3 fixes Arnd Bergmann
2 siblings, 1 reply; 15+ messages in thread
From: Christian Brauner @ 2019-07-14 19:22 UTC (permalink / raw)
To: linux-kernel
Cc: arnd, Christian Brauner, linux-arch, linux-alpha, linux-ia64,
linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux
A while ago Arnd made it possible to give new system calls the same
syscall number on all architectures (except alpha). To not break this
nice new feature let's mark 435 for clone3 as reserved on all
architectures that do not yet implement it.
Even if an architecture does not plan to implement it this ensures that
new system calls coming after clone3 will have the same number on all
architectures.
Signed-off-by: Christian Brauner <christian@brauner.io>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
---
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/ia64/kernel/syscalls/syscall.tbl | 1 +
arch/m68k/kernel/syscalls/syscall.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n64.tbl | 1 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
arch/parisc/kernel/syscalls/syscall.tbl | 1 +
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
arch/s390/kernel/syscalls/syscall.tbl | 1 +
arch/sh/kernel/syscalls/syscall.tbl | 1 +
arch/sparc/kernel/syscalls/syscall.tbl | 1 +
11 files changed, 11 insertions(+)
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index 1db9bbcfb84e..728fe028c02c 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -474,3 +474,4 @@
542 common fsmount sys_fsmount
543 common fspick sys_fspick
544 common pidfd_open sys_pidfd_open
+# 545 reserved for clone3
diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
index ecc44926737b..36d5faf4c86c 100644
--- a/arch/ia64/kernel/syscalls/syscall.tbl
+++ b/arch/ia64/kernel/syscalls/syscall.tbl
@@ -355,3 +355,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 9a3eb2558568..a88a285a0e5f 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -434,3 +434,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index 97035e19ad03..c9c879ec9b6d 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -373,3 +373,4 @@
432 n32 fsmount sys_fsmount
433 n32 fspick sys_fspick
434 n32 pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
index d7292722d3b0..bbce9159caa1 100644
--- a/arch/mips/kernel/syscalls/syscall_n64.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
@@ -349,3 +349,4 @@
432 n64 fsmount sys_fsmount
433 n64 fspick sys_fspick
434 n64 pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index dba084c92f14..9653591428ec 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -422,3 +422,4 @@
432 o32 fsmount sys_fsmount
433 o32 fspick sys_fspick
434 o32 pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index 5022b9e179c2..c7aadfef5386 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -431,3 +431,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index f2c3bda2d39f..3331749aab20 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -516,3 +516,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 6ebacfeaf853..a90d3e945445 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -437,3 +437,4 @@
432 common fsmount sys_fsmount sys_fsmount
433 common fspick sys_fspick sys_fspick
434 common pidfd_open sys_pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index 834c9c7d79fa..b5ed26c4c005 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -437,3 +437,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index c58e71f21129..8c8cc7537fb2 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -480,3 +480,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
+# 435 reserved for clone3
--
2.22.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3
2019-07-14 19:22 [PATCH 0/2] clone3 fixes Christian Brauner
2019-07-14 19:22 ` [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Christian Brauner
@ 2019-07-14 19:22 ` Christian Brauner
2019-07-14 20:07 ` [PATCH 0/2] clone3 fixes Arnd Bergmann
2 siblings, 0 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-14 19:22 UTC (permalink / raw)
To: linux-kernel; +Cc: arnd, Christian Brauner
This lets us catch new architectures that implicitly make use of clone3
without setting __ARCH_WANT_SYS_CLONE3.
Failing on missing __ARCH_WANT_SYS_CLONE3 is a good indicator that they
either did not really want this syscall or haven't really thought about
whether it needs special treatment and just accidently included it in
their entrypoints by e.g. generating their syscall table automatically
via asm-generic/unistd.h
This patch has been compile-tested for the h8300 architecture which is
one of the architectures that does not yet implement clone3 and
generates its syscall table via asm-generic/unistd.h.
Signed-off-by: Christian Brauner <christian@brauner.io>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
---
include/uapi/asm-generic/unistd.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 9acfff0cd153..1be0e798e362 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -846,8 +846,10 @@ __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
#undef __NR_syscalls
#define __NR_syscalls 436
--
2.22.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 0/2] clone3 fixes
2019-07-14 19:22 [PATCH 0/2] clone3 fixes Christian Brauner
2019-07-14 19:22 ` [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Christian Brauner
2019-07-14 19:22 ` [PATCH 2/2] unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3 Christian Brauner
@ 2019-07-14 20:07 ` Arnd Bergmann
2019-07-14 22:30 ` Christian Brauner
2 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2019-07-14 20:07 UTC (permalink / raw)
To: Christian Brauner; +Cc: Linux Kernel Mailing List
On Sun, Jul 14, 2019 at 9:22 PM Christian Brauner <christian@brauner.io> wrote:
>
> Hey everyone,
>
> Here are two small fixes/improvements for the clone3 syscall that I plan
> on sending soon.
>
> The first patches reserves the clone3 syscalls number 435 across all
> architectures by placing a commit in the corresponding syscall tables of
> architectures that do not yet implement clone3. This is done to preserve
> the identical numbering for all new syscalls that Arnd introduced.
>
> The second patch dates back to a discussion with Arnd when I suggested
> reserving the syscall number. Arnd suggested to ensure that we catch all
> arches that do implement clone3 without explicitly setting
> __ARCH_WANT_SYS_CLONE3.
Both patches
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0/2] clone3 fixes
2019-07-14 20:07 ` [PATCH 0/2] clone3 fixes Arnd Bergmann
@ 2019-07-14 22:30 ` Christian Brauner
0 siblings, 0 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-14 22:30 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Linux Kernel Mailing List
On Sun, Jul 14, 2019 at 10:07:13PM +0200, Arnd Bergmann wrote:
> On Sun, Jul 14, 2019 at 9:22 PM Christian Brauner <christian@brauner.io> wrote:
> >
> > Hey everyone,
> >
> > Here are two small fixes/improvements for the clone3 syscall that I plan
> > on sending soon.
> >
> > The first patches reserves the clone3 syscalls number 435 across all
> > architectures by placing a commit in the corresponding syscall tables of
> > architectures that do not yet implement clone3. This is done to preserve
> > the identical numbering for all new syscalls that Arnd introduced.
> >
> > The second patch dates back to a discussion with Arnd when I suggested
> > reserving the syscall number. Arnd suggested to ensure that we catch all
> > arches that do implement clone3 without explicitly setting
> > __ARCH_WANT_SYS_CLONE3.
>
> Both patches
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Thanks! Moved into my fixes tree.
Christian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-14 19:22 ` [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Christian Brauner
@ 2019-07-15 13:56 ` Christian Borntraeger
2019-07-15 14:29 ` Christian Brauner
2019-07-16 13:06 ` Christian Brauner
0 siblings, 2 replies; 15+ messages in thread
From: Christian Borntraeger @ 2019-07-15 13:56 UTC (permalink / raw)
To: Christian Brauner, linux-kernel
Cc: arnd, linux-arch, linux-alpha, linux-ia64, linux-m68k,
linux-mips, linux-parisc, linuxppc-dev, linux-s390, linux-sh,
sparclinux, Vasily Gorbik, Heiko Carstens
I think Vasily already has a clone3 patch for s390x with 435.
On 14.07.19 21:22, Christian Brauner wrote:
> A while ago Arnd made it possible to give new system calls the same
> syscall number on all architectures (except alpha). To not break this
> nice new feature let's mark 435 for clone3 as reserved on all
> architectures that do not yet implement it.
> Even if an architecture does not plan to implement it this ensures that
> new system calls coming after clone3 will have the same number on all
> architectures.
>
> Signed-off-by: Christian Brauner <christian@brauner.io>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-arch@vger.kernel.org
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-ia64@vger.kernel.org
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-s390@vger.kernel.org
> Cc: linux-sh@vger.kernel.org
> Cc: sparclinux@vger.kernel.org
> ---
> arch/alpha/kernel/syscalls/syscall.tbl | 1 +
> arch/ia64/kernel/syscalls/syscall.tbl | 1 +
> arch/m68k/kernel/syscalls/syscall.tbl | 1 +
> arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
> arch/mips/kernel/syscalls/syscall_n64.tbl | 1 +
> arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
> arch/parisc/kernel/syscalls/syscall.tbl | 1 +
> arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
> arch/s390/kernel/syscalls/syscall.tbl | 1 +
> arch/sh/kernel/syscalls/syscall.tbl | 1 +
> arch/sparc/kernel/syscalls/syscall.tbl | 1 +
> 11 files changed, 11 insertions(+)
>
> diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
> index 1db9bbcfb84e..728fe028c02c 100644
> --- a/arch/alpha/kernel/syscalls/syscall.tbl
> +++ b/arch/alpha/kernel/syscalls/syscall.tbl
> @@ -474,3 +474,4 @@
> 542 common fsmount sys_fsmount
> 543 common fspick sys_fspick
> 544 common pidfd_open sys_pidfd_open
> +# 545 reserved for clone3
> diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
> index ecc44926737b..36d5faf4c86c 100644
> --- a/arch/ia64/kernel/syscalls/syscall.tbl
> +++ b/arch/ia64/kernel/syscalls/syscall.tbl
> @@ -355,3 +355,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
> index 9a3eb2558568..a88a285a0e5f 100644
> --- a/arch/m68k/kernel/syscalls/syscall.tbl
> +++ b/arch/m68k/kernel/syscalls/syscall.tbl
> @@ -434,3 +434,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
> index 97035e19ad03..c9c879ec9b6d 100644
> --- a/arch/mips/kernel/syscalls/syscall_n32.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
> @@ -373,3 +373,4 @@
> 432 n32 fsmount sys_fsmount
> 433 n32 fspick sys_fspick
> 434 n32 pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
> index d7292722d3b0..bbce9159caa1 100644
> --- a/arch/mips/kernel/syscalls/syscall_n64.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
> @@ -349,3 +349,4 @@
> 432 n64 fsmount sys_fsmount
> 433 n64 fspick sys_fspick
> 434 n64 pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
> index dba084c92f14..9653591428ec 100644
> --- a/arch/mips/kernel/syscalls/syscall_o32.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
> @@ -422,3 +422,4 @@
> 432 o32 fsmount sys_fsmount
> 433 o32 fspick sys_fspick
> 434 o32 pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
> index 5022b9e179c2..c7aadfef5386 100644
> --- a/arch/parisc/kernel/syscalls/syscall.tbl
> +++ b/arch/parisc/kernel/syscalls/syscall.tbl
> @@ -431,3 +431,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index f2c3bda2d39f..3331749aab20 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -516,3 +516,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
> index 6ebacfeaf853..a90d3e945445 100644
> --- a/arch/s390/kernel/syscalls/syscall.tbl
> +++ b/arch/s390/kernel/syscalls/syscall.tbl
> @@ -437,3 +437,4 @@
> 432 common fsmount sys_fsmount sys_fsmount
> 433 common fspick sys_fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
> index 834c9c7d79fa..b5ed26c4c005 100644
> --- a/arch/sh/kernel/syscalls/syscall.tbl
> +++ b/arch/sh/kernel/syscalls/syscall.tbl
> @@ -437,3 +437,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
> diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
> index c58e71f21129..8c8cc7537fb2 100644
> --- a/arch/sparc/kernel/syscalls/syscall.tbl
> +++ b/arch/sparc/kernel/syscalls/syscall.tbl
> @@ -480,3 +480,4 @@
> 432 common fsmount sys_fsmount
> 433 common fspick sys_fspick
> 434 common pidfd_open sys_pidfd_open
> +# 435 reserved for clone3
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-15 13:56 ` Christian Borntraeger
@ 2019-07-15 14:29 ` Christian Brauner
2019-07-16 13:06 ` Christian Brauner
1 sibling, 0 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-15 14:29 UTC (permalink / raw)
To: Christian Borntraeger
Cc: linux-kernel, arnd, linux-arch, linux-alpha, linux-ia64,
linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, Vasily Gorbik, Heiko Carstens
On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> I think Vasily already has a clone3 patch for s390x with 435.
Excellent. I'll leave the # 435 reserved for clone3 on s390x in until
this patch has landed. It shouldn't be a merge conflict and if so it
should be trivial.
Christian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-15 13:56 ` Christian Borntraeger
2019-07-15 14:29 ` Christian Brauner
@ 2019-07-16 13:06 ` Christian Brauner
2019-07-16 18:53 ` Sven Schnelle
2019-07-19 10:18 ` Michael Ellerman
1 sibling, 2 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-16 13:06 UTC (permalink / raw)
To: Christian Borntraeger
Cc: linux-kernel, arnd, linux-arch, linux-alpha, linux-ia64,
linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, Vasily Gorbik, Heiko Carstens, mpe
On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> I think Vasily already has a clone3 patch for s390x with 435.
A quick follow-up on this. Helge and Michael have asked whether there
are any tests for clone3. Yes, there will be and I try to have them
ready by the end of the this or next week for review. In the meantime I
hope the following minimalistic test program that just verifies very
very basic functionality (It's not pretty.) will help you test:
#define _GNU_SOURCE
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <sched.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
#ifndef CLONE_PIDFD
#define CLONE_PIDFD 0x00001000
#endif
#ifndef __NR_clone3
#define __NR_clone3 -1
#endif
static pid_t sys_clone3(struct clone_args *args)
{
return syscall(__NR_clone3, args, sizeof(struct clone_args));
}
static int wait_for_pid(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (ret != pid)
goto again;
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
return -1;
return 0;
}
#define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr)))
int main(int argc, char *argv[])
{
int pidfd = -1;
pid_t parent_tid = -1, pid = -1;
struct clone_args args = {0};
args.parent_tid = ptr_to_u64(&parent_tid); /* CLONE_PARENT_SETTID */
args.pidfd = ptr_to_u64(&pidfd); /* CLONE_PIDFD */
args.flags = CLONE_PIDFD | CLONE_PARENT_SETTID;
args.exit_signal = SIGCHLD;
pid = sys_clone3(&args);
if (pid < 0) {
fprintf(stderr, "%s - Failed to create new process\n", strerror(errno));
exit(EXIT_FAILURE);
}
if (pid == 0) {
printf("Child process with pid %d\n", getpid());
exit(EXIT_SUCCESS);
}
printf("Parent process received child's pid %d as return value\n", pid);
printf("Parent process received child's pidfd %d\n", *(int *)args.pidfd);
printf("Parent process received child's pid %d as return argument\n",
*(pid_t *)args.parent_tid);
if (wait_for_pid(pid))
exit(EXIT_FAILURE);
if (pid != *(pid_t *)args.parent_tid)
exit(EXIT_FAILURE);
close(pidfd);
return 0;
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-16 13:06 ` Christian Brauner
@ 2019-07-16 18:53 ` Sven Schnelle
2019-07-16 18:55 ` Christian Brauner
2019-07-19 10:18 ` Michael Ellerman
1 sibling, 1 reply; 15+ messages in thread
From: Sven Schnelle @ 2019-07-16 18:53 UTC (permalink / raw)
To: Christian Brauner
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens, mpe
Hi,
[Adding Helge to CC list]
On Tue, Jul 16, 2019 at 03:06:33PM +0200, Christian Brauner wrote:
> On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> > I think Vasily already has a clone3 patch for s390x with 435.
>
> A quick follow-up on this. Helge and Michael have asked whether there
> are any tests for clone3. Yes, there will be and I try to have them
> ready by the end of the this or next week for review. In the meantime I
> hope the following minimalistic test program that just verifies very
> very basic functionality (It's not pretty.) will help you test:
> [..]
On PA-RISC this seems to work fine with Helge's patch to wire up the
clone3 syscall.
root@c3750:/# clonetest
Parent process received child's pid 84 as return value
Parent process received child's pidfd 3
Parent process received child's pid 84 as return argument
Child process with pid 84
root@c3750:/# echo $?
0
Regards
Sven
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-16 18:53 ` Sven Schnelle
@ 2019-07-16 18:55 ` Christian Brauner
2019-07-16 20:13 ` Helge Deller
0 siblings, 1 reply; 15+ messages in thread
From: Christian Brauner @ 2019-07-16 18:55 UTC (permalink / raw)
To: Sven Schnelle
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens, mpe
On Tue, Jul 16, 2019 at 08:53:10PM +0200, Sven Schnelle wrote:
> Hi,
>
> [Adding Helge to CC list]
>
> On Tue, Jul 16, 2019 at 03:06:33PM +0200, Christian Brauner wrote:
> > On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> > > I think Vasily already has a clone3 patch for s390x with 435.
> >
> > A quick follow-up on this. Helge and Michael have asked whether there
> > are any tests for clone3. Yes, there will be and I try to have them
> > ready by the end of the this or next week for review. In the meantime I
> > hope the following minimalistic test program that just verifies very
> > very basic functionality (It's not pretty.) will help you test:
> > [..]
>
> On PA-RISC this seems to work fine with Helge's patch to wire up the
> clone3 syscall.
I think I already responded to Helge before and yes, I think that parisc
doesn't do anything special for fork, vfork, clone, and by extension
also probably doesn't need to for clone3.
It should only be a problem for arches that require mucking explicitly
with arguments of clone-like syscalls.
In any case, I saw Helge's patch and I think I might've missed to add an
Acked-by but feel free to add it.
Thanks for testing it and sorry that I couldn't test!
Christian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-16 18:55 ` Christian Brauner
@ 2019-07-16 20:13 ` Helge Deller
0 siblings, 0 replies; 15+ messages in thread
From: Helge Deller @ 2019-07-16 20:13 UTC (permalink / raw)
To: Christian Brauner, Sven Schnelle
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens, mpe
On 16.07.19 20:55, Christian Brauner wrote:
> On Tue, Jul 16, 2019 at 08:53:10PM +0200, Sven Schnelle wrote:
>> Hi,
>>
>> [Adding Helge to CC list]
>>
>> On Tue, Jul 16, 2019 at 03:06:33PM +0200, Christian Brauner wrote:
>>> On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
>>>> I think Vasily already has a clone3 patch for s390x with 435.
>>>
>>> A quick follow-up on this. Helge and Michael have asked whether there
>>> are any tests for clone3. Yes, there will be and I try to have them
>>> ready by the end of the this or next week for review. In the meantime I
>>> hope the following minimalistic test program that just verifies very
>>> very basic functionality (It's not pretty.) will help you test:
>>> [..]
>>
>> On PA-RISC this seems to work fine with Helge's patch to wire up the
>> clone3 syscall.
>
> [...]
> In any case, I saw Helge's patch and I think I might've missed to add an
> Acked-by but feel free to add it.
Thanks!
I've added the patch to the parisc-linux for-next tree.
Helge
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-16 13:06 ` Christian Brauner
2019-07-16 18:53 ` Sven Schnelle
@ 2019-07-19 10:18 ` Michael Ellerman
2019-07-19 10:25 ` Christian Brauner
1 sibling, 1 reply; 15+ messages in thread
From: Michael Ellerman @ 2019-07-19 10:18 UTC (permalink / raw)
To: Christian Brauner, Christian Borntraeger
Cc: linux-kernel, arnd, linux-arch, linux-alpha, linux-ia64,
linux-m68k, linux-mips, linux-parisc, linuxppc-dev, linux-s390,
linux-sh, sparclinux, Vasily Gorbik, Heiko Carstens
Christian Brauner <christian@brauner.io> writes:
> On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
>> I think Vasily already has a clone3 patch for s390x with 435.
>
> A quick follow-up on this. Helge and Michael have asked whether there
> are any tests for clone3. Yes, there will be and I try to have them
> ready by the end of the this or next week for review. In the meantime I
> hope the following minimalistic test program that just verifies very
> very basic functionality (It's not pretty.) will help you test:
Hi Christian,
Thanks for the test.
This actually oopses on powerpc, it hits the BUG_ON in CHECK_FULL_REGS
in process.c around line 1633:
} else {
/* user thread */
struct pt_regs *regs = current_pt_regs();
CHECK_FULL_REGS(regs);
*childregs = *regs;
if (usp)
So I'll have to dig into how we fix that before we wire up clone3.
Turns out testing is good! :)
cheers
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-19 10:18 ` Michael Ellerman
@ 2019-07-19 10:25 ` Christian Brauner
2019-07-19 11:13 ` Michael Ellerman
0 siblings, 1 reply; 15+ messages in thread
From: Christian Brauner @ 2019-07-19 10:25 UTC (permalink / raw)
To: Michael Ellerman
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens
On Fri, Jul 19, 2019 at 08:18:02PM +1000, Michael Ellerman wrote:
> Christian Brauner <christian@brauner.io> writes:
> > On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> >> I think Vasily already has a clone3 patch for s390x with 435.
> >
> > A quick follow-up on this. Helge and Michael have asked whether there
> > are any tests for clone3. Yes, there will be and I try to have them
> > ready by the end of the this or next week for review. In the meantime I
> > hope the following minimalistic test program that just verifies very
> > very basic functionality (It's not pretty.) will help you test:
>
> Hi Christian,
>
> Thanks for the test.
>
> This actually oopses on powerpc, it hits the BUG_ON in CHECK_FULL_REGS
> in process.c around line 1633:
>
> } else {
> /* user thread */
> struct pt_regs *regs = current_pt_regs();
> CHECK_FULL_REGS(regs);
> *childregs = *regs;
> if (usp)
>
>
> So I'll have to dig into how we fix that before we wire up clone3.
>
> Turns out testing is good! :)
Indeed. I have a test-suite for clone3 in mind and I hope to have it
ready by the end of next week. It's just always the finding the time
part that is annoying. :)
Thanks for digging into this, Michael!
Christian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-19 10:25 ` Christian Brauner
@ 2019-07-19 11:13 ` Michael Ellerman
2019-07-19 12:20 ` Christian Brauner
0 siblings, 1 reply; 15+ messages in thread
From: Michael Ellerman @ 2019-07-19 11:13 UTC (permalink / raw)
To: Christian Brauner
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens
Christian Brauner <christian@brauner.io> writes:
> On Fri, Jul 19, 2019 at 08:18:02PM +1000, Michael Ellerman wrote:
>> Christian Brauner <christian@brauner.io> writes:
>> > On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
>> >> I think Vasily already has a clone3 patch for s390x with 435.
>> >
>> > A quick follow-up on this. Helge and Michael have asked whether there
>> > are any tests for clone3. Yes, there will be and I try to have them
>> > ready by the end of the this or next week for review. In the meantime I
>> > hope the following minimalistic test program that just verifies very
>> > very basic functionality (It's not pretty.) will help you test:
>>
>> Hi Christian,
>>
>> Thanks for the test.
>>
>> This actually oopses on powerpc, it hits the BUG_ON in CHECK_FULL_REGS
>> in process.c around line 1633:
>>
>> } else {
>> /* user thread */
>> struct pt_regs *regs = current_pt_regs();
>> CHECK_FULL_REGS(regs);
>> *childregs = *regs;
>> if (usp)
>>
>>
>> So I'll have to dig into how we fix that before we wire up clone3.
>>
>> Turns out testing is good! :)
>
> Indeed. I have a test-suite for clone3 in mind and I hope to have it
> ready by the end of next week. It's just always the finding the time
> part that is annoying. :)
I know the feeling!
> Thanks for digging into this, Michael!
No worries, happy to help where I can.
In the intervening five minutes I remembered how we handle this, we just
need a little wrapper to save the non-volatile regs:
_GLOBAL(ppc_clone3)
bl save_nvgprs
bl sys_clone3
b .Lsyscall_exit
A while back I meant to make it generate those automatically based on a
flag in the syscall.tbl but of course haven't got around to it :)
So with the above it seems all good:
$ ./clone3 ; echo $?
Parent process received child's pid 4204 as return value
Parent process received child's pidfd 3
Parent process received child's pid 4204 as return argument
Child process with pid 4204
0
I'll send a patch to wire it up on Monday.
cheers
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3
2019-07-19 11:13 ` Michael Ellerman
@ 2019-07-19 12:20 ` Christian Brauner
0 siblings, 0 replies; 15+ messages in thread
From: Christian Brauner @ 2019-07-19 12:20 UTC (permalink / raw)
To: Michael Ellerman
Cc: Christian Borntraeger, linux-kernel, arnd, linux-arch,
linux-alpha, linux-ia64, linux-m68k, linux-mips, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, Vasily Gorbik,
Heiko Carstens
On Fri, Jul 19, 2019 at 09:13:16PM +1000, Michael Ellerman wrote:
> Christian Brauner <christian@brauner.io> writes:
> > On Fri, Jul 19, 2019 at 08:18:02PM +1000, Michael Ellerman wrote:
> >> Christian Brauner <christian@brauner.io> writes:
> >> > On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote:
> >> >> I think Vasily already has a clone3 patch for s390x with 435.
> >> >
> >> > A quick follow-up on this. Helge and Michael have asked whether there
> >> > are any tests for clone3. Yes, there will be and I try to have them
> >> > ready by the end of the this or next week for review. In the meantime I
> >> > hope the following minimalistic test program that just verifies very
> >> > very basic functionality (It's not pretty.) will help you test:
> >>
> >> Hi Christian,
> >>
> >> Thanks for the test.
> >>
> >> This actually oopses on powerpc, it hits the BUG_ON in CHECK_FULL_REGS
> >> in process.c around line 1633:
> >>
> >> } else {
> >> /* user thread */
> >> struct pt_regs *regs = current_pt_regs();
> >> CHECK_FULL_REGS(regs);
> >> *childregs = *regs;
> >> if (usp)
> >>
> >>
> >> So I'll have to dig into how we fix that before we wire up clone3.
> >>
> >> Turns out testing is good! :)
> >
> > Indeed. I have a test-suite for clone3 in mind and I hope to have it
> > ready by the end of next week. It's just always the finding the time
> > part that is annoying. :)
>
> I know the feeling!
>
> > Thanks for digging into this, Michael!
>
> No worries, happy to help where I can.
>
> In the intervening five minutes I remembered how we handle this, we just
> need a little wrapper to save the non-volatile regs:
>
> _GLOBAL(ppc_clone3)
> bl save_nvgprs
> bl sys_clone3
> b .Lsyscall_exit
Sounds good.
>
>
> A while back I meant to make it generate those automatically based on a
> flag in the syscall.tbl but of course haven't got around to it :)
>
> So with the above it seems all good:
>
> $ ./clone3 ; echo $?
> Parent process received child's pid 4204 as return value
> Parent process received child's pidfd 3
> Parent process received child's pid 4204 as return argument
> Child process with pid 4204
> 0
>
> I'll send a patch to wire it up on Monday.
Excellent! Thank you!
Christian
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-07-19 12:21 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-14 19:22 [PATCH 0/2] clone3 fixes Christian Brauner
2019-07-14 19:22 ` [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Christian Brauner
2019-07-15 13:56 ` Christian Borntraeger
2019-07-15 14:29 ` Christian Brauner
2019-07-16 13:06 ` Christian Brauner
2019-07-16 18:53 ` Sven Schnelle
2019-07-16 18:55 ` Christian Brauner
2019-07-16 20:13 ` Helge Deller
2019-07-19 10:18 ` Michael Ellerman
2019-07-19 10:25 ` Christian Brauner
2019-07-19 11:13 ` Michael Ellerman
2019-07-19 12:20 ` Christian Brauner
2019-07-14 19:22 ` [PATCH 2/2] unistd: protect clone3 via __ARCH_WANT_SYS_CLONE3 Christian Brauner
2019-07-14 20:07 ` [PATCH 0/2] clone3 fixes Arnd Bergmann
2019-07-14 22:30 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).