From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753402AbbCaVdu (ORCPT ); Tue, 31 Mar 2015 17:33:50 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:49447 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbbCaVdo (ORCPT ); Tue, 31 Mar 2015 17:33:44 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrey Wagin Cc: Richard Weinberger , linux-fsdevel , LKML , Cyrill Gorcunov , Pavel Emelyanov , Alexander Viro References: <1427488774-5077-1-git-send-email-avagin@openvz.org> <5515DDE9.4040203@nod.at> Date: Tue, 31 Mar 2015 16:29:43 -0500 In-Reply-To: (Andrey Wagin's message of "Tue, 31 Mar 2015 18:15:16 +0300") Message-ID: <87twx0x3co.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX197Npx5QXiVb5d1U0dvgM8ugh6/Wwcvbk4= X-SA-Exim-Connect-IP: 70.59.163.10 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Andrey Wagin X-Spam-Relay-Country: X-Spam-Timing: total 524 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 6 (1.2%), b_tie_ro: 4.1 (0.8%), parse: 1.14 (0.2%), extract_message_metadata: 23 (4.4%), get_uri_detail_list: 4.5 (0.9%), tests_pri_-1000: 9 (1.8%), tests_pri_-950: 1.62 (0.3%), tests_pri_-900: 1.47 (0.3%), tests_pri_-400: 28 (5.4%), check_bayes: 27 (5.1%), b_tokenize: 9 (1.7%), b_tok_get_all: 9 (1.7%), b_comp_prob: 4.0 (0.8%), b_tok_touch_all: 2.6 (0.5%), b_finish: 0.70 (0.1%), tests_pri_0: 444 (84.8%), tests_pri_500: 3.9 (0.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] fs: show locked and lock_ro options in mountinfo X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrey Wagin writes: > 2015-03-28 1:47 GMT+03:00 Richard Weinberger : >> Hi! >> >> Am 27.03.2015 um 23:35 schrieb Andrey Wagin: >>> 2015-03-28 0:42 GMT+03:00 Richard Weinberger : >>>> On Fri, Mar 27, 2015 at 9:39 PM, Andrey Vagin wrote: >>>>> I don't see any reasons to hide them. This information can help to >>>>> understand errors. >>>> >>>> Because these flags are set/read only internally by the VFS. In contrast >>>> to the other flags shown by mountinfo MNT_LOCKED is not a mount option. >>> >>> But this flag is set as a result of the specified user action, when he >>> unshares userns and mntns. This flag affects visiable behaviour. >> >> It is a implicit result. Used by the VFS internally. >> If you expose it it becomes ABI and changing the behavior will be >> tricky or impossible. >> >>>> >>>> Why does it help to debug errors? >>>> How would a user know that mount() with MS_BIND returns EINVAL because >>>> the mount source is MNT_LOCKED? This information is useless for her. >>> >>> If I see lock_ro, I can be sure that mount -o remount,bind,rw /XXX will fail. >>> If I see locked, I know that this mount can't be umounted or moved >>> and can be bind-mounted only recursively. >>> >>> If a user see these flags, he can check that a mount namespace is >>> configured correctly without security issues. >>> >>> Sorry but I don't understand why you think that this information is >>> useless for users. >> >> You can only know if you know how the VFS works internally. >> If know that EINVAL from mount(2) with MS_BIND can be caused by MNT_LOCKED >> because I know the source. I bet you know the source too. But not Joey random >> admin who looks into mountinfo to figure out why something does not work. >> >> If you expose MNT_LOCKED to userspace you'll have to update also the mount(2) >> manpage with all glory details of that flag. >> >>>> If you argue like that you'd have to expose the whole VFS state to userland. >>> >>> I have not noticed other MNT_LOCK_* flags. I should think more about >>> what information are a really required for dumping mount namespaces. >>> >>>> >>>>> And this information is required for correct checkpoint/restore of mount >>>>> namespaces. >>>> >>>> Why especially MNT_LOCKED and not all the other flags used by VFS? >>> >>> My goal is to dump enough information about a mount namespace to be >>> able to restore it back later. I don't know how to do this without >>> knowledge about locked mounts. I will think. >> >> How do you plan to restore a MNT_LOCKED mount? >> IIRC we have currently no way to directly set MNT_LOCKED from userspace. > > It's the second question. The first question is how to check that we > will be able to restore what we are dumping. > > If CRIU meets something what it doesn't know how to restore, it (must) > refuses to dump this configuration. As a practical matter if the underlying directory is empty, and will remain empty MNT_LOCKED does not matter. >>>> Say MNT_DOOMED? >>> >>> Mounts with MNT_DOOMED are never shown in mountinfo, are they? >> >> It was just an example. There are other flags too, did you double check >> which ones you really need? >> >> To make the story short, my concern is that exposing such flags to userspace >> has to be well thought. :-) >> As long they are just internal we can change them as we like, as soon userspace >> depends somehow on it the pain begins. > > I'm agree with you. I'm going to think more about this. Thank you for > response. A big question from me is do you have the ability to find the user namespace of a mount namespace. Without that these mount flags do not matter. I would think getting the user namespace of mount namespace and getting the mount propgation tree correct would precede little things like worrying if the mount propagation state is correct. Eric