-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
Let's assume user_a has GID 1000, and an entry in /etc/subgid user_a:10000:100.
When user run following commands:
unshare --user -- catatonit -P &
newuidmap <PID> 0 1000 1
newgidmap <PID> 0 1000 1
nsenter --target <PID> --usernsenter will return nsenter: setgroups failed: Operation not permitted, since /proc/<PID>/setgroups has been set to deny.
But if user add an extra gid map, then nsenter works:
unshare --user -- catatonit -P &
newuidmap <PID> 0 1000 1
# add a range within /etc/subgid
newgidmap <PID> 0 1000 1 1 10000 10
nsenter --target <PID> --userI don't get it logically why add an extra gid map should make /proc/<PID>/setgroups becomes allow. And this further affect nsenter's behavior.
I find this code leaves *allow_setgroups unmodified and makes setgroups to deny.
Lines 41 to 45 in ea109a3
| /* Allow a process to map its own gid. */ | |
| if ((range->count == 1) && (getgid() == range->lower)) { | |
| /* noop -- if setgroups is enabled already we won't disable it. */ | |
| return true; | |
| } |
Is this behavior intentional (set own gid map only cause setgroups to deny)? Or could this a bug from nsenter(require a setgroups to work)?
Metadata
Metadata
Assignees
Labels
No labels