Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2433806ybf; Mon, 2 Mar 2020 08:32:23 -0800 (PST) X-Google-Smtp-Source: ADFU+vuF0rpCXsJbj7qslFzkE9I19Kn3OHbVuipO1eZbRyeprTxTQs6PfWV8DA5OgQ/TPxHfmklz X-Received: by 2002:a05:6808:a08:: with SMTP id n8mr219103oij.91.1583166743702; Mon, 02 Mar 2020 08:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583166743; cv=none; d=google.com; s=arc-20160816; b=vin0DzT19k9urWLFddGpOVHZx36l338v0XTg6oYl/xrcakV5umK9XV5cc2R1bzrukR GL6XSJxTZVunyq4ZWYYKnSvZDuJ1HXwnI5gKxcKWU7C4XzCXwuKtroQh0YOxLQ51tqV2 Qnmjh3tdAeyGZCQeLlKW5Zkg0VtQR7RICQ6CuvSVaT7RFHe029jl7xrS5gJ59EDBf/wC JG7yiBRVMBknvQp7awOCnqLzYcO0jGpJ17hGGRPEOQ3Xlyx7kaneTxpxowuJLOOgEOkV FG7wR52kLWNmHna1pq7GafVwitQ6Z6sP1QqYsepqxCE3KRcU2SUT4x4YJlNNvyFIvbp3 33ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CZqx99Ubzz8Hj2IuPFGTG13uc6uK9a94NNXpbCVPewU=; b=cDlMWgVvLXdxS9mvFWn5kOobmcsicNfnkhRanz+9HKL7glTETmkA9+729C0f5PvIUt xiiklZp7JnEmwBpRwsk42n0NTj39yELKSKOuj9Z07MgtPJYIXD37JoMlmm01u+WRnK5c /badGqPcp5CeMDL0mThUAI6HsB6E/J9kPaG8c0RSXyiIhL9zzcar/UT8hzu/wTpqsy4b RjTihsoyc+uj/P52aDjXZfYINb+wid526Qa09ps9qSyBNbHy9fFcZySZ2UnOyMJ16b0r gQpeSY/IwKQd6zb01vJ5CUpqivMQhPBDfDz1DdV2IYR/la9Q71O2uebatUXYtvXQ9nsG +BtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si5397848oih.257.2020.03.02.08.32.11; Mon, 02 Mar 2020 08:32:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbgCBQcC (ORCPT + 99 others); Mon, 2 Mar 2020 11:32:02 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:37384 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbgCBQcC (ORCPT ); Mon, 2 Mar 2020 11:32:02 -0500 Received: from ip5f5bf7ec.dynamic.kabel-deutschland.de ([95.91.247.236] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j8nz1-00070K-Mf; Mon, 02 Mar 2020 16:31:55 +0000 Date: Mon, 2 Mar 2020 17:31:54 +0100 From: Christian Brauner To: Aleksa Sarai Cc: Florian Weimer , David Howells , 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? Message-ID: <20200302163154.mpdf5oex3hxnrmvc@wittgenstein> References: <96563.1582901612@warthog.procyon.org.uk> <20200228152427.rv3crd7akwdhta2r@wittgenstein> <87h7z7ngd4.fsf@oldenburg2.str.redhat.com> <20200302115239.pcxvej3szmricxzu@wittgenstein> <20200302120503.g5pt4ky3uvb2ly63@wittgenstein> <20200302151046.447zgo36dmfdr2ik@wittgenstein> <20200302153657.7k7qo4k5he2acxct@yavin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200302153657.7k7qo4k5he2acxct@yavin> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 03, 2020 at 02:36:57AM +1100, Aleksa Sarai wrote: > On 2020-03-02, Christian Brauner 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. Right, O_NOFOLLOW would've been kinda neat too because afaict it's the only flag left that is specifically related to path resolution in there that would fit nicely into open_how->resolve. :) > > 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 No version of this will be completey satisfying I fear. Christian