[Pkg-systemd-maintainers] Bug#739593: Bug#739593: Bug#739593: closed by Michael Stapelberg <stapelberg at debian.org> (Re: Bug#739593: systemd makes / shared by default)

Michael Stapelberg stapelberg at debian.org
Sat Mar 8 21:04:45 GMT 2014


Hi Christoph,

Christoph Berg <myon at debian.org> writes:
> Pardon this question, but how do I do this "mount --make-rprivate /"
> in C? I've tried stracing mount:
The following patch works for me to make your newpid program work:

--- i/newpid.c
+++ w/newpid.c
@@ -40,11 +40,9 @@ run (void *argv_void)
        pid_t child;
        pid_t pid;
 
-       if (umount ("/proc") != 0) {
-               /* ignore errors here, /proc could be busy
-               perror ("umount /proc");
+       if (mount("none", "/proc", NULL, MS_PRIVATE|MS_REC, NULL) != 0)
-               {
+               perror ("remount proc private");
                exit (1);
-               */
        }
 
        if (mount ("proc", "/proc", "proc", 0, NULL) != 0) {

I took this from
https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/sys-utils/unshare.c#n182

-- 
Best regards,
Michael




More information about the Pkg-systemd-maintainers mailing list