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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert!

Op zo 15 dec. 2019 om 17:48 schreef Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>:
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

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.

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

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

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.



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux