lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 28 Sep 2019 17:05:29 +0200
From:   "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     mtk.manpages@...il.com,
        Christian Brauner <christian.brauner@...ntu.com>,
        linux-man <linux-man@...r.kernel.org>,
        Containers <containers@...ts.linux-foundation.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Andy Lutomirski <luto@...capital.net>,
        Jordan Ogas <jogas@...l.gov>, werner@...esberger.net,
        Al Viro <viro@....linux.org.uk>
Subject: Re: pivot_root(".", ".") and the fchdir() dance

Hello Eric,

A ping on my question below. Could you take a look please?

Thanks,

Michael

>>>> The concern from our conversation at the container mini-summit was that
>>>> there is a pathology if in your initial mount namespace all of the
>>>> mounts are marked MS_SHARED like systemd does (and is almost necessary
>>>> if you are going to use mount propagation), that if new_root itself
>>>> is MS_SHARED then unmounting the old_root could propagate.
>>>>
>>>> So I believe the desired sequence is:
>>>>
>>>>>>>            chdir(new_root);
>>>> +++            mount("", ".", MS_SLAVE | MS_REC, NULL);
>>>>>>>            pivot_root(".", ".");
>>>>>>>            umount2(".", MNT_DETACH);
>>>>
>>>> The change to new new_root could be either MS_SLAVE or MS_PRIVATE.  So
>>>> long as it is not MS_SHARED the mount won't propagate back to the
>>>> parent mount namespace.
>>>
>>> Thanks. I made that change.
>>
>> For what it is worth.  The sequence above without the change in mount
>> attributes will fail if it is necessary to change the mount attributes
>> as "." is both put_old as well as new_root.
>>
>> When I initially suggested the change I saw "." was new_root and forgot
>> "." was also put_old.  So I thought there was a silent danger without
>> that sequence.
> 
> So, now I am a little confused by the comments you added here. Do you
> now mean that the 
> 
> mount("", ".", MS_SLAVE | MS_REC, NULL);
> 
> call is not actually necessary?
> 
> Thanks,
> 
> Michael
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