From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uFYBHUe2c19eVwAA0tVLHw (envelope-from ) for ; Tue, 29 Sep 2020 22:33:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id GM3ZGEe2c1/sMQAAB5/wlQ (envelope-from ) for ; Tue, 29 Sep 2020 22:33:43 +0000 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 BA20E940366 for ; Tue, 29 Sep 2020 22:33:42 +0000 (UTC) Received: from localhost ([::1]:38536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNN8S-0003uF-QC for larch@yhetil.org; Tue, 29 Sep 2020 17:26:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNN8M-0003u7-CJ for guix-patches@gnu.org; Tue, 29 Sep 2020 17:26:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNN8M-0003a4-2i for guix-patches@gnu.org; Tue, 29 Sep 2020 17:26:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kNN8L-0000sT-VE for guix-patches@gnu.org; Tue, 29 Sep 2020 17:26:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43673] [PATCH v2] linux-container: Reset jailed root permissions. Resent-From: Jelle Licht Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Sep 2020 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43673 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43673@debbugs.gnu.org Received: via spool by 43673-submit@debbugs.gnu.org id=B43673.16014147193325 (code B ref 43673); Tue, 29 Sep 2020 21:26:01 +0000 Received: (at 43673) by debbugs.gnu.org; 29 Sep 2020 21:25:19 +0000 Received: from localhost ([127.0.0.1]:57333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNN7f-0000rZ-HW for submit@debbugs.gnu.org; Tue, 29 Sep 2020 17:25:19 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:53606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNN7c-0000rN-T0 for 43673@debbugs.gnu.org; Tue, 29 Sep 2020 17:25:18 -0400 From: Jelle Licht Date: Tue, 29 Sep 2020 23:25:13 +0200 Message-Id: <20200929212513.19531-1-jlicht@fsfe.org> In-Reply-To: <87blho5nvm.fsf@gnu.org> References: <87blho5nvm.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -6.0 (------) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=fsfe.org (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 5.59 X-TUID: tzS5ZRAO2gQv * gnu/build/linux-container.scm (mount-file-systems): Add 'chmod' call. * tests/containers.scm ("call-with-container, mnt namespace, root permissions"): New test. --- gnu/build/linux-container.scm | 3 ++- tests/containers.scm | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index 2d4de788df..4a8bed5a9a 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm @@ -170,7 +170,8 @@ for the process." (pivot-root root put-old) (chdir "/") (umount "real-root" MNT_DETACH) - (rmdir "real-root"))) + (rmdir "real-root") + (chmod "/" #o755))) (define* (initialize-user-namespace pid host-uids #:key (guest-uid 0) (guest-gid 0)) diff --git a/tests/containers.scm b/tests/containers.scm index 7b63e5c108..608902c41a 100644 --- a/tests/containers.scm +++ b/tests/containers.scm @@ -133,6 +133,14 @@ (lambda () (primitive-exit 0))))) +(skip-if-unsupported) +(test-assert "call-with-container, mnt namespace, root permissions" + (zero? + (call-with-container '() + (lambda () + (assert-exit (= #o755 (stat:perms (lstat "/"))))) + #:namespaces '(user mnt)))) + (skip-if-unsupported) (test-assert "container-excursion" (call-with-temporary-directory -- 2.28.0