From 24927339bd52856eba0cc5033893e036988ce369 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 9 Apr 2018 18:01:38 +0200 Subject: [PATCH] attach: always drop supplementary groups Closes #1704. Signed-off-by: Christian Brauner --- src/lxc/attach.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 9a8a836d5a..3b71527215 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -870,12 +870,12 @@ static int attach_child_main(struct attach_clone_payload *payload) ret = lxc_switch_uid_gid(new_uid, new_gid); if (ret < 0) goto on_error; - - ret = lxc_setgroups(0, NULL); - if (ret < 0) - goto on_error; } + ret = lxc_setgroups(0, NULL); + if (ret < 0) + goto on_error; + if ((init_ctx->container && init_ctx->container->lxc_conf && init_ctx->container->lxc_conf->no_new_privs) || (options->attach_flags & LXC_ATTACH_NO_NEW_PRIVS)) {