mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Howells <dhowells@redhat.com>, Karel Zak <kzag@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] fs: avoid empty option when generating legacy mount string
Date: Wed, 7 Jun 2023 21:39:01 +0200	[thread overview]
Message-ID: <20230607-rennpferd-stechen-2f645ac78fcc@brauner> (raw)
In-Reply-To: <20230607-fs-empty-option-v1-1-20c8dbf4671b@weissschuh.net>

On Wed, Jun 07, 2023 at 07:28:48PM +0200, Thomas Weißschuh wrote:
> As each option string fragment is always prepended with a comma it would
> happen that the whole string always starts with a comma.
> This could be interpreted by filesystem drivers as an empty option and
> may produce errors.
> 
> For example the NTFS driver from ntfs.ko behaves like this and fails when
> mounted via the new API.
> 
> Link: https://github.com/util-linux/util-linux/issues/2298

Yeah, the old ntfs driver implements its own option parser. It
overwrites/splits at ',' returning '\0' and then trips over this.

Contrast with e.g., ovl_next_op() which does the same thing but skips
over '\0' in ovl_parse_opt().

So arguably also a bug in ntfs parsing. But there's no reason we should
prepend ',' for legacy mount option strings.

And yeah, I can easily verify this...

Using my custom move-mount tool I originally wrote for another patchset
but which is handy to pass mount options via the new mount api _system_
calls and not via mount():
https://github.com/brauner/move-mount-beneath

I can do:

        sudo ./move-mount -f overlay -olowerdir=/mnt/a:/mnt/b,upperdir=/mnt/upper,workdir=/mnt/work /mnt/merged

and clearly see:

        > sudo bpftrace -e 'kfunc:legacy_get_tree { @m = args->fc; printf("%s\n", str(((struct legacy_fs_context *)@m->fs_private)->legacy_data)); }'
        Attaching 1 probe...
        ,lowerdir=/mnt/a:/mnt/b,upperdir=/mnt/upper,workdir=/mnt/work

> Fixes: 3e1aeb00e6d1 ("vfs: Implement a filesystem superblock creation/configuration context")

Should be:

Fixes: commit 3e1aeb00e6d1 ("vfs: Implement a filesystem superblock creation/configuration context")

and misses a:

Cc: stable@vger.kernel.org

I'll fix this up for you though.

  reply	other threads:[~2023-06-07 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 17:28 Thomas Weißschuh
2023-06-07 19:39 ` Christian Brauner [this message]
2023-06-07 19:44   ` Thomas Weißschuh
2023-06-07 19:46 ` Christian Brauner

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=20230607-rennpferd-stechen-2f645ac78fcc@brauner \
    --to=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=kzag@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®