Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2385841ybf; Mon, 2 Mar 2020 07:37:33 -0800 (PST) X-Google-Smtp-Source: APXvYqy6xcyRlC2y0aej2pgRvyWFg9jiW10jRq4AQlSW61YV+BapwZZJ0dYESjyEOxS7S/ZyihEa X-Received: by 2002:a05:6830:9a:: with SMTP id a26mr13872900oto.273.1583163453638; Mon, 02 Mar 2020 07:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583163453; cv=none; d=google.com; s=arc-20160816; b=AlvQyCUImn7+WXJvg9ZsytafF2BwBekfoHIcKehXn74YlNV+Ud7vWSOImO9LUN/HTS 3ylQuImuFTf0JxxKphE18H8aVgOdz9aRr8kL/QfMwpA0OPW29L9M4/Hw14qkM+GXG7qV LdK0aPJP7iENxaHJsMKJg+9xJTH9cXehmUjjwQ/gEhKdCh5QCttuP2UAtm8/IOX3o1T1 UgxqZrGnfDn5L/BbDr1akGmI5BMnaeQuc8Kuh1uSoan2JOelU3JWlu7xQIKbz8i11cM8 Zou8qQWaAl6ihov97cplOxs0k66PGdcqI/HVMkt0wpi/D9rqjOiytYyf2Olwb6hbESy1 cJow== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iEiL20as1l4sDRRwx30/gIQuzVKWBD4FQaOLKbtWef4=; b=W8v3dm5cLSiyNJMo9s95GBMXt9flKwTplXiwWuuvvq021sF3zS/u154EiWdXxHgKU4 Or381bJeVsDGRzsExr1Diijf48+M6DBEISbAEmTGFg4F7ksI8Q/aYuXhnFpUrOLZufq4 LQ9NYem0B6D0DfykBItfv9haQAQqA2bznlmQznBonTHZ4OwywDNvrkgBYlp7/Iw8hbWG 24lsNnjKscwwKQE4j+AvKDfFUpupmNrI8hE3L1jNe5ruyAGd9mcy+ziWWpeU3v8MH1a5 TM/F9Mr8QrZsmp+F5l9sI7VSLNb8gBXWJrCVPglSZp5VyWZbbZAcg68FtTXTaMWzoZN4 r90w== 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 i13si6164341oth.175.2020.03.02.07.37.18; Mon, 02 Mar 2020 07:37:33 -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 S1727193AbgCBPhM (ORCPT + 99 others); Mon, 2 Mar 2020 10:37:12 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:45268 "EHLO mout-p-201.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbgCBPhM (ORCPT ); Mon, 2 Mar 2020 10:37:12 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 48WPQY1crwzQlKM; Mon, 2 Mar 2020 16:37:09 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id 6OMBcZierEM3; Mon, 2 Mar 2020 16:37:05 +0100 (CET) Date: Tue, 3 Mar 2020 02:36:57 +1100 From: Aleksa Sarai To: Christian Brauner 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: <20200302153657.7k7qo4k5he2acxct@yavin> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z3gcdvurlvimlu7q" Content-Disposition: inline In-Reply-To: <20200302151046.447zgo36dmfdr2ik@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --z3gcdvurlvimlu7q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > > > >=20 > > > > > [Cc Florian since that ends up on libc's table sooner or later...] > > > >=20 > > > > I'm not sure what you are after here =E2=80=A6 > > >=20 > > > 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 problema= tic > > > if we e.g. were to really deprecate AT_* flags for new syscalls. > > >=20 > > > >=20 > > > > > On Fri, Feb 28, 2020 at 02:53:32PM +0000, David Howells wrote: > > > > >> =09 > > > > >> 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 syst= em calls. Is > > > > >> this the case? > > > > > > > > > > Imho, it would make sense to use RESOLVE_* flags for new system c= alls > > > > > 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 ve= ry > > > > > useful for new system calls as well which might also want to supp= ort > > > > > parts of AT_* flags (see fsinfo()). So we either end up adding ne= w 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 be= tter > > > > > naming too imho. > > > > > > > > > > An argument against this could be that we might end up causing mo= re > > > > > confusion for userspace due to yet another set of flags. But mayb= e this > > > > > isn't an issue as long as we restrict RESOLVE_* flags to new sysc= alls. > > > > > When we introduce a new syscall userspace will have to add suppor= t for > > > > > it anyway. > > > >=20 > > > > I missed the start of the dicussion and what this is about, sorry. > > > >=20 > > > > Regarding open flags, I think the key point for future APIs is to a= void > > > > 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 wo= uld > >=20 > > 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(). >=20 > 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. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --z3gcdvurlvimlu7q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXl0oFwAKCRCdlLljIbnQ ElnIAP9m9sYf6BaM1rn8GNQEfGPy2a9VHHurhDb+SjelDPiC7AD9E+jCX3UcZ2+5 gTG0XVFUvphs+TqKngfX+EBNIHB8bw0= =N0M9 -----END PGP SIGNATURE----- --z3gcdvurlvimlu7q--