From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id AB3AB5A026A for ; Fri, 14 Oct 2022 06:25:46 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4MpYGW4S9lz4xH4; Fri, 14 Oct 2022 15:25:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1665721539; bh=M/jX8zCKK7vy1WXwlZxzSEvH/QeWsuXzRBXkvjA6vdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+OcaitrhhOBgk5IzlCrA1o4E9bwBGQ+VQ29qhgDr4iTnPZrSHKvq401xK0A1Ffh0 IyyjYXixALtRpDw7Kozrr6mewcQYhAyqqJ454wlQtRvRDidIHnC9rBsVsyVJWZgjcJ sUV9eN61J/7k71tOKoJzMHimpF46yYbT7tDmnZeo= From: David Gibson To: Stefano Brivio Subject: [PATCH v2 04/11] Remove unhelpful drop_caps() call in pasta_start_ns() Date: Fri, 14 Oct 2022 15:25:30 +1100 Message-Id: <20221014042537.2466015-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014042537.2466015-1-david@gibson.dropbear.id.au> References: <20221014042537.2466015-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 4YSWTNKWZCMYEVFGKEXJACRBVJJ6NM32 X-Message-ID-Hash: 4YSWTNKWZCMYEVFGKEXJACRBVJJ6NM32 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: <> Archived-At: List-Archive: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: drop_caps() has a number of bugs which mean it doesn't do what you'd expect. However, even if we fixed those, the call in pasta_start_ns() doesn't do anything useful: * In the common case, we're UID 0 at this point. In this case drop_caps() doesn't accomplish anything, because even with capabilities dropped, we are still privileged. * When attaching to an existing namespace with --userns or --netns-only we might not be UID 0. In this case it's too early to drop all capabilities: we need at least CAP_NET_ADMIN to configure the tap device in the namespace. Remove this call - we will still drop capabilities a little later in sandbox(). Signed-off-by: David Gibson --- pasta.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/pasta.c b/pasta.c index 1569590..c72efe5 100644 --- a/pasta.c +++ b/pasta.c @@ -223,8 +223,6 @@ void pasta_start_ns(struct ctx *c, int argc, char *argv[]) exit(EXIT_FAILURE); } - drop_caps(); - NS_CALL(pasta_wait_for_ns, c); } -- 2.37.3