From a6adc4c280a1b6352ca7a92eaca5bcb87099e44c Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 25 Oct 2024 11:46:38 -0700 Subject: [PATCH] [test] Revert "libct/nsenter: become root after joining userns" Checking if the test case (commit 34a92855) actually works in our CI. This reverts commit c78f3f2ea0f732a4d95c54b4cfc1c237713dbf4d. --- libcontainer/nsenter/nsexec.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libcontainer/nsenter/nsexec.c b/libcontainer/nsenter/nsexec.c index 565b2ca2030..74e15b96d5f 100644 --- a/libcontainer/nsenter/nsexec.c +++ b/libcontainer/nsenter/nsexec.c @@ -505,17 +505,6 @@ void join_namespaces(char *nslist) if (setns(ns->fd, flag) < 0) bail("failed to setns into %s namespace", ns->type); - /* - * If we change user namespaces, make sure we switch to root in the - * namespace (this matches the logic for unshare(CLONE_NEWUSER)), lots - * of things can break if we aren't the right user. See - * for one example. - */ - if (flag == CLONE_NEWUSER) { - if (setresuid(0, 0, 0) < 0) - bail("failed to become root in user namespace"); - } - close(ns->fd); }