Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setgroups < deny is needed before group ids are set #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shriphani
Copy link

Since Linux 3.19 unprivileged writing of /proc/self/gid_map has been disabled unless /proc/self/setgroups is written first to permanently disable the ability to call setgroups in that user namespace.

This essentially means we need to write "deny" to /proc/self/setgroups. This PR adds that one invocation.

Without this, you can't map a child in CLONE_NEWUSER uid 0 and gid 0 to an unprivileged caller's uid and gid.

@marius851000
Copy link

marius851000 commented Jul 5, 2023

Can confirm that this solve the issue I had with this piece of code:

.set_id_maps(
    vec![UidMap {
        inside_uid: 0,
        outside_uid: unsafe { libc::geteuid() },
        count: 1,
    }],
    vec![GidMap {
        inside_gid: 0,
        outside_gid: unsafe { libc::getegid() },
        count: 1,
    }],
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants