From: Valdis.Kletnieks@vt.edu
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] a corner case of open(2)
Date: Tue, 26 Apr 2016 15:25:16 -0400 [thread overview]
Message-ID: <92598.1461698716@turing-police.cc.vt.edu> (raw)
In-Reply-To: <20160426190248.GQ25498@ZenIV.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 993 bytes --]
On Tue, 26 Apr 2016 20:02:48 +0100, Al Viro said:
> > The biggest danger I can see is some shell script doing something like:
> >
> > foobar > $dir/$targetfile
> >
> > and $targetfile is unset. If we allow a program to get an open fd that refers
> > to a directory, what are the semantics of various operations on that fd?
>
> Huh? We certainly do allow to get an open fd that refers to a directory -
> how else could ls(1) possibly work? See getdents(2) - it does use an
> open file descriptor to specify the directory we operate upon.
Gaah.. I lost a few words in there - /bin/ls is *expecting* to operate on
a directory, so to calls getdents. I meant some generic program that
opened a directory in error, and was expecting to act on "stream of bytes"
> We also do not allow opening directories for *write*, and in that case EISDIR
> is the right error (and we do return it).
OK, that and ftruncate() are about the only ways to cause trouble with a
directory opened by accident...
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
next prev parent reply other threads:[~2016-04-26 19:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 17:55 Al Viro
2016-04-26 18:05 ` Cedric Blancher
2016-04-26 18:15 ` Al Viro
2016-04-26 18:41 ` Valdis.Kletnieks
2016-04-26 19:02 ` Al Viro
2016-04-26 19:25 ` Valdis.Kletnieks [this message]
2016-04-26 20:17 ` Al Viro
2016-04-27 5:34 ` Al Viro
2016-04-27 9:33 ` Miklos Szeredi
2016-04-27 19:29 ` another patch in #for-linus (was Re: [RFC] a corner case of open(2)) Al Viro
2016-05-02 21:48 ` Pavel Machek
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=92598.1461698716@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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®