linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rich Felker <dalias-/miJ2pyFWUyWIDz0JBNUog@public.gmane.org>
To: Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Request for comments: reserving a value for O_SEARCH and O_EXEC
Date: Mon, 12 Aug 2013 23:22:15 -0400	[thread overview]
Message-ID: <20130813032214.GA221@brightrain.aerifal.cx> (raw)
In-Reply-To: <52091E6B.10800-3s7WtUTddSA@public.gmane.org>

On Mon, Aug 12, 2013 at 10:42:03AM -0700, Andy Lutomirski wrote:
> You'll have the same problem that O_TMPFILE had: the kernel currently
> ignores unrecognized flags.  I wonder if it's time to add a new syscall
> (or syscalls) with more sensible semantics.

That's not a problem here. In fact, in the case where O_PATH is not
supported by the kernel, the best possible behavior for O_SEARCH and
O_EXEC would be for them to be the same as O_RDONLY, since this gives
comforming behavior in all ways except that it will fail if you don't
have read access to the file.

Some folks have raised the issue that it would be "dangerous" because
certain devices have side effects on open, even open for read, but
POSIX does not specify that opening for search or exec suppresses such
side effects anyway. It's only applications directly using O_PATH and
expecting the Linux semantics that would be thrown off by getting
O_READ semantics instead. In any case, there are many reasons it's
unsafe for a privileged process to open an untrusted pathname already.

Anyway, the whole point of this discussion is about choosing a value
that has the best fallback behavior on old kernels. O_PATH alone would
meet that requirement almost perfectly, but it has the unfortunate
issue that O_NOFOLLOW is interpreted in a special way with O_PATH: it
causes the symlink itelf to be opened, rather than for open to fail
when encountering a symlink. So we need a new flag by which the kernel
could detect and reject symlinks with O_PATH, _or_ the kernel could
just ignore this new flag, since userspace will have to check (to
support older kernels) that it did not get a symlink, and if so,
simulate failure.

Rich

  parent reply	other threads:[~2013-08-13  3:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130803024808.GA26932@brightrain.aerifal.cx>
     [not found] ` <20130803024808.GA26932-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2013-08-12 17:42   ` Request for comments: reserving a value for O_SEARCH and O_EXEC Andy Lutomirski
     [not found]     ` <52091E6B.10800-3s7WtUTddSA@public.gmane.org>
2013-08-13  3:22       ` Rich Felker [this message]
2013-08-05 22:25 Rich Felker
2013-08-06  5:54 ` Christoph Hellwig
     [not found]   ` <20130806055425.GA9280-jcswGhMUV9g@public.gmane.org>
2013-08-06 13:42     ` Rich Felker
2013-08-06 14:03       ` Christoph Hellwig
     [not found]         ` <20130806140321.GA4421-jcswGhMUV9g@public.gmane.org>
2013-08-06 14:36           ` Rich Felker
     [not found]             ` <20130806143609.GV221-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2013-08-06 14:51               ` Christoph Hellwig
     [not found]                 ` <20130806145159.GA8192-jcswGhMUV9g@public.gmane.org>
2013-08-06 15:23                   ` Rich Felker
     [not found]                     ` <20130806152316.GW221-C3MtFaGISjmo6RMmaWD+6Sb1p8zYI1N1@public.gmane.org>
2013-08-06 15:53                       ` Joseph S. Myers
2013-08-06 15:54                       ` Christoph Hellwig
     [not found]                         ` <20130806155415.GA12926-jcswGhMUV9g@public.gmane.org>
2013-08-06 16:30                           ` Rich Felker

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=20130813032214.GA221@brightrain.aerifal.cx \
    --to=dalias-/mij2pyfwuywidz0jbnuog@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.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).