util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roberto Bergantinos Corpas <rbergant@redhat.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] findmnt: add option to list all statvfs f_flags
Date: Wed, 25 Nov 2020 12:29:33 +0100	[thread overview]
Message-ID: <CACWnjLxT74u=zgYKY3=bQLssOjPC+ZxmV82O=sNwWJ6CePyuig@mail.gmail.com> (raw)
In-Reply-To: <20201125112144.esfpgrfrqbjqr4j3@ws.net.home>

Hi Karel!

thanks for inputs, appreciate it.

Yes i agree with your objections, in fact first i thought about
extending VFS-OPTIONS via some flag,
and check agains options map, thought i guess i took easy path at some point ;-)

I'll try to see if i can make some work based on your suggestions
before next week.

On Wed, Nov 25, 2020 at 12:21 PM Karel Zak <kzak@redhat.com> wrote:
>
> On Wed, Nov 25, 2020 at 10:45:11AM +0100, Roberto Bergantinos Corpas wrote:
> > It might be useful for security auditing purposes list all possible
> > mount flags/options including default set which are normally not listed.
> >
> > Given that we already call statvfs to retrieve i.e. filesystem size,
> > add an extra column to list all possible f_flags, default or not.
>
> (Sorry Roberto I forgot reply to our private email.)
>
> I understand the goal, but I'm not sure with implementation ;-)
>
> * statvfs() requires access to the mount point, it's better to avoid
>   it if possible due to issue with permissions for non-root users and
>   due to inaccessible NFS, etc.
>
>   The mount options are already accessible for everyone in /proc/self/mountinfo.
>   It's possible to use mnt_optstr_get_flags() to convert the string
>   from mnt_fs_get_vfs_options() to flags.
>
> * your implementation hardcodeds the flags to findmnt.c. This is
>   fragile in terms of future development. And for example right now
>   your list does not include dirsync, sub, silent, strictatime,
>   lazytime, relatime and symfollow options.
>
>   It would be better to use libmount options map where we maintain the
>   option flags and strings, something like
>
>      const struct libmnt_optmap *ent;
>      const struct libmnt_optmap *map;
>
>      map = mnt_get_builtin_optmap(MNT_LINUX_MAP);
>
>      for (ent = map; ent && ent->name; ent++) {
>         if (flags & ent->id)
>             ...
>      }
>
>  Maybe we can add a function to return all (including default) options
>  to libmount to make it easy to use for all applications (something
>  like mnt_fs_get_vfs_alloptions()).
>
> > +     [COL_MNT_OPTIONS]  = { "MNT-OPTIONS",  0.20, SCOLS_FL_TRUNC, N_("All statvfs f_flags from mount") },
>
>  Not sure, but do we really need a new column for this purpose?
>
>  It's still about VFS-OPTIONS, the difference is that you need default
>  build-in options too. What about to add --vfs-show-default (or so)
>  command line options to modify VFS-OPTIONS output?
>
>
>  I can implement it next week (if you don't want play with
>  libmount, etc.).
>
>     Karel
>
> --
>  Karel Zak  <kzak@redhat.com>
>  http://karelzak.blogspot.com
>


      reply	other threads:[~2020-11-25 11:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25  9:45 [PATCH] findmnt: add option to list all statvfs f_flags Roberto Bergantinos Corpas
2020-11-25 11:21 ` Karel Zak
2020-11-25 11:29   ` Roberto Bergantinos Corpas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACWnjLxT74u=zgYKY3=bQLssOjPC+ZxmV82O=sNwWJ6CePyuig@mail.gmail.com' \
    --to=rbergant@redhat.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).