From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YEAWCHaaymPvJwEAbAwnHQ (envelope-from ) for ; Fri, 20 Jan 2023 14:43:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 0IEVB3aaymPTHgEAG6o9tA (envelope-from ) for ; Fri, 20 Jan 2023 14:43:18 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 49C6D244D8 for ; Fri, 20 Jan 2023 14:43:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIrfe-0000wP-Jy; Fri, 20 Jan 2023 08:43:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIrfa-0000ua-Sx for bug-guix@gnu.org; Fri, 20 Jan 2023 08:43:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIrfa-0007VI-C3 for bug-guix@gnu.org; Fri, 20 Jan 2023 08:43:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pIrfZ-0000He-WA for bug-guix@gnu.org; Fri, 20 Jan 2023 08:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#60890: least-authority-wrapper and make-forkexec-constructor composition problem Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 20 Jan 2023 13:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60890 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 60890@debbugs.gnu.org Received: via spool by 60890-submit@debbugs.gnu.org id=B60890.16742221581038 (code B ref 60890); Fri, 20 Jan 2023 13:43:01 +0000 Received: (at 60890) by debbugs.gnu.org; 20 Jan 2023 13:42:38 +0000 Received: from localhost ([127.0.0.1]:45885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIrf9-0000Gc-Dc for submit@debbugs.gnu.org; Fri, 20 Jan 2023 08:42:38 -0500 Received: from mail-qt1-f181.google.com ([209.85.160.181]:35597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIrf7-0000GO-As for 60890@debbugs.gnu.org; Fri, 20 Jan 2023 08:42:33 -0500 Received: by mail-qt1-f181.google.com with SMTP id g16so2060850qtu.2 for <60890@debbugs.gnu.org>; Fri, 20 Jan 2023 05:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=zYSU3vVpYJ2rm/IcbwswrKHHyzWjoJqvnksPPg1P0Uc=; b=pEGYz1WkMMzb/7k1YSdDdPWLy2qXXuzzxdBSJc8ImUnN+Mzkoyw9VzETUyd3DxhOjk WWsrcmtuybnmGRw7G2ilTBBPkxMno1fUrep64wV4ap8Fs87vZLGhzdYqOowgtw5ZwMXW Hj5RMJhmim55wbDjTciGHwpyJdKCFpLORL7V00LU6tHgSrr5ioqqO0KU6z4N/Bz6Mj3J 7OzbNqpMKjo2vs+JYDWVY1Qh+jJedVBjMkb3CpWBvzz/W2AhIsreOIXZmyle1CrrWuFB a28kGNqqsMrfXRw7n0v/7ykjrVq1E/CvyzPm7LyFoDWn2gNF9vPIVMaSgJSOnE6ZZpUL 5pBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=zYSU3vVpYJ2rm/IcbwswrKHHyzWjoJqvnksPPg1P0Uc=; b=wcuouglEH7OOsGi1+npHNGcooue6F5bvuLW4sPPdNMu04xv0TUZjOY9cc+/M+cvhRc 8LH1/wn9biFJBLKvKUaAer6rGjgNwQBUctwtf1gtXxjYjByN+ckkD8FbLzI0rxNoMgDj V2uxW4AwXGWpISr82qr9YP+C5IB3uHjU8IuhPegnhA5X8vP3HsbeKYA/m/hv5C5ZUbPz BB9OnDeKjRo7KfUX3i8mLVbqVLX6bTKL7yCDB3sxk8qAw5gbZtuogl7YojXfsQWXPtBQ WCIKhP8s+28UjuTMShAm2ejz5qWk7eB9bDOCT0jKXJ6JY4sOtkjf4CCmTrdbcI2+tziE TzDw== X-Gm-Message-State: AFqh2krXEv2Ka4iGhHFITKz6TllaXb/Y7FgYbWRnjp+odjgrk8FjVkZR cEgg0/eIge548ysX3b4Krc8/cEgVJGuSyA== X-Google-Smtp-Source: AMrXdXvxGI8Zi+Joxcjt0SkRvIgkl0FzYFm9EacznT8UV/M2Vw/6390rnwmvAaof9KyuOipZOzIRZA== X-Received: by 2002:ac8:4519:0:b0:3b6:2c10:a3e1 with SMTP id q25-20020ac84519000000b003b62c10a3e1mr20369845qtn.57.1674222147541; Fri, 20 Jan 2023 05:42:27 -0800 (PST) Received: from hurd ([2607:fad8:4:3::1001]) by smtp.gmail.com with ESMTPSA id z24-20020ac875d8000000b003b68c7aeebfsm2778744qtq.3.2023.01.20.05.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 05:42:26 -0800 (PST) From: Maxim Cournoyer References: <87zgahyn5w.fsf@gmail.com> <87pmba8nhp.fsf@gnu.org> Date: Fri, 20 Jan 2023 08:42:25 -0500 In-Reply-To: <87pmba8nhp.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 19 Jan 2023 18:04:18 +0100") Message-ID: <87lelxcofy.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674222197; a=rsa-sha256; cv=none; b=a2iXVizc8l2dJEPXuwai4hWvE7nw4y4Kxe0MK8ntldg14DbFERnfr8fRgA6cMgym5D8gYv 4S/l/gmMqNbh6LwtiCGSoe5ZcG+dmQ8/1hxxTUVUQvNhAuC5B2Ca5UpdhuDS1ILk9+jkMA mzf4X7TrUxrvHZLlLjJXI/U3VptG2V0P/cZGDkwJnHShwh8zEX0lgc+gAvnixJtGnWhNgo csirqhbqepAddK2BifPxNOxYiYWnVySuEaSYMyRv+9OXN4k5vgGKLQsI2+Y0ZzvGQBEk6L zrmG7xJQToMvwriftH+QnD7wp6OTB2i8TxP6pqBrm4kZ5x0M1pJLrBSrBGZxrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pEGYz1Wk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674222197; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=zYSU3vVpYJ2rm/IcbwswrKHHyzWjoJqvnksPPg1P0Uc=; b=VjqKqxJQsZHl3nd1dOWzsO041RIado3omH65O9NuoMtFRlpPZhvkEnrhBtH37flaVSjeqk h55Z4u5N/ZoQUqKCLFT7jhwL2J/VuiAf4qcDMk/YCMqfnfb/YFMkAG7yA0vVvn1f2gTCeE ocCcMqRTeIPJO2VLITSKi4SIPnlwGMOQFTQcZ3FkNt0GUvCuMkOCi5Ylp6wilM0/53a+Yr 4Ls+m01CSZEsK04iMPU+1QOsWspDHO7dFMADf0nIn7TvI5QocYad6YeXKSFjzV36ttrXc/ Ztia3sxGgeftDll5tfMzKgQBmYZS1fFDGNDKbqLRlYQnVsomqfOGHsKu/CSVJw== X-Spam-Score: 6.29 X-Migadu-Queue-Id: 49C6D244D8 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=pEGYz1Wk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: 6.29 X-TUID: ZfL6l2ufM2Yc Hi, Ludovic Court=C3=A8s writes: > Hello! > > Maxim Cournoyer skribis: > >> It was found that using something like: >> >> (make-forkexec-constructor >> (least-authority >> (list (file-append coreutils "/bin/true")) >> (mappings (delq 'user %namespaces)) >> #:user "nobody" >> #:group "nobody")) >> >> Would fail with EPERM, because in order to be able to drop the user >> namespace, the CAP_SYS_ADMIN capability is required, but in the above >> case, make-forkexec-constructor has already changed the user to >> "nobody", which lacks such capability. > > Thanks for the reminder! > > I guess the problem is limited to cases where you need the program to > run in the global user namespace. Yes, it's limited to that case, because when clone(2) is called without CLONE_NEWUSER, the child process does *not* start with a complete set of capabilities (CAP_SYS_ADMIN), quoting my original investigation from [0]: > The problem then seems to be that since we need CAP_SYS_ADMIN when > dropping the user namespace, as CLONE_NEWUSER is what gives us > superpowers. Per 'man user_namespaces': > The child process created by clone(2) with the CLONE_NEWUSER flag starts > out with a complete set of capabilities in the new user namespace. [0] https://issues.guix.gnu.org/54786#16 --=20 Thanks, Maxim