2019-11-24 19:58:40

by Kars de Jong

[permalink] [raw]
Subject: [PATCH] m68k: Wire up clone3() syscall

Wire up the clone3() syscall for m68k. The special entry point is done in
assembler as was done for clone() as well. This is needed because all
registers need to be saved. The C wrapper then calls the generic
sys_clone3() with the correct arguments.

Tested on A1200 using the simple test program from:

https://lore.kernel.org/lkml/[email protected]/

Cc: [email protected]
Signed-off-by: Kars de Jong <[email protected]>
---
arch/m68k/include/asm/unistd.h | 1 +
arch/m68k/kernel/entry.S | 7 +++++++
arch/m68k/kernel/process.c | 13 ++++++++++++-
arch/m68k/kernel/syscalls/syscall.tbl | 2 +-
4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 2e0047cf86f8..4ae52414cd9d 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -30,5 +30,6 @@
#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_ */
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 97cd3ea5f10b..9dd76fbb7c6b 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -69,6 +69,13 @@ ENTRY(__sys_vfork)
lea %sp@(24),%sp
rts

+ENTRY(__sys_clone3)
+ SAVE_SWITCH_STACK
+ pea %sp@(SWITCH_STACK_SIZE)
+ jbsr m68k_clone3
+ lea %sp@(28),%sp
+ rts
+
ENTRY(sys_sigreturn)
SAVE_SWITCH_STACK
movel %sp,%sp@- | switch_stack pointer
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 4e77a06735c1..22e6b8f4f958 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -30,8 +30,9 @@
#include <linux/init_task.h>
#include <linux/mqueue.h>
#include <linux/rcupdate.h>
-
+#include <linux/syscalls.h>
#include <linux/uaccess.h>
+
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/setup.h>
@@ -119,6 +120,16 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
(int __user *)regs->d3, (int __user *)regs->d4);
}

