Skip to contentSkip to conversation

m68k: Wire up clone3() syscall

PATCH Applied Kars de Jong 4 participants 15 messages Nov 24, 2019 – Jan 13, 2020 m68k architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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]/

---
 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(-)
arch/m68k/include/asm/unistd.h +1 -0
index 2e0047cf86f8..4ae52414cd9d 100644
@@ -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_ */
arch/m68k/kernel/entry.S +7 -0
index 97cd3ea5f10b..9dd76fbb7c6b 100644
@@ -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
arch/m68k/kernel/process.c +12 -1
index 4e77a06735c1..22e6b8f4f958 100644
@@ -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)
 {
arch/m68k/kernel/syscalls/syscall.tbl +1 -1
index a88a285a0e5f..a00a5d0db602 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw

Hi Kars,

Quoted 11 lines · Kars de Jong

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]/

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

Signature · 5 lines
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
#2 lore raw
Quoted 11 lines · Geert Uytterhoeven

Hi Kars,

Quoted 8 lines · Kars de Jong

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

Quoted 9 lines
Quoted 3 lines

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

#3 lore raw

Hi Christian!

Op di 26 nov. 2019 om 15:41 schreef Christian Brauner <[email protected]>:

Quoted 14 lines · Geert Uytterhoeven
Quoted 11 lines

Hi Kars,

Quoted 8 lines · Kars de Jong

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]/

Quoted 7 lines

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.

#4 lore raw

Hi Kars,

Quoted 17 lines · Kars de Jong

Op di 26 nov. 2019 om 15:41 schreef Christian Brauner <[email protected]>:

