[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200917152907.GB855@sol.localdomain>
Date: Thu, 17 Sep 2020 08:29:07 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Jeff Layton <jlayton@...nel.org>
Cc: linux-fscrypt@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net,
linux-mtd@...ts.infradead.org, ceph-devel@...r.kernel.org,
Daniel Rosenberg <drosen@...gle.com>
Subject: Re: [PATCH v3 13/13] fscrypt: make
fscrypt_set_test_dummy_encryption() take a 'const char *'
On Thu, Sep 17, 2020 at 08:32:39AM -0400, Jeff Layton wrote:
> On Wed, 2020-09-16 at 21:11 -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@...gle.com>
> >
> > fscrypt_set_test_dummy_encryption() requires that the optional argument
> > to the test_dummy_encryption mount option be specified as a substring_t.
> > That doesn't work well with filesystems that use the new mount API,
> > since the new way of parsing mount options doesn't use substring_t.
> >
> > Make it take the argument as a 'const char *' instead.
> >
> > Instead of moving the match_strdup() into the callers in ext4 and f2fs,
> > make them just use arg->from directly. Since the pattern is
> > "test_dummy_encryption=%s", the argument will be null-terminated.
> >
>
> Are you sure about that? I thought the point of substring_t was to give
> you a token from the string without null terminating it.
>
> ISTM that when you just pass in ->from, you might end up with trailing
> arguments in your string like this. e.g.:
>
> "v2,foo,bar,baz"
>
> ...and then that might fail to match properly
> in fscrypt_set_test_dummy_encryption.
>
Yes I'm sure, and I had also tested it. The use of match_token() here is to
parse one null-terminated mount option at a time.
The reason that match_token() can return multiple substrings is that the pattern
might be something like "foo=%d:%d".
But here it's just "test_dummy_encryption=%s". "%s" matches until end-of-string.
- Eric
Powered by blists - more mailing lists