linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. R. Okajima" <hooanon05@yahoo.co.jp>
To: Valerie Aurora <vaurora@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Erez Zadok <ezk@cs.sunysb.edu>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: Union mounts and fchown/fchmod/utimensat
Date: Sun, 28 Mar 2010 00:43:23 +0900	[thread overview]
Message-ID: <23818.1269704603@jrobl> (raw)
In-Reply-To: <20100326224533.GB29874@shell>


Valerie Aurora:
> My question: How often do applications actually attempt fchown(),
> fchmod(), or utimensat() on an O_RDONLY file descriptor?  Would it
> break a lot of applications if a union mount file returned EBADF or
> EPERM in this case?

Unfortunately I don't know how often it is.
But I am afraid it will be insufficient even if you implement the error.
Do you remember the sample case I've written before?
For instance,

	fd1 = open(path, O_RDONLY);
	fd2 = open(path, O_RDWR);
	fchmod(fd2);
	fstat(fd1, &st);

In this case, fchmod will not return the error because fd2 is opened for
write and the file would be copied-up. And the next fstat for fd1 will
return a bogus info since fd1 still refers the file on the lower layer.
Regardless fchmod() is issued by the same process or different one,
fstat() lies.
This is the same scenario I wrote before essentially (Jul 2009).

Also we should take care of the file-locking.
The copyup by UnionMount will break fcntl(F_SETLK) easily in the same
scenario. But I am not sure how many applications depend upon file lock
and UnionMount copyup affect.

  reply	other threads:[~2010-03-27 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 22:45 Union mounts and fchown/fchmod/utimensat Valerie Aurora
2010-03-27 15:43 ` J. R. Okajima [this message]
2010-03-29 18:39   ` Valerie Aurora
2010-03-29 23:48     ` Jamie Lokier
2010-03-30 11:16       ` Theodore Tso
2010-03-30 20:30         ` Valerie Aurora
2010-03-30 21:31       ` Valerie Aurora

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=23818.1269704603@jrobl \
    --to=hooanon05@yahoo.co.jp \
    --cc=ezk@cs.sunysb.edu \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=vaurora@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).