Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
start: Respect lxc.init.groups also in new user namespace
Fix supplementary groups defined in 'lxc.init.groups' being ignored when
the container uses a new user namespace.

In other words: Fix lxc.init.groups for unprivileged containers.

Signed-off-by: Filip Schauer <[email protected]>
  • Loading branch information
Filiprogrammer committed Dec 15, 2025
commit 9e6caeabec77471c46a629ad5a5a6586ff31e9ce
12 changes: 7 additions & 5 deletions src/lxc/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,17 +1603,19 @@ static int do_start(void *data)
if (lxc_proc_cap_is_set(CAP_SETGID, CAP_EFFECTIVE))
#endif
{
if (handler->conf->init_groups.size > 0) {
if (!lxc_setgroups(handler->conf->init_groups.list,
handler->conf->init_groups.size))
goto out_warn_father;
} else {
if (handler->conf->init_groups.size == 0) {
if (!lxc_drop_groups())
goto out_warn_father;
}
}
}

if (handler->conf->init_groups.size > 0) {
if (!lxc_setgroups(handler->conf->init_groups.list,
handler->conf->init_groups.size))
goto out_warn_father;
}

if (!lxc_switch_uid_gid(new_uid, new_gid))
goto out_warn_father;

Expand Down