From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 06 15:56:38 2022 Received: (at 50916) by debbugs.gnu.org; 6 Aug 2022 19:56:38 +0000 Received: from localhost ([127.0.0.1]:35472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKPuY-000416-CM for submit@debbugs.gnu.org; Sat, 06 Aug 2022 15:56:38 -0400 Received: from knopi.disroot.org ([178.21.23.139]:50292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKPuV-00040v-Jz for 50916@debbugs.gnu.org; Sat, 06 Aug 2022 15:56:36 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 25DC640F0F; Sat, 6 Aug 2022 21:56:34 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LM1jIPIvuQg1; Sat, 6 Aug 2022 21:56:33 +0200 (CEST) Date: Sat, 6 Aug 2022 19:56:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1659815793; bh=04WQ1iG3aSFODdGsVSb6eZTj4W8mYvckQyCz1CEYyrc=; h=Date:From:To:Subject:In-Reply-To; b=IWceFgqn17onlxmsVTgdR3dWroNW90y5X6Kb+BrBbA7rmcOxBMW7hZWNwRb9UdBmO ofRODKZPvldM8uR8Vi55aVHUiPk/SEP0PvsGky7MLxqc7cZDbiTphy9JziDAAqT9Tz c70NvqRKJPEcCknR5IPkBXPkXFFB9mfLh/vKxQmmcjGmNapFq8C7ch+i6oss1cHld1 4Mvu2EpKXrAtl9VBDidkdtxgdSC6Gz8wP7wolMdaJ8nHoHAAg7W4BioMl3Eg/ux71K bZieRCSP9QaM1IxKWT5V5ZTXzTl6qFvfYe4Zgf4ALF5hMAml9EvxgYSx+WNacu2T8g wAbLYJ6pmSVig== From: kiasoc5 To: me@bonfacemunyoki.com, 50916@debbugs.gnu.org Subject: bug#50916: Experimental `guix container PID program args` not working as expected Message-ID: <20220806195629.054aef70@aria> In-Reply-To: 865yuif8go.fsf@bonfacemunyoki.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50916 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This bug still persists and effectively bypasses container sandboxing: 1. Start a container shell. $ guix shell --container 2. Exec a shell inside the container. Here it is a foreign distro's bash, and assume that there is only 1 container running. $ guix container exec $(pgrep --full 'guix shell --container') /bin/bash 3. Observe that path is not empty. $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/bin This shell can access commands outside the container, such as kill (part of util-linux). 4. Kill the container from the shell inside the container. [env] $ kill -9 $(pgrep --full 'guix shell --container') [env] $ echo $? 0 The shell still persists in the container, even though the container itself is killed. The problem is that in guix/scripts/container/exec.scm, execlp is used to launch program with args. info guile says this about execlp: Similar to =E2=80=98execl=E2=80=99, however if FILENAME does not contain = a slash then the file to execute will be located by searching the directories listed in the =E2=80=98PATH=E2=80=99 environment variable. As seen above $PATH is set to a subset of the host system's PATH, not the PATH inside the guix container.