selftests: add tests for clone3() with *set_tid
This tests clone3() with *set_tid to see if all desired PIDs are working as expected. The tests are trying multiple invalid input parameters as well as creating processes while specifying a certain PID in multiple PID namespaces at the same time. Additionally this moves common clone3() test code into clone3_selftests.h. Signed-off-by: Adrian Reber <areber@redhat.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Link: https://lore.kernel.org/r/20191115123621.142252-2-areber@redhat.com Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:

committed by
Christian Brauner

parent
49cb2fc42c
commit
41585bbeee
@@ -18,6 +18,7 @@
|
||||
#include <sched.h>
|
||||
|
||||
#include "../kselftest.h"
|
||||
#include "clone3_selftests.h"
|
||||
|
||||
/*
|
||||
* Different sizes of struct clone_args
|
||||
@@ -35,11 +36,6 @@ enum test_mode {
|
||||
CLONE3_ARGS_INVAL_EXIT_SIGNAL_NSIG,
|
||||
};
|
||||
|
||||
static pid_t raw_clone(struct clone_args *args, size_t size)
|
||||
{
|
||||
return syscall(__NR_clone3, args, size);
|
||||
}
|
||||
|
||||
static int call_clone3(uint64_t flags, size_t size, enum test_mode test_mode)
|
||||
{
|
||||
struct clone_args args = {
|
||||
@@ -83,7 +79,7 @@ static int call_clone3(uint64_t flags, size_t size, enum test_mode test_mode)
|
||||
|
||||
memcpy(&args_ext.args, &args, sizeof(struct clone_args));
|
||||
|
||||
pid = raw_clone((struct clone_args *)&args_ext, size);
|
||||
pid = sys_clone3((struct clone_args *)&args_ext, size);
|
||||
if (pid < 0) {
|
||||
ksft_print_msg("%s - Failed to create new process\n",
|
||||
strerror(errno));
|
||||
|
Reference in New Issue
Block a user