selftests: add clone3() CAP_CHECKPOINT_RESTORE test
authorAdrian Reber <areber@redhat.com>
Sun, 19 Jul 2020 10:04:17 +0000 (12:04 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 20 Jul 2020 13:47:42 +0000 (15:47 +0200)
commit1d27a0be16d6c95fd71deef34e94b40cb4411cc9
treeb131cf0df8e2aeab5231f67e97430b1f95e666ee
parent227175b2c914bfa4a9aa5b210c7cabd42c5858ac
selftests: add clone3() CAP_CHECKPOINT_RESTORE test

This adds a test that changes its UID, uses capabilities to
get CAP_CHECKPOINT_RESTORE and uses clone3() with set_tid to
create a process with a given PID as non-root.

Signed-off-by: Adrian Reber <areber@redhat.com>
Link: https://lore.kernel.org/r/20200719100418.2112740-8-areber@redhat.com
[christian.brauner@ubuntu.com: use TH_LOG() instead of ksft_print_msg()]
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
tools/testing/selftests/clone3/.gitignore
tools/testing/selftests/clone3/Makefile
tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c [new file with mode: 0644]