Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5032658ybp; Mon, 7 Oct 2019 18:34:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqx70CzOJs2o4RvNJDjMwyLqt3CpR6E4FfleCZAhYqEiKUJt5hwGCg8WZsPEdM0u8o6SrQkH X-Received: by 2002:a17:906:d926:: with SMTP id rn6mr26138520ejb.175.1570498473122; Mon, 07 Oct 2019 18:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570498473; cv=none; d=google.com; s=arc-20160816; b=DfWtzckOzZTQsjz1ZcsF/kAuhzYQCSYrLlyLPvL8AaWhyQ781bNPRIpxLqJx28HM/d VbfayXmJhjqbJfB6djOVt9oe4Z1W/1WmeSyq1Sr3z6boQKdlRP8UeopmhHQdMTvNNvoj gZNGttG0mQ0w+5s5g0OzNrmsvCewPdX+7iJjNrknPQVC3Lw3pACowJ+lDEz85GeDkZpw dobn+W0f1ECMHlDOghH2zFYF0DfD+chg+Lcpn2ZBFNsfhd0lTdX1xCkCXLrbakj81LCR fEuXmg5L8CekOCHMJB0d6OUNvxVzF1qUdHGQjVdJTco0/Dy0BdAMiQa8Gzzok3vk97GC uvEg== 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=gtQvCGssnAWsQNpSwNCkzHpPnPltydSUHqdlPUgC7Ms=; b=pMMrGI9TCzGdRLbzvFSR2sM/YMn4+z5JEtBc9WS1J8BqoHKS6XVUhbzqOiMhPDIWvv juxjuuT/mcumilfUjzxt7dLmPk4ZecwhEjeGTD3/xKCQc1RyhQayTCKlgKhSUbmujDr4 SdYTic3EOVdKJ5Aqq5TFD5MsS6BuF/hwkiF6Hf1jv4FOiM9ohY1hSctfRe/joMMYuzFY peSgVf21OSl6pS+pW5kcb+gtAqa57AyyDVV+9PnCBzKM6LVxEnD13/ZZLL2iXG7XlsBy upd9CZT8X1hR33mS3Pj79aBrMTuCsEIu1aFICBFuhLwiR/IF7luc4mISFuGcrdbpqhvP L0Jg== 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 29si8536509eje.235.2019.10.07.18.34.09; Mon, 07 Oct 2019 18:34:33 -0700 (PDT) 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 S1729457AbfJHBeG (ORCPT + 99 others); Mon, 7 Oct 2019 21:34:06 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:31464 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbfJHBeF (ORCPT ); Mon, 7 Oct 2019 21:34:05 -0400 Received: from smtp2.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id D7967A33B3; Tue, 8 Oct 2019 03:34:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id oK7UU0kzyVpP; Tue, 8 Oct 2019 03:33:57 +0200 (CEST) Date: Tue, 8 Oct 2019 12:33:46 +1100 From: Aleksa Sarai To: Jann Horn Cc: Al Viro , Michael Kerrisk , Christian Brauner , Aleksa Sarai , linux-man , Linux API , kernel list Subject: Re: [PATCH RFC 1/3] symlink.7: document magic-links more completely Message-ID: <20191008013346.7qft2qqz4wz7ld35@yavin.dot.cyphar.com> References: <20191003145542.17490-1-cyphar@cyphar.com> <20191003145542.17490-2-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2q45tajd22yttzl5" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --2q45tajd22yttzl5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-10-07, Jann Horn wrote: > On Thu, Oct 3, 2019 at 4:56 PM Aleksa Sarai wrote: > > Traditionally, magic-links have not been a well-understood topic in > > Linux. Given the new changes in their semantics (related to the link > > mode of trailing magic-links), it seems like a good opportunity to shine > > more light on magic-links and their semantics. > [...] > > +++ b/man7/symlink.7 > > @@ -84,6 +84,25 @@ as they are implemented on Linux and other systems, > > are outlined here. > > It is important that site-local applications also conform to these rul= es, > > so that the user interface can be as consistent as possible. > > +.SS Magic-links > > +There is a special class of symlink-like objects known as "magic-links= " which >=20 > I think names like that normally aren't hypenated in english, and > instead of "magic-links", it'd be "magic links"? Just like how you > wouldn't write "symbolic-link", but "symbolic link". But this is > bikeshedding, and if you disagree, feel free to ignore this comment. Looking at it now, I think you're right -- I hyphenated it here because that's how I wrote it when documenting the feature in comments. But I think that's because "symlink" and "magic-link" (the "abbreviated" versions) seem to match better than "symlink" and "magic link". I'll use "magic link" in documentation, but "magic-link" for all cases where I would normally write "symlink". > > +can be found in certain pseudo-filesystems such as > > +.BR proc (5) > > +(examples include > > +.IR /proc/[pid]/exe " and " /proc/[pid]/fd/* .) > > +Unlike normal symlinks, magic-links are not resolved through >=20 > nit: AFAICS symlinks are always referred to as "symbolic links" > throughout the manpages. :+1: > > +pathname-expansion, but instead act as direct references to the kernel= 's own > > +representation of a file handle. As such, these magic-links allow user= s to > > +access files which cannot be referenced with normal paths (such as unl= inked > > +files still referenced by a running program.) >=20 > Could maybe add "and files in different mount namespaces" as another > example here; at least for me, that's the main usecases for > /proc/*/root. Will do. > [...] > > +However, magic-links do not follow this rule. They can have a non-0777= mode, > > +which is used for permission checks when the final > > +component of an > > +.BR open (2)'s >=20 > Maybe leave out the "open" part, since the same restriction has to > also apply to other syscalls operating on files, like truncate() and > so on? Yes (though I've just realised I hadn't implemented that -- oops.) Given how expansive this patchset will get -- I might end up splitting it into the magic-link stuff (and O_EMPTYPATH) and a separate series for openat2(2) and the path resolution restrictions. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --2q45tajd22yttzl5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXZvndgAKCRCdlLljIbnQ Em8rAP9zDYU4BspEqrhHWm9St1g7MKKDDBGjzIBK742FA4EA6gD9FXqkmZPXhZHY m/PlSBGP4lC67Pms1YwaoDM1pk2x+Ak= =dsvW -----END PGP SIGNATURE----- --2q45tajd22yttzl5--