diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c index 4b12e020e2..83d47d62b0 100644 --- a/src/test/test-namespace.c +++ b/src/test/test-namespace.c @@ -1,8 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include #include #include +#include #include #include #include @@ -311,6 +313,10 @@ TEST(process_is_owned_by_uid) { if (r == 0) { p[0] = safe_close(p[0]); ASSERT_OK(fully_set_uid_gid(1, 1, NULL, 0)); + + /* After successfully changing id/gid DEATHSIG is reset, so it has to be set again */ + ASSERT_OK_ERRNO(prctl(PR_SET_PDEATHSIG, SIGKILL)); + ASSERT_OK_EQ_ERRNO(write(p[1], &(const char[]) { 'x' }, 1), 1); p[1] = safe_close(p[1]); freeze(); @@ -346,6 +352,9 @@ TEST(process_is_owned_by_uid) { ASSERT_OK(reset_uid_gid()); + /* After successfully changing id/gid DEATHSIG is reset, so it has to be set again */ + ASSERT_OK_ERRNO(prctl(PR_SET_PDEATHSIG, SIGKILL)); + ASSERT_OK_EQ_ERRNO(write(p[1], &(const char[]) { 'x' }, 1), 1); p[1] = safe_close(p[1]); freeze(); @@ -425,7 +434,7 @@ TEST(namespace_get_leader) { } TEST(detach_mount_namespace_harder) { - _cleanup_(pidref_done) PidRef pid = PIDREF_NULL; + _cleanup_(pidref_done_sigkill_wait) PidRef pid = PIDREF_NULL; _cleanup_close_pair_ int p[2] = EBADF_PAIR; char x = 0; int r;