linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Allison <jra@samba.org>
To: Eric Rannaud <e@nanocritical.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
	Christoph Hellwig <hch@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC PATCH] fs: allow open(dir, O_TMPFILE|..., 0) with mode 0
Date: Mon, 3 Nov 2014 14:07:07 -0800	[thread overview]
Message-ID: <20141103220707.GJ5389@samba2> (raw)
In-Reply-To: <CAH_=xobsXZq9M-vXDN_+cQmvRLtgPOzHMbrnzsEToMgLD5CoxA@mail.gmail.com>

On Mon, Nov 03, 2014 at 10:49:24AM -0800, Eric Rannaud wrote:
> On Mon, Nov 3, 2014 at 9:06 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> >> That doesn't help because we explicitly reject O_RDONLY when combined
> >> with O_TMPFILE.
> >
> > I think I'm missing something.  How is an O_RDONLY temporary file
> > useful?  Wouldn't you want an O_RDWR tempfile with mode 0400 or
> > something like that?
> 
> Isn't it because they are essentially emulating an atomic open()
> capable of creating a file with inherited ACLs, according to
> relatively complex rules? open *can* be used with O_CREAT|O_RDONLY
> (touch(1) might do that), which would naively translate into:
> 
>         fd = open(dir, O_TMPFILE|O_RDONLY, 0600)
>         fsetxattr(fd, "...")
>         fsetxattr(fd, "...")
>         linkat(AT_FDCWD, "/proc/self/fd/...", ..., AT_SYMLINK_FOLLOW)
>         return fd;
> 
> Now this would be happening on the server, and the only reason why it
> would be important to ensure that fd is O_RDONLY, is that smbd does
> not do its own bookkeeping of how each file handle was opened, and
> would rather have the kernel enforce O_RDONLY?
> 
> With O_TMPFILE as implemented now, smbd would have to do open(dir,
> O_TMPFILE|O_RDWR, 0600), but internally keep track that O_RDONLY was
> requested by the client on that fd, and block any writes to fd itself.

Which we already do, actually..

Although the atomic open emulation is
a very interesting idea for us. That's
something we currently don't do correctly
across different protocols (although we
do it between smbd's themselves).

Jeremy.

  parent reply	other threads:[~2014-11-03 22:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  9:08 [RFC PATCH] fs: allow open(dir, O_TMPFILE|..., 0) with mode 0 Eric Rannaud
2014-10-30 21:48 ` Andy Lutomirski
2014-10-30 22:48   ` Linus Torvalds
2014-10-30 22:58     ` Linus Torvalds
2014-10-31  0:01       ` Andy Lutomirski
2014-10-31  0:59         ` Linus Torvalds
2014-10-31  8:42         ` Christoph Hellwig
2014-10-31 18:44           ` Andy Lutomirski
2014-10-31 18:53             ` Linus Torvalds
2014-11-03  8:34               ` Christoph Hellwig
2014-11-03 17:05                 ` Linus Torvalds
2014-11-03 17:06                 ` Andy Lutomirski
2014-11-03 18:49                   ` Eric Rannaud
2014-11-03 19:04                     ` Linus Torvalds
2014-11-05  8:27                       ` Christoph Hellwig
2014-11-05 15:21                         ` Eric Rannaud
2014-11-05 15:32                           ` Andy Lutomirski
2014-11-05 17:10                             ` Linus Torvalds
2014-11-03 22:07                     ` Jeremy Allison [this message]
2014-11-05  8:25                       ` Christoph Hellwig
2014-10-31  0:57       ` Eric Rannaud
2014-10-31  1:04         ` Linus Torvalds
2014-10-31  2:12           ` Eric Rannaud

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=20141103220707.GJ5389@samba2 \
    --to=jra@samba.org \
    --cc=akpm@linux-foundation.org \
    --cc=e@nanocritical.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --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;
as well as URLs for NNTP newsgroup(s).