From: Theodore Ts'o <tytso@mit.edu>
To: Matthew Wilcox <willy@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
Adam Borowski <kilobyte@angband.pl>,
Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfs: hard-ban creating files with control characters in the name
Date: Fri, 6 Oct 2017 16:00:00 -0400 [thread overview]
Message-ID: <20171006200000.c3yetuu7xpifxu7l@thunk.org> (raw)
In-Reply-To: <20171006145701.GB18373@bombadil.infradead.org>
On Fri, Oct 06, 2017 at 07:57:01AM -0700, Matthew Wilcox wrote:
>
> Umm. But filenames still can't have / or \0 in them, so your encryption
> already has to avoid at least two special characters.
>
> I agree with your main point though; there is no advantage to doing this
> in each individual filesystem.
One advantage of doing it in an LSM is you can simply make this a ban
on the *creation* of new files that match some particular "bad
character set". This might be all characters between 1 and 31, not
just for security reasons, but also if you are running a filer where
the files need to be accessible by Windows sytems, and Windows doesn't
allow file names containing control characters.
Ultimately, the cost/benefit ratio of this is small. Forbidding
newlines doesn't actually buy you that much. It is true that there
are some shell progamming constructs which will deal with embedded
spaces in file names, but not with embedded newlines --- but there are
many more constructs that will fail to deal with spaces, and there
enough other potential gotchas that if a shell script progammer isn't
using something like shellcheck, they are going to be tempting fate.
At the same time, the _cost_ of forbidding control chracaters is tiny.
And while the risk of embedding an entertaining escape sequence into a
filename and waiting for a root user to list the directory is low ---
what's the likelihood we will be crimping a user or shell script's
style by forbidding the escape sequence in a filename?
Most of these problems are really only an issue on time-sharing
systems, so for people who are worried about these attacks --- they
can enable an LSM, just as people who are willing to deal with the
pain of SELinux can enable SELinux. :-)
- Ted
next prev parent reply other threads:[~2017-10-06 20:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 0:50 [PATCH] vfs: hard-ban creating files with control characters in the name Adam Borowski
2017-10-03 2:07 ` Al Viro
2017-10-03 3:22 ` Adam Borowski
2017-10-05 10:07 ` Olivier Galibert
2017-10-06 14:54 ` Matthew Wilcox
2017-10-03 16:40 ` Theodore Ts'o
2017-10-03 17:32 ` Adam Borowski
2017-10-03 18:58 ` Theodore Ts'o
2017-10-03 19:12 ` Casey Schaufler
2017-10-05 16:16 ` J. Bruce Fields
2017-10-06 2:09 ` Dave Chinner
2017-10-06 14:38 ` J. Bruce Fields
2017-10-06 14:57 ` Matthew Wilcox
2017-10-06 20:00 ` Theodore Ts'o [this message]
2017-10-08 22:03 ` Dave Chinner
2017-10-05 13:47 ` Alan Cox
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=20171006200000.c3yetuu7xpifxu7l@thunk.org \
--to=tytso@mit.edu \
--cc=bfields@fieldses.org \
--cc=david@fromorbit.com \
--cc=kilobyte@angband.pl \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
--cc=willy@infradead.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).