Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp793820imm; Wed, 17 Oct 2018 08:24:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV62L2lWrQTEZlrlztOJTRPBWPZ2QIqVlJLjquwy/uPawKJ4yCr113868oy5Lfp182/5cLY6x X-Received: by 2002:a62:2542:: with SMTP id l63-v6mr27518227pfl.64.1539789878147; Wed, 17 Oct 2018 08:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539789878; cv=none; d=google.com; s=arc-20160816; b=afFq6hdZxVescl2Xkf/DI9CRid/JctaYuJOi/zypdS1AMb04/ZyPrrOpY4ULMgvE9F emkTnVUWg96KhQdkVeOAGToWeZwUXmE5GlFZ24rgH38VVEzYvvRdVg1l6Qhd4Np7DbI5 6z2z7m+vUyQz+zwmKj15ysDGply3Lwdw+kmd3oBSPvlqszwmLb4dcBfvX8aVwA62B/m4 A+aE/YJ31KtpAEQEAzGCtZL5NXfRXkejOIMsYQc/dsKFhIdY8JscgpfPFClqmMfyFVI9 ERkacHn1LiuDDd8g4+Iv8gLsmHlCquIbArWoZ2BhgJx69K/hxi+ZgALeivcjM+kreI6D QTTg== 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=pzfGUbS4e43j/ILu8MEzNu0y05PHrqZ+h9+cu6VWCDo=; b=NQu/BWiX40TN3OW2OpsFZ8SVrL3KCZyd3PXc4dIbP0BdGNyo2z4Gc2CWUmxUIpvUgD OeICANdn5dhSK3/WgbHlgAF4eKLgQafpdR+t7P9aLQuV36jVRdRpt/G7MfROC2iQdNrz dzPLVeqH8DHoykLx87A1bmXHl8h4RFwMXbPNs1m0byg7OTUkCQQ/MXK8AU2S0rtTm2Tf XLL6w2uvEPG1cS9UuVRsB2gaufbLCxlKkRSSx9bPGXU3LJo0wcisqU8Y0aPtvKBzUuhj 1d0A2/P5RiC4zhBx/nI0/MHT03Q6epbZRvWdx7GTp4vibz7S44Q6nYT4TNMa873gE7Pw XcIg== 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 a5-v6si17753388pgj.275.2018.10.17.08.24.22; Wed, 17 Oct 2018 08:24:38 -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 S1727509AbeJQXT7 (ORCPT + 99 others); Wed, 17 Oct 2018 19:19:59 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:15364 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXT7 (ORCPT ); Wed, 17 Oct 2018 19:19:59 -0400 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 0DF2E40ABD; Wed, 17 Oct 2018 17:23:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id vlT2dOdZJDGe; Wed, 17 Oct 2018 17:23:44 +0200 (CEST) Date: Thu, 18 Oct 2018 02:23:32 +1100 From: Aleksa Sarai To: Al Viro , Eric Biederman Cc: Andy Lutomirski , David Howells , Jann Horn , Christian Brauner , David Drysdale , containers@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Tycho Andersen , dev@opencontainers.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v3 0/3] namei: implement various lookup restriction AT_* flags Message-ID: <20181017152332.madyld45jvhtoog3@ryuk> References: <20181009070230.12884-1-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yre24zmboslmb52j" Content-Disposition: inline In-Reply-To: <20181009070230.12884-1-cyphar@cyphar.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yre24zmboslmb52j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-10-09, Aleksa Sarai wrote: > The need for some sort of control over VFS's path resolution (to avoid > malicious paths resulting in inadvertent breakouts) has been a very > long-standing desire of many userspace applications. This patchset is a > revival of Al Viro's old AT_NO_JUMPS[1,2] patchset (which was a variant > of David Drysdale's O_BENEATH patchset[3] which was a spin-off of the > Capsicum project[4]) with a few additions and changes made based on the > previous discussion within [5] as well as others I felt were useful. I've been thinking about this problem a little more (from the UX side of things) and I have a feeling that adding 5 different O_* flags related to resolution -- rather than properties related to opening the file -- might be less than ideal (even though, as discussed in previous threads, there is a need for these flags and for them to be separated). There is *some* precedence for this with O_PATH[**] changing fairly large semantics of openat(2) but there are some things about O_PATH which I think could be improved. What if we had a resolveat(2) which acted like openat(..., O_PATH) *but* it allowed us to have new flags and to separate the scoping flags from the (fairly limited) space of O_* flags. Then O_PATH could effectively just be a legacy way of doing resolveat(2) -- with only O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW support. And the main things we could add would be: * These resolution flags, with only support available from resolveat(2) for the moment. The idea would be that AT_EMPTY_PATH would be the recommended way to make use of this. * Support for RESOLVE_{NOPERM,RDONLY,WRONLY,RDWR} (which after some discussions with Eric last year might be necessary in order to make /proc/$pid/fd/$fd re-opening of O_PATH descriptors safer -- which is something that we use in both runc and LXC). Is this idea palatable, or was this something considered during the development of O_PATH and someone had an argument why augmenting O_PATH is better than a new syscall? [**] And while writing this paragraph I noticed that I didn't update the O_PATH "flag whitelist" to allow the scoping flags to affect it. I will include a fix for this in v4 (I must've lost it in an early rebase before I sent v1). --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --yre24zmboslmb52j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXzbGxhtUYBJKdfWmnhiqJn3bjbQFAlvHU/EACgkQnhiqJn3b jbQ9yg/7BtjjNaT0TCHf7tBBGch6f70YhcTrfpJBxLByOep4fb/HsSXTMhcy6cCI ZzmSMXyuNOhlxdg7b1ON5+rLJY0MDmsVzaLhCKCg0erstdTSESUdt7yqnAz5qPw6 +Sag25hC7wXl8U2/Wem/JK9JZXEAcCfUiadac8MF7tWluy/Ivf/mWhsvkmCN00UY TfSVlb7t83PwGEpTEzdbZ6IkwdEIky44vYJl/Phbau/01A8tM51f74KiDlos/+XH eMkzU9MYdhG7bsmEh+erBGCuiFevJ+ffAerjerwhqKOCi6KAEbiQJSqxlbRX2rmT 7azLPL6IiJjH47NfnXIo1gTgXKJYp8up7esQpj/lbcP7ZraxEveBQpvTxvGHEdUM +7CzFxDIVbljZD6kRgvTM/iY5KXHFVcCsg+7NhRbfQoqViJeLL8hRshtqki2+zbX 3fSmkKYIRzkMirrePpT0VVLJw7mkVQfPVAyyn4ZixM+ECzkLSTnwaac33IVvLH6z 86Tf9yBPnpeH7A0MaCUs0EfTSV6hnSV9Wc2RYK+C5bTnBHUUCmO0gN6WIFSHtNAI BynbcTmD3YACuFxa4hB/h/zqsjrKaSi8g6gVq21+Q10w3iMM93rAZwjaMTGjS1A3 AScZfEJi459Ez/xq7+rwThMW5BD66aX/txL95J+bV8B55V7uvX0= =06RI -----END PGP SIGNATURE----- --yre24zmboslmb52j--