Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2363492ybf; Mon, 2 Mar 2020 07:12:26 -0800 (PST) X-Google-Smtp-Source: ADFU+vsdZX19mi0ot9rI4TvidUZtNRwr9BDfipXzVcbJpWb34prx6CGVpNsIpXcgWNVpQ/N1M8yz X-Received: by 2002:a05:6830:3148:: with SMTP id c8mr1897030ots.359.1583161945901; Mon, 02 Mar 2020 07:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583161945; cv=none; d=google.com; s=arc-20160816; b=kWG0WIez23seNSqNuS3g31n9tC1YC8rrniaG4oaew9JL1icoJmahq8C9KD6tjOkoGy iiNVQ2v2oglznW7B8haVOkN/SnRerIZhC9+IJw0ZVt1X6Czrido/GZbqmaAyQK2GioNY Pt2+DWSPDEiuFmPzaX3LHqCuSL77xXXdHcvMhoK1jCBo8tSx6xU0B8c2nJCAfoXyo1eQ vNCYcgD+MPLuLC2m/sVmTLhYS2+XTQwk3Esu/m2Aw4N4tP5f1BOBmJ/njPvFx3kSiOEt /3xtB84BqfrkMcgIaYdhMue0LsP/CFU2nYQiOBAowqL56T+wx32lyUHxci/upzyY75Bo QHBw== 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=pa/CctI66XbqrLywl+GhRVyPCnWX0EKjXxV/0BMVQOM=; b=Xjx18/R+D+MZfuWAVL++b24ZVIQLyP8WdtYcrvGfgFAAGTF4EKnO7NGtiabrTtZbua S18nOTSWpnsXoowAvfY+JLIS6LAMd/jJLbNNnUR5/1DkohEdYnnsAO6nA3kfOJgdEXU9 FmpN3NS/2GYg0Qqo91tnStxhyUay3SjolIGB7Ku4h0mELQJ5F2JdssQJLA7+jyauARMR ts9dylB36zGbPjEB6YFLc11FcK58zRnwAW9vgU1OYK16bIh6Eq41XGuDxzbe5/rwKHrV p2BJ//Ix51T7oayBxuaZvK9EbIuJGfesBZaLknqSaVb8paOyrOdgn0ra6J9xD6bZLCMY LYpw== 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 74si6134359otd.45.2020.03.02.07.12.13; Mon, 02 Mar 2020 07:12:25 -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 S1727170AbgCBPKg (ORCPT + 99 others); Mon, 2 Mar 2020 10:10:36 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:30624 "EHLO mout-p-101.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbgCBPKg (ORCPT ); Mon, 2 Mar 2020 10:10:36 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 48WNqs5Tn3zKmgv; Mon, 2 Mar 2020 16:10:33 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id BoVpdSSri02n; Mon, 2 Mar 2020 16:10:30 +0100 (CET) Date: Tue, 3 Mar 2020 02:10:21 +1100 From: Aleksa Sarai To: David Howells Cc: Christian Brauner , Florian Weimer , 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: <20200302151021.x5mm54jtoukg4tdk@yavin> References: <20200302143546.srzk3rnh4o6s76a7@wittgenstein> <20200302115239.pcxvej3szmricxzu@wittgenstein> <96563.1582901612@warthog.procyon.org.uk> <20200228152427.rv3crd7akwdhta2r@wittgenstein> <87h7z7ngd4.fsf@oldenburg2.str.redhat.com> <848282.1583159228@warthog.procyon.org.uk> <888183.1583160603@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="42vyj6s72ngbbu3r" Content-Disposition: inline In-Reply-To: <888183.1583160603@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --42vyj6s72ngbbu3r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-03-02, David Howells wrote: > Christian Brauner wrote: >=20 > > I think we settled this and can agree on RESOLVE_NO_SYMLINKS being the > > right thing to do, i.e. not resolving symlinks will stay opt-in. > > Or is your worry even with the current semantics of openat2()? I don't > > see the issue since O_NOFOLLOW still works with openat2(). >=20 > Say, for example, my home dir is on a network volume somewhere and /home = has a > symlink pointing to it. RESOLVE_NO_SYMLINKS cannot be used to access a f= ile > inside my homedir if the pathwalk would go through /home/dhowells - this = would > affect fsinfo() Yes, though this only happens if you're opening "/home/dhowells/foobar". If you are doing "./foobar" from within "/home/dhowells" it will work (or if you open a dirfd to "/home/dhowells") -- because no symlink resolution is done as part of that openat2() call. > So RESOLVE_NO_SYMLINKS is not a substitute for AT_SYMLINK_NOFOLLOW > (O_NOFOLLOW would not come into it). This is what I was saying up-thread -- the semantics are not the same *on purpose*. If you want "don't follow symlinks *only for the final component*" then you need to have an AT_SYMLINK_NOFOLLOW equivalent. My counter-argument is that most people actually want RESOLVE_NO_SYMLINKS (as evidenced by the countless symlink-related security bugs -- many of which used O_NOFOLLOW incorrectly), it just wasn't available before Linux 5.6. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --42vyj6s72ngbbu3r Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXl0h2gAKCRCdlLljIbnQ EpMTAP95ffUjqS37ZYriNgIdtHux4Y3D4HV/fCw6z5s7POmk9wD/XALcyw1lQ95P oClztyDXpLWzGUBlyXyIjwfr8nXAPw4= =PmLG -----END PGP SIGNATURE----- --42vyj6s72ngbbu3r--