From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: mtk.manpages@gmail.com, Mike Frysinger <vapier@gentoo.org>,
linux-man@vger.kernel.org, Richard Weinberger <richard@nod.at>,
lkml <linux-kernel@vger.kernel.org>,
pschiffe@redhat.com
Subject: Re: [PATCH] open(2): document O_PATH
Date: Tue, 8 Jan 2013 18:52:02 +0000 [thread overview]
Message-ID: <20130108185202.GA22857@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120503141156.GP6871@ZenIV.linux.org.uk>
On Thu, May 03, 2012 at 03:11:56PM +0100, Al Viro wrote:
> On Thu, May 03, 2012 at 07:34:35PM +0530, Aneesh Kumar K.V wrote:
>
> > I looked at dnotify_flush, they remove markers on an inode.
> > But then it also checks for filp to match. So I am not sure
> > whether skipping dnotify_flush for O_PATH descriptor have any impact. We
> > can't use O_PATH descriptor for dnotify fcntl any way. So in
> > dnotify_flush we will not match the filp.
> >
> > Viro,
> >
> > Any reason why we skip dnotify_flush ?
>
> See your last sentence above - why bother finding the mark, scanning the
> list, etc. when we know that there won't be any matches?
[Apologies for replying to the wrong posting, but this is the closest thing
thread-wise to what I wanted to reply to that I've got sitting in my mailbox]
The rules are:
* syscalls acting purely on descriptor level are allowed - close(),
dup(), dup2(), dup3(), fcntl(F_DUPFD{,_CLOEXEC}), fcntl(F_[SG]ETFD),
fcntl(F_GETFL), passing descriptors in SCM_RIGHTS datagrams)
* syscalls using the descriptor just to indicate a location in
the tree - *at() family, fchdir(), fstat()
The list might get expanded - for example, fstatfs() arguably belongs to the
second group. The approach had been conservative - the second group gets
expanded on per-case basis. E.g. anything requiring the file to have
been opened for write is *not* a candidate, so it really has to be reviewed
separately for each syscall of that sort.
As far as dnotify and POSIX locks go, close() (and replacing dup2(), etc.)
are irrelevant - the rules are exactly as usual. All dnotify watches or
POSIX locks associated with that opened file get evicted; it's just that
there is no way to *set* them on O_PATH descriptors in the first place.
We might eventually allow fcntl(F_NOTIFY) on them, but I'm not sure there's
any good reason to do so; allowing to use them for setting POSIX locks is
almost certainly a bad idea wrt security.
The test in filp_close() is just an optimization - if/when we allow F_NOTIFY
on O_PATH descriptors, the same commit will need to make the call of
dnotify_flush() in filp_open() unconditional. All there is to it...
next prev parent reply other threads:[~2013-01-08 18:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1335669917-23970-1-git-send-email-vapier@gentoo.org>
2012-04-29 21:39 ` [PATCH] open(2): document O_PATH Michael Kerrisk (man-pages)
2012-04-30 7:39 ` Aneesh Kumar K.V
2012-04-30 11:44 ` Ted Ts'o
2012-05-03 6:48 ` Michael Kerrisk (man-pages)
2012-05-03 8:27 ` Aneesh Kumar K.V
2012-05-03 13:07 ` Ted Ts'o
2012-05-03 13:20 ` Al Viro
2012-05-06 1:00 ` H. Peter Anvin
2012-05-03 6:47 ` Michael Kerrisk (man-pages)
2012-05-03 14:04 ` Aneesh Kumar K.V
2012-05-03 14:11 ` Al Viro
2012-05-05 11:31 ` Michael Kerrisk (man-pages)
2013-01-08 18:52 ` Al Viro [this message]
2013-03-14 9:35 Michael Kerrisk (man-pages)
2013-07-20 11:40 ` Al Viro
2013-07-20 20:56 ` Michael Kerrisk
2013-07-22 8:46 ` Peter Schiffer
2013-07-22 10:45 ` Michael Kerrisk (man-pages)
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=20130108185202.GA22857@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=pschiffe@redhat.com \
--cc=richard@nod.at \
--cc=vapier@gentoo.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