unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#43673] [PATCH] linux-container: Reset jailed root permissions.
@ 2020-09-28 14:34 Jelle Licht
  2020-09-29 20:28 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Jelle Licht @ 2020-09-28 14:34 UTC (permalink / raw)
  To: 43673

* gnu/build/linux-container.scm (mount-file-systems): Add 'chmod' call.
---
 gnu/build/linux-container.scm | 3 ++-
 1 file changed, 2 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))
-- 
2.28.0





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#43673] [PATCH] linux-container: Reset jailed root permissions.
  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   ` [bug#43673] [PATCH v2] " Jelle Licht
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2020-09-29 20:28 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 43673

Hi,

Jelle Licht <jlicht@fsfe.org> skribis:

> * gnu/build/linux-container.scm (mount-file-systems): Add 'chmod' call.

Well done!  Could you add a test checking (stat:perms (lstat "/")) in
tests/containers.scm?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43673] [PATCH v2] linux-container: Reset jailed root permissions.
  2020-09-29 20:28 ` Ludovic Courtès
@ 2020-09-29 21:25   ` Jelle Licht
  2020-10-01  9:35     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Jelle Licht @ 2020-09-29 21:25 UTC (permalink / raw)
  To: 43673

* 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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#43673] [PATCH v2] linux-container: Reset jailed root permissions.
  2020-09-29 21:25   ` [bug#43673] [PATCH v2] " Jelle Licht
@ 2020-10-01  9:35     ` Ludovic Courtès
  2020-10-01 11:48       ` bug#43673: " Jelle Licht
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2020-10-01  9:35 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 43673

Hi,

Jelle Licht <jlicht@fsfe.org> skribis:

> * gnu/build/linux-container.scm (mount-file-systems): Add 'chmod' call.
> * tests/containers.scm
> ("call-with-container, mnt namespace, root permissions"): New test.

LGTM, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#43673: [PATCH v2] linux-container: Reset jailed root permissions.
  2020-10-01  9:35     ` Ludovic Courtès
@ 2020-10-01 11:48       ` Jelle Licht
  0 siblings, 0 replies; 5+ messages in thread
From: Jelle Licht @ 2020-10-01 11:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 43673-done

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Jelle Licht <jlicht@fsfe.org> skribis:
>
>> * gnu/build/linux-container.scm (mount-file-systems): Add 'chmod' call.
>> * tests/containers.scm
>> ("call-with-container, mnt namespace, root permissions"): New test.
>
> LGTM, thanks!
>
> Ludo’.

Pushed as e7481835 on master, thanks for the fast review!




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-01 11:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [bug#43673] [PATCH v2] " Jelle Licht
2020-10-01  9:35     ` Ludovic Courtès
2020-10-01 11:48       ` bug#43673: " Jelle Licht

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).