+/*
+ * Because extra registers are saved on the stack after the sys_clone3()
+ * arguments, this C wrapper extracts them from pt_regs * and then calls the
+ * generic sys_clone3() implementation.
+ */
+asmlinkage int m68k_clone3(struct pt_regs *regs)
+{
+ return sys_clone3((struct clone_args __user *)regs->d1, regs->d2);
+}
+
int copy_thread(unsigned long clone_flags, unsigned long usp,
unsigned long arg, struct task_struct *p)
{
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index a88a285a0e5f..a00a5d0db602 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -434,4 +434,4 @@
432 common fsmount sys_fsmount
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
-# 435 reserved for clone3
+435 common clone3 __sys_clone3
--
2.17.1


2019-11-25 09:17:54

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Kars,

On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> Wire up the clone3() syscall for m68k. The special entry point is done in
> assembler as was done for clone() as well. This is needed because all
> registers need to be saved. The C wrapper then calls the generic
> sys_clone3() with the correct arguments.
>
> Tested on A1200 using the simple test program from:
>
> https://lore.kernel.org/lkml/[email protected]/
>
> Cc: [email protected]
> Signed-off-by: Kars de Jong <[email protected]>

Thanks a lot!
Works fine on ARAnyM, too.

Looks good to me, but I'll wait a bit before applying, so the syscall experts
can chime in, if needed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-11-26 14:43:03

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On Mon, Nov 25, 2019 at 10:12:25AM +0100, Geert Uytterhoeven wrote:
> Hi Kars,
>
> On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > Wire up the clone3() syscall for m68k. The special entry point is done in
> > assembler as was done for clone() as well. This is needed because all
> > registers need to be saved. The C wrapper then calls the generic
> > sys_clone3() with the correct arguments.
> >
> > Tested on A1200 using the simple test program from:
> >
> > https://lore.kernel.org/lkml/[email protected]/

Please note that we now have a growing test-suite for the clone3()
syscall under
tools/testing/selftests/clone3/*

You can test on a suitable kernel with

make TARGETS=clone3 kselftest

> >
> > Cc: [email protected]
> > Signed-off-by: Kars de Jong <[email protected]>
>
> Thanks a lot!
> Works fine on ARAnyM, too.
>
> Looks good to me, but I'll wait a bit before applying, so the syscall experts
> can chime in, if needed.

Otherwise this looks good to me.
Thanks for moving this forward. One day we'll be able to remove
ARCH_WANT_SYS_CLONE3 completely. :)

Christian

2019-11-26 17:52:28

by Kars de Jong

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Christian!

Op di 26 nov. 2019 om 15:41 schreef Christian Brauner
<[email protected]>:
>
> On Mon, Nov 25, 2019 at 10:12:25AM +0100, Geert Uytterhoeven wrote:
> > Hi Kars,
> >
> > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > assembler as was done for clone() as well. This is needed because all
> > > registers need to be saved. The C wrapper then calls the generic
> > > sys_clone3() with the correct arguments.
> > >
> > > Tested on A1200 using the simple test program from:
> > >
> > > https://lore.kernel.org/lkml/[email protected]/
>
> Please note that we now have a growing test-suite for the clone3()
> syscall under
> tools/testing/selftests/clone3/*
>
> You can test on a suitable kernel with
>
> make TARGETS=clone3 kselftest

I'm afraid my user space is almost prehistoric. I have a homebrewn
root filesystem of about 2001 vintage, and another one with Debian
3.1.
So until I have bootstrapped a more recent one, I'll leave that to others ;-)

Thanks for checking!

Kind regards,

Kars.

2019-12-15 16:49:43

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Kars,

On Tue, Nov 26, 2019 at 4:29 PM Kars de Jong <[email protected]> wrote:
> Op di 26 nov. 2019 om 15:41 schreef Christian Brauner
> <[email protected]>:
> > On Mon, Nov 25, 2019 at 10:12:25AM +0100, Geert Uytterhoeven wrote:
> > > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > > assembler as was done for clone() as well. This is needed because all
> > > > registers need to be saved. The C wrapper then calls the generic
> > > > sys_clone3() with the correct arguments.
> > > >
> > > > Tested on A1200 using the simple test program from:
> > > >
> > > > https://lore.kernel.org/lkml/[email protected]/
> >
> > Please note that we now have a growing test-suite for the clone3()
> > syscall under
> > tools/testing/selftests/clone3/*
> >
> > You can test on a suitable kernel with
> >
> > make TARGETS=clone3 kselftest
>
> I'm afraid my user space is almost prehistoric. I have a homebrewn
> root filesystem of about 2001 vintage, and another one with Debian
> 3.1.
> So until I have bootstrapped a more recent one, I'll leave that to others ;-)

With Ubuntu's libc6-m68k-cross installed, the selftest binaries cross-build
fine. Running them on a very old Debian requires some hackery:

1. Copy ld.so.1, ld-2.27.so, libc.so.6, and libc-2.27.so from
/usr/m68k-linux-gnu/lib/ to /tmp/lib on the m68k target,
2. mkdir /tmp/proc && mount proc /tmp/proc -t proc,
3. chroot /tmp /tmp/<test-binary>.

Unfortunately some tests failed:

atari:~# chroot /tmp /tmp/clone3
# clone3() syscall supported
TAP version 13
1..17
# [825] Trying clone3() with flags 0 (size 0)
# I am the parent (825). My child's pid is 826
# I am the child, my PID is 826
# [825] clone3() with flags says: 0 expected 0
ok 1 [825] Result (0) matches expectation (0)
# [825] Trying clone3() with flags 0x20000000 (size 0)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected 0
not ok 2 [825] Result (-22) is different than expected (0)
# [825] Trying clone3() with flags 0 (size 64)
# I am the parent (825). My child's pid is 827
# I am the child, my PID is 827
# [825] clone3() with flags says: 0 expected 0
ok 3 [825] Result (0) matches expectation (0)
# [825] Trying clone3() with flags 0 (size 56)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 4 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0 (size 88)
# I am the parent (825). My child's pid is 828
# I am the child, my PID is 828
# [825] clone3() with flags says: 0 expected 0
ok 5 [825] Result (0) matches expectation (0)
# [825] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 6 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 7 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 8 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 9 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0 (size 88)
# I am the parent (825). My child's pid is 829
# I am the child, my PID is 829
# [825] clone3() with flags says: 0 expected 0
ok 10 [825] Result (0) matches expectation (0)
# [825] Trying clone3() with flags 0 (size 96)
# Argument list too long - Failed to create new process
# [825] clone3() with flags says: -7 expected -7
ok 11 [825] Result (-7) matches expectation (-7)
# [825] Trying clone3() with flags 0 (size 160)
# Argument list too long - Failed to create new process
# [825] clone3() with flags says: -7 expected -7
ok 12 [825] Result (-7) matches expectation (-7)
# [825] Trying clone3() with flags 0 (size 4104)
# Argument list too long - Failed to create new process
# [825] clone3() with flags says: -7 expected -7
ok 13 [825] Result (-7) matches expectation (-7)
# [825] Trying clone3() with flags 0x20000000 (size 64)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected 0
not ok 14 [825] Result (-22) is different than expected (0)
# [825] Trying clone3() with flags 0x20000000 (size 56)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected -22
ok 15 [825] Result (-22) matches expectation (-22)
# [825] Trying clone3() with flags 0x20000000 (size 88)
# Invalid argument - Failed to create new process
# [825] clone3() with flags says: -22 expected 0
not ok 16 [825] Result (-22) is different than expected (0)
# [825] Trying clone3() with flags 0x20000000 (size 4104)
# Argument list too long - Failed to create new process
# [825] clone3() with flags says: -7 expected -7
ok 17 [825] Result (-7) matches expectation (-7)
Bail out!
# Pass 14 Fail 3 Xfail 0 Xpass 0 Skip 0 Error 0
atari:~# chroot /tmp /tmp/clone3_set_tid
TAP version 13
# clone3() syscall supported
1..29
# /proc/sys/kernel/pid_max 32768
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 1 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 2 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 3 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 4 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 5 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 6 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 7 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 8 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 9 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 10 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 11 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 12 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 13 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to -1 and 0x20000000
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 14 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 1 and 0x0
# File exists - Failed to create new process
# [830] clone3() with CLONE_SET_TID 1 says :-17 - expected -17
ok 15 [830] Result (-17) matches expectation (-17)
# [830] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 1 says :-22 - expected 0
not ok 16 [830] Result (-22) is different than expected (0)
# [830] Trying clone3() with CLONE_SET_TID to 32768 and 0x0
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 32768 says :-22 - expected -22
ok 17 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 32768 and 0x20000000
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 32768 says :-22 - expected -22
ok 18 [830] Result (-22) matches expectation (-22)
# Child has PID 831
# [830] Trying clone3() with CLONE_SET_TID to 831 and 0x0
# I am the parent (830). My child's pid is 831
# I am the child, my PID is 831 (expected 831)
# [830] clone3() with CLONE_SET_TID 831 says :0 - expected 0
ok 19 [830] Result (0) matches expectation (0)
# [830] Trying clone3() with CLONE_SET_TID to 831 and 0x20000000
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 831 says :-22 - expected -22
ok 20 [830] Result (-22) matches expectation (-22)
# [830] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# Invalid argument - Failed to create new process
# [830] clone3() with CLONE_SET_TID 1 says :-22 - expected 0
not ok 21 [830] Result (-22) is different than expected (0)
# unshare PID namespace
Bail out! unshare(CLONE_NEWPID) failed: Invalid argument
# Planned tests != run tests (29 != 21)
# Pass 19 Fail 2 Xfail 0 Xpass 0 Skip 0 Error 0
atari:~# chroot /tmp /tmp/clone3_clear_sighand
TAP version 13
# clone3() syscall supported
1..1
Bail out! Failed to clear signal handler for child process
# Planned tests != run tests (1 != 0)
# Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
atari:~#

So this needs a bit more work?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On 12/15/19 5:48 PM, Geert Uytterhoeven wrote:
> With Ubuntu's libc6-m68k-cross installed, the selftest binaries cross-build
> fine. Running them on a very old Debian requires some hackery:
>
> 1. Copy ld.so.1, ld-2.27.so, libc.so.6, and libc-2.27.so from
> /usr/m68k-linux-gnu/lib/ to /tmp/lib on the m68k target,
> 2. mkdir /tmp/proc && mount proc /tmp/proc -t proc,
> 3. chroot /tmp /tmp/<test-binary>.
Why not use a recent environment?

> https://wiki.debian.org/M68k/QemuSystemM68k

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2019-12-15 20:08:40

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Adrian,

On Sun, Dec 15, 2019 at 6:01 PM John Paul Adrian Glaubitz
<[email protected]> wrote:
> On 12/15/19 5:48 PM, Geert Uytterhoeven wrote:
> > With Ubuntu's libc6-m68k-cross installed, the selftest binaries cross-build
> > fine. Running them on a very old Debian requires some hackery:
> >
> > 1. Copy ld.so.1, ld-2.27.so, libc.so.6, and libc-2.27.so from
> > /usr/m68k-linux-gnu/lib/ to /tmp/lib on the m68k target,
> > 2. mkdir /tmp/proc && mount proc /tmp/proc -t proc,
> > 3. chroot /tmp /tmp/<test-binary>.
> Why not use a recent environment?
>
> > https://wiki.debian.org/M68k/QemuSystemM68k

Yeah, I will give that a try... one day...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2020-01-12 16:11:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> Wire up the clone3() syscall for m68k. The special entry point is done in
> assembler as was done for clone() as well. This is needed because all
> registers need to be saved. The C wrapper then calls the generic
> sys_clone3() with the correct arguments.
>
> Tested on A1200 using the simple test program from:
>
> https://lore.kernel.org/lkml/[email protected]/
>
> Cc: [email protected]
> Signed-off-by: Kars de Jong <[email protected]>

Thanks, applied and queued for v5.6.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2020-01-13 09:12:47

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On Sun, Jan 12, 2020 at 5:06 PM Geert Uytterhoeven <[email protected]> wrote:
> On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > Wire up the clone3() syscall for m68k. The special entry point is done in
> > assembler as was done for clone() as well. This is needed because all
> > registers need to be saved. The C wrapper then calls the generic
> > sys_clone3() with the correct arguments.
> >
> > Tested on A1200 using the simple test program from:
> >
> > https://lore.kernel.org/lkml/[email protected]/
> >
> > Cc: [email protected]
> > Signed-off-by: Kars de Jong <[email protected]>
>
> Thanks, applied and queued for v5.6.

Which is now broken because of commit dd499f7a7e342702 ("clone3: ensure
copy_thread_tls is implemented") in v5.5-rc6 :-(

BTW, was this the reason for the failures at the end of
https://lore.kernel.org/lkml/CACz-3rhmUfxbfhznvA6NOF69SR49NDZwnkZ=Bmhw_cf4SkiadQ@mail.gmail.com/?

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2020-01-13 09:20:27

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On Mon, Jan 13, 2020 at 10:10:26AM +0100, Geert Uytterhoeven wrote:
> On Sun, Jan 12, 2020 at 5:06 PM Geert Uytterhoeven <[email protected]> wrote:
> > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > assembler as was done for clone() as well. This is needed because all
> > > registers need to be saved. The C wrapper then calls the generic
> > > sys_clone3() with the correct arguments.
> > >
> > > Tested on A1200 using the simple test program from:
> > >
> > > https://lore.kernel.org/lkml/[email protected]/
> > >
> > > Cc: [email protected]
> > > Signed-off-by: Kars de Jong <[email protected]>
> >
> > Thanks, applied and queued for v5.6.
>
> Which is now broken because of commit dd499f7a7e342702 ("clone3: ensure
> copy_thread_tls is implemented") in v5.5-rc6 :-(

Sorry, just for clarification what and how is it broken by
dd499f7a7e342702 ("clone3: ensure > copy_thread_tls is implemented")
?

>
> BTW, was this the reason for the failures at the end of
> https://lore.kernel.org/lkml/CACz-3rhmUfxbfhznvA6NOF69SR49NDZwnkZ=Bmhw_cf4SkiadQ@mail.gmail.com/?

Unlikely since CLONE_SETTLS is currently not covered by the
clone3()/process creation test suite because it is highly arch
dependent on how to retrieve the tls pointer. But we're going to add
tests soon I hope.

Thanks!
Christian

2020-01-13 09:36:53

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Christian,

On Mon, Jan 13, 2020 at 10:18 AM Christian Brauner
<[email protected]> wrote:
> On Mon, Jan 13, 2020 at 10:10:26AM +0100, Geert Uytterhoeven wrote:
> > On Sun, Jan 12, 2020 at 5:06 PM Geert Uytterhoeven <[email protected]> wrote:
> > > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > > assembler as was done for clone() as well. This is needed because all
> > > > registers need to be saved. The C wrapper then calls the generic
> > > > sys_clone3() with the correct arguments.
> > > >
> > > > Tested on A1200 using the simple test program from:
> > > >
> > > > https://lore.kernel.org/lkml/[email protected]/
> > > >
> > > > Cc: [email protected]
> > > > Signed-off-by: Kars de Jong <[email protected]>
> > >
> > > Thanks, applied and queued for v5.6.
> >
> > Which is now broken because of commit dd499f7a7e342702 ("clone3: ensure
> > copy_thread_tls is implemented") in v5.5-rc6 :-(
>
> Sorry, just for clarification what and how is it broken by
> dd499f7a7e342702 ("clone3: ensure > copy_thread_tls is implemented")
> ?

Because m68k does not implement copy_thread_tls() yet, and doesn't
select HAVE_COPY_THREAD_TLS yet.

Looking into fixing that...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2020-01-13 10:18:41

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

On Mon, Jan 13, 2020 at 10:34:35AM +0100, Geert Uytterhoeven wrote:
> Hi Christian,
>
> On Mon, Jan 13, 2020 at 10:18 AM Christian Brauner
> <[email protected]> wrote:
> > On Mon, Jan 13, 2020 at 10:10:26AM +0100, Geert Uytterhoeven wrote:
> > > On Sun, Jan 12, 2020 at 5:06 PM Geert Uytterhoeven <[email protected]> wrote:
> > > > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > > > assembler as was done for clone() as well. This is needed because all
> > > > > registers need to be saved. The C wrapper then calls the generic
> > > > > sys_clone3() with the correct arguments.
> > > > >
> > > > > Tested on A1200 using the simple test program from:
> > > > >
> > > > > https://lore.kernel.org/lkml/[email protected]/
> > > > >
> > > > > Cc: [email protected]
> > > > > Signed-off-by: Kars de Jong <[email protected]>
> > > >
> > > > Thanks, applied and queued for v5.6.
> > >
> > > Which is now broken because of commit dd499f7a7e342702 ("clone3: ensure
> > > copy_thread_tls is implemented") in v5.5-rc6 :-(
> >
> > Sorry, just for clarification what and how is it broken by
> > dd499f7a7e342702 ("clone3: ensure > copy_thread_tls is implemented")
> > ?
>
> Because m68k does not implement copy_thread_tls() yet, and doesn't
> select HAVE_COPY_THREAD_TLS yet.

Oh right, sorry. I forgot that m68k has a patchset to enable clone3() up
for merging. I should've remembered that and warned you that we will
have to require copy_thread_tls() going forward. I hope the merge is
explanatory enough why we're doing it this way.

>
> Looking into fixing that...

Thank you! Much appreciated!
Christian

2020-01-13 10:32:55

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] m68k: Wire up clone3() syscall

Hi Christian,

On Mon, Jan 13, 2020 at 11:18 AM Christian Brauner
<[email protected]> wrote:
> On Mon, Jan 13, 2020 at 10:34:35AM +0100, Geert Uytterhoeven wrote:
> > On Mon, Jan 13, 2020 at 10:18 AM Christian Brauner
> > <[email protected]> wrote:
> > > On Mon, Jan 13, 2020 at 10:10:26AM +0100, Geert Uytterhoeven wrote:
> > > > On Sun, Jan 12, 2020 at 5:06 PM Geert Uytterhoeven <[email protected]> wrote:
> > > > > On Sun, Nov 24, 2019 at 8:52 PM Kars de Jong <[email protected]> wrote:
> > > > > > Wire up the clone3() syscall for m68k. The special entry point is done in
> > > > > > assembler as was done for clone() as well. This is needed because all
> > > > > > registers need to be saved. The C wrapper then calls the generic
> > > > > > sys_clone3() with the correct arguments.
> > > > > >
> > > > > > Tested on A1200 using the simple test program from:
> > > > > >
> > > > > > https://lore.kernel.org/lkml/[email protected]/
> > > > > >
> > > > > > Cc: [email protected]
> > > > > > Signed-off-by: Kars de Jong <[email protected]>
> > > > >
> > > > > Thanks, applied and queued for v5.6.
> > > >
> > > > Which is now broken because of commit dd499f7a7e342702 ("clone3: ensure
> > > > copy_thread_tls is implemented") in v5.5-rc6 :-(
> > >
> > > Sorry, just for clarification what and how is it broken by
> > > dd499f7a7e342702 ("clone3: ensure > copy_thread_tls is implemented")
> > > ?
> >
> > Because m68k does not implement copy_thread_tls() yet, and doesn't
> > select HAVE_COPY_THREAD_TLS yet.
>
> Oh right, sorry. I forgot that m68k has a patchset to enable clone3() up
> for merging. I should've remembered that and warned you that we will
> have to require copy_thread_tls() going forward. I hope the merge is
> explanatory enough why we're doing it this way.

Yeah, an early warning would have been nice...

> > Looking into fixing that...
>
> Thank you! Much appreciated!

Patch sent.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds