Skip to content

Commit 2b40c5d

Browse files
author
Christian Brauner
committed
selftests/pidfd: add pidfd setns tests
This is basically a test-suite for setns() and as of now contains: - test that we can't pass garbage flags - test that we can't attach to the namespaces of task that has already exited - test that we can incrementally setns into all namespaces of a target task using a pidfd - test that we can setns atomically into all namespaces of a target task - test that we can't cross setns into a user namespace outside of our user namespace hierarchy - test that we can't setns into namespaces owned by user namespaces over which we are not privileged Signed-off-by: Christian Brauner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 303cc57 commit 2b40c5d

File tree

4 files changed

+482
-1
lines changed

4 files changed

+482
-1
lines changed

tools/testing/selftests/pidfd/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pidfd_test
55
pidfd_wait
66
pidfd_fdinfo_test
77
pidfd_getfd_test
8+
pidfd_setns_test
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
CFLAGS += -g -I../../../../usr/include/ -pthread
33

4-
TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test pidfd_poll_test pidfd_wait pidfd_getfd_test
4+
TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
5+
pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
56

67
include ../lib.mk
78

tools/testing/selftests/pidfd/config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CONFIG_UTS_NS=y
2+
CONFIG_IPC_NS=y
3+
CONFIG_USER_NS=y
4+
CONFIG_PID_NS=y
5+
CONFIG_NET_NS=y
6+
CONFIG_CGROUPS=y

0 commit comments

Comments
 (0)