selftests: add tests for clone3()
PATCH v4 1/1 selftests: add tests for clone3()
This adds tests for clone3() with different values and sizes of struct clone_args.
This selftest was initially part of of the clone3() with PID selftest. After that patch was almost merged Eugene sent out a couple of patches to fix problems with these test.
This commit now only contains the clone3() selftest after the LPC decision to rework clone3() with PID to allow setting the PID in multiple PID namespaces including all of Eugene's patches.
---
v2:
- Applied Christian's suggestions
- Skip root-only tests when running as non-root
v3:
- Removed unnecessary test case (everything set to 1)
- Correctly handle children without SIGCHLD
v4:
- Small cosmetic fixes
- Added two more tests with different sizes
--- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/clone3/.gitignore | 1 + tools/testing/selftests/clone3/Makefile | 7 + tools/testing/selftests/clone3/clone3.c | 205 ++++++++++++++++++++++ 5 files changed, 215 insertions(+) create mode 100644 tools/testing/selftests/clone3/.gitignore create mode 100644 tools/testing/selftests/clone3/Makefile create mode 100644 tools/testing/selftests/clone3/clone3.c
MAINTAINERS +1 -0
@@ -12833,6 +12833,7 @@ S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git F: samples/pidfd/ F: tools/testing/selftests/pidfd/ +F: tools/testing/selftests/clone3/ K: (?i)pidfd K: (?i)clone3 K: \b(clone_args|kernel_clone_args)\b
tools/testing/selftests/Makefile +1 -0
@@ -4,6 +4,7 @@ TARGETS += bpf TARGETS += breakpoints TARGETS += capabilities TARGETS += cgroup +TARGETS += clone3 TARGETS += cpufreq TARGETS += cpu-hotplug TARGETS += drivers/dma-buf
tools/testing/selftests/clone3/.gitignore new file +1 -0
@@ -0,0 +1 @@ +clone3
tools/testing/selftests/clone3/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +CFLAGS += -I../../../../usr/include/ + +TEST_GEN_PROGS := clone3 + +include ../lib.mk
tools/testing/selftests/clone3/clone3.c new file +205 -0
205 lines not on this page · raw message
Signature · 1 line
2.23.0
Quoted 7 lines · Adrian Reber
This adds tests for
clone3()with different values and sizes of structclone_args.This selftest was initially part of of the
clone3()with PID selftest. After that patch was almost merged Eugene sent out a couple of patches to fix problems with these test.
Quoted 6 lines
This commit now only contains the
clone3()selftest after the LPC decision to reworkclone3()with PID to allow setting the PID in multiple PID namespaces including all of Eugene's patches.Signed-off-by Eugene Syromiatnikov <[email protected]>Signed-off-by Adrian Reber <[email protected]>
Queuing up for 5.5.
Thanks, Adrian!
Quoted 12 lines · Christian Brauner
Quoted 11 lines · Adrian Reber
This adds tests for
clone3()with different values and sizes of structclone_args.This selftest was initially part of of the
clone3()with PID selftest. After that patch was almost merged Eugene sent out a couple of patches to fix problems with these test.This commit now only contains the
clone3()selftest after the LPC decision to reworkclone3()with PID to allow setting the PID in multiple PID namespaces including all of Eugene's patches.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Eugene Syromiatnikov <[email protected]>Signed-off-by Adrian Reber <[email protected]>Queuing up for 5.5.
Thanks, Adrian!Reviewed-by Christian Brauner <[email protected]>
One thing, can you tell me what the base tree for your commit is, please? Given that this is just one commit it should be enough if you give me the "base-commit" line from the end of the patch created via:
git format-patch --base=HEAD~1 HEAD~1
Thanks!
Christian
Quoted 19 lines · Christian Brauner
Quoted 18 lines · Christian Brauner
Quoted 7 lines · Adrian Reber
This adds tests for
clone3()with different values and sizes of structclone_args.This selftest was initially part of of the
clone3()with PID selftest. After that patch was almost merged Eugene sent out a couple of patches to fix problems with these test.Quoted 6 lines
This commit now only contains the
clone3()selftest after the LPC decision to reworkclone3()with PID to allow setting the PID in multiple PID namespaces including all of Eugene's patches.Signed-off-by Eugene Syromiatnikov <[email protected]>Signed-off-by Adrian Reber <[email protected]>Queuing up for 5.5.
Thanks, Adrian!
Quoted 6 lines
Quoted 1 line
Reviewed-by Christian Brauner <[email protected]>One thing, can you tell me what the base tree for your commit is, please? Given that this is just one commit it should be enough if you give me the "base-commit" line from the end of the patch created via:
git format-patch --base=HEAD~1 HEAD~1
Ok, merge base commit seems to have been v5.4-rc7. I've resolved a minor merge conflict (cf. [2]) when applying this commit to [1].
Christian
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=pidfd
[2]:
tools/testing/selftests/clone3/.gitignore +0 -0
@@@ -1,1 -1,1 +1,2 @@@ + clone3 +clone3_clear_sighand
tools/testing/selftests/clone3/Makefile +0 -0
@@@ -1,6 -1,7 +1,6 @@@ - # SPDX-License-Identifier: GPL-2.0-only + # SPDX-License-Identifier: GPL-2.0 +CFLAGS += -g -I../../../../usr/include/
- TEST_GEN_PROGS := clone3_clear_sighand
-CFLAGS += -I../../../../usr/include/
-
-TEST_GEN_PROGS := clone3
++TEST_GEN_PROGS := clone3 clone3_clear_sighand
include ../lib.mk