guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: linux-container: Reset jailed root permissions.


From: guix-commits
Subject: branch master updated: linux-container: Reset jailed root permissions.
Date: Thu, 01 Oct 2020 07:46:32 -0400

This is an automated email from the git hooks/post-receive script.

jlicht pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new e748183  linux-container: Reset jailed root permissions.
e748183 is described below

commit e74818353882f187e5971b5a3a481f17df883dbe
Author: Jelle Licht <jlicht@fsfe.org>
AuthorDate: Tue Sep 29 23:25:13 2020 +0200

    linux-container: Reset jailed root permissions.
    
    * 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 2d4de78..4a8bed5 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 7b63e5c..608902c 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -134,6 +134,14 @@
        (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
    (lambda (root)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]