linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksa Sarai <cyphar@cyphar.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	David Howells <dhowells@redhat.com>,
	linux-api@vger.kernel.org, viro@zeniv.linux.org.uk,
	metze@samba.org, torvalds@linux-foundation.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Have RESOLVE_* flags superseded AT_* flags for new syscalls?
Date: Tue, 3 Mar 2020 02:36:57 +1100	[thread overview]
Message-ID: <20200302153657.7k7qo4k5he2acxct@yavin> (raw)
In-Reply-To: <20200302151046.447zgo36dmfdr2ik@wittgenstein>

[-- Attachment #1: Type: text/plain, Size: 3916 bytes --]

On 2020-03-02, Christian Brauner <christian.brauner@ubuntu.com> wrote:
> On Mon, Mar 02, 2020 at 01:05:04PM +0100, Christian Brauner wrote:
> > On Mon, Mar 02, 2020 at 12:52:39PM +0100, Christian Brauner wrote:
> > > On Mon, Mar 02, 2020 at 12:30:47PM +0100, Florian Weimer wrote:
> > > > * Christian Brauner:
> > > > 
> > > > > [Cc Florian since that ends up on libc's table sooner or later...]
> > > > 
> > > > I'm not sure what you are after here …
> > > 
> > > Exactly what you've commented below. Input on whether any of these
> > > changes would be either problematic if you e.g. were to implement
> > > openat() on top of openat2() in the future or if it would be problematic
> > > if we e.g. were to really deprecate AT_* flags for new syscalls.
> > > 
> > > > 
> > > > > On Fri, Feb 28, 2020 at 02:53:32PM +0000, David Howells wrote:
> > > > >> 	
> > > > >> I've been told that RESOLVE_* flags, which can be found in linux/openat2.h,
> > > > >> should be used instead of the equivalent AT_* flags for new system calls.  Is
> > > > >> this the case?
> > > > >
> > > > > Imho, it would make sense to use RESOLVE_* flags for new system calls
> > > > > and afair this was the original intention.
> > > > > The alternative is that RESOLVE_* flags are special to openat2(). But
> > > > > that seems strange, imho. The semantics openat2() has might be very
> > > > > useful for new system calls as well which might also want to support
> > > > > parts of AT_* flags (see fsinfo()). So we either end up adding new AT_*
> > > > > flags mirroring the new RESOLVE_* flags or we end up adding new
> > > > > RESOLVE_* flags mirroring parts of AT_* flags. And if that's a
> > > > > possibility I vote for RESOLVE_* flags going forward. The have better
> > > > > naming too imho.
> > > > >
> > > > > An argument against this could be that we might end up causing more
> > > > > confusion for userspace due to yet another set of flags. But maybe this
> > > > > isn't an issue as long as we restrict RESOLVE_* flags to new syscalls.
> > > > > When we introduce a new syscall userspace will have to add support for
> > > > > it anyway.
> > > > 
> > > > I missed the start of the dicussion and what this is about, sorry.
> > > > 
> > > > Regarding open flags, I think the key point for future APIs is to avoid
> > > > using the set of flags for both control of the operation itself
> > > > (O_NOFOLLOW/AT_SYMLINK_NOFOLLOW, O_NOCTTY) and properaties of the
> > > > resulting descriptor (O_RDWR, O_SYNC).  I expect that doing that would
> > 
> > Yeah, we have touched on that already and we have other APIs having
> > related problems. A clean way to avoid this problem is to require new
> > syscalls to either have two flag arguments, or - if appropriate -
> > suggest they make use of struct open_how that was implemented for
> > openat2().
> 
> By the way, if we really means business wrt to: separate resolution from
> fd-property falgs then shouldn't we either require O_NOFOLLOW for
> openat2() be specified in open_how->resolve or disallow O_NOFOLLOW for
> openat2() and introduce a new RESOLVE_* variant?

I think we agreed a while ago we aren't touching O_ flags for openat2()
because it would hamper adoption (this is the same reason we aren't
fixing the whole O_ACCMODE mess, and O_LARGEFILE, and the arch-specific
O_ flags, and O_TMPFILE, and __O_SYNC, and FASYNC/O_ASYNC, and
__FMODE_EXEC and __FMODE_NONOTIFY, and ...).

To be fair, we did fix O_PATH|O_TMPFILE and invalid mode combinations
but that's only because those were fairly broken.

But as I mentioned in a sister mail, I do agree that allowing O_NOFOLLOW
and RESOLVE_NO_TRAILING_SYMLINKS makes me feel a little uneasy. But
maybe it's totally fine and I'm worrying for no reason.

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2020-03-02 15:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 14:53 Have RESOLVE_* flags superseded AT_* flags for new syscalls? David Howells
2020-02-28 15:24 ` Christian Brauner
2020-02-29 15:26   ` Aleksa Sarai
2020-02-29 15:54     ` Aleksa Sarai
2020-03-01 16:46       ` Christian Brauner
2020-03-01 16:38     ` Christian Brauner
2020-03-02 11:30   ` Florian Weimer
2020-03-02 11:52     ` Christian Brauner
2020-03-02 12:05       ` Christian Brauner
2020-03-02 15:10         ` Christian Brauner
2020-03-02 15:36           ` Aleksa Sarai [this message]
2020-03-02 16:31             ` Christian Brauner
2020-03-02 12:09       ` Florian Weimer
2020-03-02 12:19         ` Christian Brauner
2020-03-02 12:35           ` Christian Brauner
2020-03-02 12:42             ` Florian Weimer
2020-03-02 12:55               ` Christian Brauner
     [not found]               ` <20200305141154.e246swv62rnctite@yavin>
2020-03-05 15:23                 ` Christian Brauner
2020-03-05 14:33             ` David Howells
2020-03-05 14:38               ` Florian Weimer
2020-03-05 14:43               ` David Howells
2020-03-02 14:27     ` David Howells
2020-03-02 14:35       ` Christian Brauner
2020-03-02 14:50       ` David Howells
2020-03-02 15:05         ` Christian Brauner
2020-03-02 15:24           ` Aleksa Sarai
2020-03-02 16:37           ` David Howells
2020-03-06 14:48             ` David Howells
2020-03-02 15:10         ` Aleksa Sarai
2020-03-02 15:23         ` David Howells
2020-03-02 14:30   ` David Howells
2020-03-02 15:04     ` Aleksa Sarai

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=20200302153657.7k7qo4k5he2acxct@yavin \
    --to=cyphar@cyphar.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=dhowells@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metze@samba.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;
as well as URLs for NNTP newsgroup(s).