Skip to content

Commit

Permalink
selftests/pidfd: add pidfd setns tests
Browse files Browse the repository at this point in the history
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 <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20200505140432.181565-4-christian.brauner@ubuntu.com
  • Loading branch information
Christian Brauner committed May 13, 2020
1 parent 303cc57 commit 2b40c5d
Show file tree
Hide file tree
Showing 4 changed files with 482 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/testing/selftests/pidfd/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pidfd_test
pidfd_wait
pidfd_fdinfo_test
pidfd_getfd_test
pidfd_setns_test
3 changes: 2 additions & 1 deletion tools/testing/selftests/pidfd/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
CFLAGS += -g -I../../../../usr/include/ -pthread

TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test pidfd_poll_test pidfd_wait pidfd_getfd_test
TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \
pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test

include ../lib.mk

6 changes: 6 additions & 0 deletions tools/testing/selftests/pidfd/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_CGROUPS=y
Loading

0 comments on commit 2b40c5d

Please sign in to comment.