Quoted 15 lines · Geert Uytterhoeven
Quoted 9 lines · Kars de Jong
Quoted 8 lines

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/*

Quoted 8 lines
Quoted 3 lines

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

Signature · 5 lines
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
#5 lore raw
Quoted 7 lines · Geert Uytterhoeven

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?

Quoted 1 line

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

Adrian

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

Hi Adrian,

Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 7 lines · Geert Uytterhoeven

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?

Quoted 1 line

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

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

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
#7 lore raw
In reply to Geert Uytterhoeven
Quoted 32 lines · Geert Uytterhoeven

Hi Kars,

Quoted 17 lines · Kars de Jong

Op di 26 nov. 2019 om 15:41 schreef Christian Brauner <[email protected]>:

Quoted 15 lines · Geert Uytterhoeven
Quoted 9 lines · Kars de Jong
Quoted 8 lines

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/*

Quoted 8 lines
Quoted 3 lines

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:

Quoted 6 lines

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:

Thanks for going through the trouble of testing this, Geert! Christian

#8 lore raw
In reply to Geert Uytterhoeven

Hi Geert!

Op zo 15 dec. 2019 om 17:48 schreef Geert Uytterhoeven <[email protected]>:

Quoted 72 lines

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
Quoted 8 lines
# [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

I created a new environment as described by Adrian (thanks!), built a 5.5.0-rc2 kernel based on Debian config-5.3.0-3-m68k, and ran these tests too:

kars@q800:/$ sudo ./clone3
# clone3() syscall supported
TAP version 13
1..17
# [406] Trying clone3() with flags 0 (size 0)
# I am the parent (406). My child's pid is 407
# [406] clone3() with flags says: 0 expected 0
ok 1 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0x20000000 (size 0)
# I am the parent (406). My child's pid is 408
# [406] clone3() with flags says: 0 expected 0
ok 2 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0 (size 64)
# I am the parent (406). My child's pid is 409
# [406] clone3() with flags says: 0 expected 0
ok 3 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0 (size 56)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 4 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0 (size 88)
# I am the parent (406). My child's pid is 410
# [406] clone3() with flags says: 0 expected 0
ok 5 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 6 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 7 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 8 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0 (size 0)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 9 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0 (size 88)
# I am the parent (406). My child's pid is 411
# [406] clone3() with flags says: 0 expected 0
ok 10 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0 (size 96)
# Argument list too long - Failed to create new process
# [406] clone3() with flags says: -7 expected -7
ok 11 [406] Result (-7) matches expectation (-7)
# [406] Trying clone3() with flags 0 (size 160)
# Argument list too long - Failed to create new process
# [406] clone3() with flags says: -7 expected -7
ok 12 [406] Result (-7) matches expectation (-7)
# [406] Trying clone3() with flags 0 (size 4104)
# Argument list too long - Failed to create new process
# [406] clone3() with flags says: -7 expected -7
ok 13 [406] Result (-7) matches expectation (-7)
# [406] Trying clone3() with flags 0x20000000 (size 64)
# I am the parent (406). My child's pid is 412
# [406] clone3() with flags says: 0 expected 0
ok 14 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0x20000000 (size 56)
# Invalid argument - Failed to create new process
# [406] clone3() with flags says: -22 expected -22
ok 15 [406] Result (-22) matches expectation (-22)
# [406] Trying clone3() with flags 0x20000000 (size 88)
# I am the parent (406). My child's pid is 413
# [406] clone3() with flags says: 0 expected 0
ok 16 [406] Result (0) matches expectation (0)
# [406] Trying clone3() with flags 0x20000000 (size 4104)
# Argument list too long - Failed to create new process
# [406] clone3() with flags says: -7 expected -7
ok 17 [406] Result (-7) matches expectation (-7)
# Pass 17 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

So that works OK.

Quoted 87 lines
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)
Quoted 8 lines
# [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
kars@q800:/$ sudo ./clone3_set_tid
TAP version 13
# clone3() syscall supported
1..29
# /proc/sys/kernel/pid_max 32768
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 1 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 2 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 3 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 4 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 5 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 6 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 7 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 8 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 9 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 10 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 0 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 0 says :-22 - expected -22
ok 11 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 12 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 13 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to -1 and 0x20000000
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID -1 says :-22 - expected -22
ok 14 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 1 and 0x0
# File exists - Failed to create new process
# [435] clone3() with CLONE_SET_TID 1 says :-17 - expected -17
ok 15 [435] Result (-17) matches expectation (-17)
# [435] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# I am the child, my PID is 1 (expected 1)
# I am the parent (435). My child's pid is 436
# [435] clone3() with CLONE_SET_TID 1 says :0 - expected 0
ok 16 [435] Result (0) matches expectation (0)
# [435] Trying clone3() with CLONE_SET_TID to 32768 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 32768 says :-22 - expected -22
ok 17 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 32768 and 0x20000000
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 32768 says :-22 - expected -22
ok 18 [435] Result (-22) matches expectation (-22)
# Child has PID 437
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 32768 says :-22 - expected -22
ok 18 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 437 and 0x0
# I am the child, my PID is 437 (expected 437)
# I am the parent (435). My child's pid is 437
# [435] clone3() with CLONE_SET_TID 437 says :0 - expected 0
ok 19 [435] Result (0) matches expectation (0)
# [435] Trying clone3() with CLONE_SET_TID to 437 and 0x20000000
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 437 says :-22 - expected -22
ok 20 [435] Result (-22) matches expectation (-22)
# [435] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# I am the child, my PID is 1 (expected 1)
# I am the parent (435). My child's pid is 437
# [435] clone3() with CLONE_SET_TID 1 says :0 - expected 0
ok 21 [435] Result (0) matches expectation (0)
# unshare PID namespace
# [435] Trying clone3() with CLONE_SET_TID to 437 and 0x0
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 437 says :-22 - expected -22
ok 22 [435] Result (-22) matches expectation (-22)
# [1] Trying clone3() with CLONE_SET_TID to 43 and 0x0
# Invalid argument - Failed to create new process
# [1] clone3() with CLONE_SET_TID 43 says :-22 - expected -22
ok 23 [1] Result (-22) matches expectation (-22)
# [1] Trying clone3() with CLONE_SET_TID to 43 and 0x0
# I am the child, my PID is 43 (expected 43)
# I am the parent (1). My child's pid is 43
# [1] clone3() with CLONE_SET_TID 43 says :0 - expected 0
ok 24 [1] Result (0) matches expectation (0)
# Child in PID namespace has PID 1
# [1] Trying clone3() with CLONE_SET_TID to 2 and 0x0
# I am the child, my PID is 2 (expected 2)
# I am the parent (1). My child's pid is 2
# [1] clone3() with CLONE_SET_TID 2 says :0 - expected 0
ok 25 [1] Result (0) matches expectation (0)
# [1] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# Invalid argument - Failed to create new process
# [1] clone3() with CLONE_SET_TID 1 says :-22 - expected -22
ok 26 [1] Result (-22) matches expectation (-22)
# [1] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# Invalid argument - Failed to create new process
# [1] clone3() with CLONE_SET_TID 1 says :-22 - expected -22
ok 27 [1] Result (-22) matches expectation (-22)
# [1] Trying clone3() with CLONE_SET_TID to 1 and 0x20000000
# I am the child, my PID is 1 (expected 1)
# [1] Child is ready and waiting
# I am the parent (1). My child's pid is 42
# [1] clone3() with CLONE_SET_TID 1 says :0 - expected 0
ok 28 [1] Result (0) matches expectation (0)
# Invalid argument - Failed to create new process
# [435] clone3() with CLONE_SET_TID 437 says :-22 - expected -22
ok 22 [435] Result (-22) matches expectation (-22)
# [435] Child is ready and waiting
ok 29 PIDs in all namespaces as expected (437,42,1)
# Pass 29 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

So those all pass too. Maybe your kernel configuration is not suited for these tests (in which case I would expect them to fail at compile time by the way, the test should assert that).

Quoted 8 lines
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:~#

That one fails the same way for me, but I don't think this is actually a problem with the wiring up of the system call.
I tried debugging it, the child process exits at line 99 (the check whether the SIGUSR1 signal handler is indeed cleared in the child):

94 ret = sigaction(SIGUSR1, NULL, &act);
95 if (ret < 0)
96 exit(EXIT_FAILURE);
97
98 if (act.sa_handler != SIG_DFL)
99 exit(EXIT_FAILURE); <--- failure point

Oh, I did have problems with gdb and the 'next' and 'nexti' commands, they did not quite stop where I expected them too, they stopped somewhere in libc assembly instead.
But that's probably unrelated.

Kind regards,

Kars.

maintainer Applied
#9 lore raw
In reply to Kars de Jong
Quoted 11 lines · Kars de Jong

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]/

Thanks, applied and queued for v5.6.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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
#10 lore raw
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · Kars de Jong

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.

Quoted 8 lines
Quoted 6 lines

Tested on A1200 using the simple test program from:

https://lore.kernel.org/lkml/[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

Signature · 5 lines
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
#11 lore raw
Quoted 11 lines · Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven
Quoted 9 lines · Kars de Jong

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]/

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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") ?

Quoted 3 lines

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

#12 lore raw

Hi Christian,

Quoted 15 lines · Christian Brauner
Quoted 14 lines · Geert Uytterhoeven
Quoted 13 lines · Geert Uytterhoeven
Quoted 11 lines · Kars de Jong

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]/

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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

Signature · 5 lines
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
#13 lore raw
Quoted 24 lines · Geert Uytterhoeven

Hi Christian,

Quoted 20 lines · Christian Brauner
Quoted 18 lines · Geert Uytterhoeven
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · Kars de Jong

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.

Quoted 8 lines
Quoted 6 lines

Tested on A1200 using the simple test program from:

https://lore.kernel.org/lkml/[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 :-(

Quoted 6 lines
Quoted 3 lines

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.

Quoted 2 lines

Looking into fixing that...

Thank you! Much appreciated!
Christian

#14 lore raw

Hi Christian,

Quoted 27 lines · Christian Brauner
Quoted 26 lines · Geert Uytterhoeven
Quoted 23 lines · Christian Brauner
Quoted 11 lines · Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven
Quoted 9 lines · Kars de Jong

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]/

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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") ?

Quoted 7 lines
Quoted 2 lines

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...

Quoted 3 lines
Quoted 1 line

Looking into fixing that...

Thank you! Much appreciated!

Patch sent.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
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