commit c5396f3a84e5fb7d998073b11f93317e735d76b4
parent e081f53728c208a2537a1fe96cdfb18b570614bc
Author: Jan Pobříslo <ccx@te2000.cz>
Date: Thu, 22 Feb 2024 08:34:16 +0100
Try to setuid() ourselves to get valid uid
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/userns_sandbox.py b/userns_sandbox.py
@@ -206,6 +206,8 @@ def pidns_run(unshare_flags, continuation, *args, **kwargs):
nonblock_cloexec(parent_wfd)
if libc.unshare(CLONE_NEWPID | unshare_flags) != 0:
raise c_error()
+ if unshare_flags & CLONE_NEWUSER:
+ os.setuid(0)
fork_pid = os.fork()
if fork_pid == 0:
# child