unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 60890-done@debbugs.gnu.org
Subject: bug#60890: least-authority-wrapper and make-forkexec-constructor composition problem
Date: Tue, 12 Nov 2024 14:54:57 +0900	[thread overview]
Message-ID: <877c99809a.fsf@gmail.com> (raw)
In-Reply-To: <87lelxcofy.fsf@gmail.com> (Maxim Cournoyer's message of "Fri, 20 Jan 2023 08:42:25 -0500")

Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hi,
>
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hello!
>>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>
>>> It was found that using something like:
>>>
>>> (make-forkexec-constructor
>>>   (least-authority
>>>     (list (file-append coreutils "/bin/true"))
>>>     (mappings (delq 'user %namespaces))
>>>   #:user  "nobody"
>>>   #:group "nobody"))
>>>
>>> Would fail with EPERM, because in order to be able to drop the user
>>> namespace, the CAP_SYS_ADMIN capability is required, but in the above
>>> case, make-forkexec-constructor has already changed the user to
>>> "nobody", which lacks such capability.
>>
>> Thanks for the reminder!
>>
>> I guess the problem is limited to cases where you need the program to
>> run in the global user namespace.
>
> Yes, it's limited to that case, because when clone(2) is called without
> CLONE_NEWUSER, the child process does *not* start with a complete set of
> capabilities (CAP_SYS_ADMIN), quoting my original investigation from
> [0]:
>
>> The problem then seems to be that since we need CAP_SYS_ADMIN when
>> dropping the user namespace, as CLONE_NEWUSER is what gives us
>> superpowers.  Per 'man user_namespaces':
>
>> The child process created by clone(2) with the CLONE_NEWUSER flag starts
>> out with a complete set of capabilities in the new user namespace.
>
> [0]  https://issues.guix.gnu.org/54786#16

I believe this issue was addressed in commits 7578c25b93
("least-authority: Add support for changing UIDs/GIDs before exec.") and
ca81317389 ("shepherd: Remove ‘make-forkexec-constructor/container’.").

Closing!

-- 
Thanks,
Maxim




      reply	other threads:[~2024-11-12  5:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 19:30 bug#60890: least-authority-wrapper and make-forkexec-constructor composition problem Maxim Cournoyer
2023-01-19 17:04 ` Ludovic Courtès
2023-01-20 13:42   ` Maxim Cournoyer
2024-11-12  5:54     ` Maxim Cournoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877c99809a.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=60890-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).