Skip to content

Commit abdd947

Browse files
committed
test-fd-util: skip test when lacking privileges to create a new namespace
To reproduce, as an unprivileged user start a docker container and build and run the unit tests inside it: $ docker run --rm -ti debian:bookworm bash ... /* test_close_all_fds */ Successfully forked off '(caf-plain)' as PID 10496. Skipping PR_SET_MM, as we don't have privileges. (caf-plain) succeeded. Failed to fork off '(caf-noproc)': Operation not permitted Assertion 'r >= 0' failed at src/test/test-fd-util.c:392, function test_close_all_fds(). Aborting. Partially fixes #35552 (cherry picked from commit 630a2e7) (cherry picked from commit 5573ac7) (cherry picked from commit b8c8556) (cherry picked from commit 9818f55) (cherry picked from commit dcdd4a6) (cherry picked from commit c40e1d5)
1 parent 7905fc7 commit abdd947

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/test/test-fd-util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ TEST(close_all_fds) {
347347
test_close_all_fds_inner();
348348
_exit(EXIT_SUCCESS);
349349
}
350+
if (ERRNO_IS_PRIVILEGE(r))
351+
return (void) log_tests_skipped("Lacking privileges for test in namespace with /proc/ overmounted");
350352
assert_se(r >= 0);
351353

352354
if (!is_seccomp_available()) {

0 commit comments

Comments
 (0)