unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jelle Licht <jlicht@fsfe.org>
To: 43673@debbugs.gnu.org
Subject: [bug#43673] [PATCH v2] linux-container: Reset jailed root permissions.
Date: Tue, 29 Sep 2020 23:25:13 +0200	[thread overview]
Message-ID: <20200929212513.19531-1-jlicht@fsfe.org> (raw)
In-Reply-To: <87blho5nvm.fsf@gnu.org>

* 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





  reply	other threads:[~2020-09-29 22:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 14:34 [bug#43673] [PATCH] linux-container: Reset jailed root permissions Jelle Licht
2020-09-29 20:28 ` Ludovic Courtès
2020-09-29 21:25   ` Jelle Licht [this message]
2020-10-01  9:35     ` [bug#43673] [PATCH v2] " Ludovic Courtès
2020-10-01 11:48       ` bug#43673: " Jelle Licht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200929212513.19531-1-jlicht@fsfe.org \
    --to=jlicht@fsfe.org \
    --cc=43673@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).