Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1667867imm; Sat, 13 Oct 2018 01:06:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV63nna0mujNM0t4Okm0A4cS+HXzEf/vt9i42yR89gfdfsSbQqJhDdWoFTHOAdS0fLgkwAK0r X-Received: by 2002:a63:164d:: with SMTP id 13-v6mr8509386pgw.103.1539417970546; Sat, 13 Oct 2018 01:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539417970; cv=none; d=google.com; s=arc-20160816; b=ccFLnAHI7cVXqMc2E4LcNpogb+4tuuZvWPFggfYmkVu01u9IYHmssKz8FKt2a8mUaG UiR7SmaKlZfI2LJiwHWNzjIdjxAjDrOIvEXm0n1MWNtrabCZLaCNxz2Ej8zRVMmefQpa oZ+jNaroRGkzWPtWOd8wcGlExdIX2jMGetPktjmFxgI04NqnuEsbl/pmFQ7fERxiA4Fh j91GhbcMLAAMe8Z2QoT6fvgQMYfg6eD2sHDVQqV2tS4DiQagdT0+4FrCb8A7UAMkg84Z jLMiTqdQczBHNM9Gen2LF4Rozu5uFk4zxdvROzazCHxIsxqRn6JpPGQFEmGVoGhz3pJv VgZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xKrItJPnknJtuQPbdUQpvBqldrrmRGqw02vAaISROdc=; b=g42aKVmnJNPLO5nmO/bJMles8uKasggRl9Tu9j6xCp9zS/1G64YnqGmoSD2cBbOG7n izSvyL66l6u1VpdXxfBq2cS2z7iSU+I7izf/QZ8zzPZSowUHSSkMr+RKipy4cNaC19cu 1lhiu76s/88C4DCNX5kZtJPCpZkTiVS0JBWVdsrioO8Hlg0MFCCGpF4eHUne8iyYIZuc GhOdrJK0O9Xt/W2eQPCF8AZr4UJLaXq2CbVBeiWBrv09X8ie61JkVsMz7XYf7gcZGTJY Z3EqgJx8oXh84RKQgLysW7Y193krZTFdPdxPKCjjasHGvbIK6xAbARBk5ALks/wktk51 Jh0w== 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 v16-v6si3821090pgb.96.2018.10.13.01.05.52; Sat, 13 Oct 2018 01:06:10 -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 S1726526AbeJMPlj (ORCPT + 99 others); Sat, 13 Oct 2018 11:41:39 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:48114 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbeJMPlj (ORCPT ); Sat, 13 Oct 2018 11:41:39 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBEv9-0005aR-Ms; Sat, 13 Oct 2018 08:05:11 +0000 Date: Sat, 13 Oct 2018 09:05:11 +0100 From: Al Viro To: Aleksa Sarai Cc: Eric Biederman , Christian Brauner , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Andy Lutomirski , David Howells , Jann Horn , Tycho Andersen , David Drysdale , dev@opencontainers.org, containers@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v3 1/3] namei: implement O_BENEATH-style AT_* flags Message-ID: <20181013080511.GT32577@ZenIV.linux.org.uk> References: <20181009070230.12884-1-cyphar@cyphar.com> <20181009070230.12884-2-cyphar@cyphar.com> <20181013073319.GS32577@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181013073319.GS32577@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 13, 2018 at 08:33:19AM +0100, Al Viro wrote: > Pardon me, but... huh? The reason for your two calls of dirfd_path_init() is, > AFAICS, the combination of absolute pathname with both LOOKUP_XDEV and > LOOKUP_BENEATH at the same time. That combination is treated as if the pathname > had been relative. Note that LOOKUP_BENEATH alone is ignored for absolute ones > (and with a good reason - it's a no-op on path_init() level in that case). > > What the hell? It complicates your code and doesn't seem to provide any benefits > whatsoever -- you could bloody well have passed the relative pathname to start with. > > IDGI... Without that kludge it becomes simply "do as we currently do for absolute > pathnames, call dirfd_path_init() for relative ones". And I would argue that > taking LOOKUP_BENEATH handling out of dirfd_path_init() into path_init() (relative) > case would be a good idea. > > As it is, the logics is very hard to follow. ... and it fails on LOOKUP_BENEATH anyway. Egads... So that's for your LOOKUP_CHROOT ;-/ IMO that's awful, especially with the way you've spread those LOOKUP_CHROOT cases between these two. Why not simply have O_THISROOT pick root by dirfd and call file_open_root()? And if something wants it for stat(), etc. just have them use it combined with O_PATH and pass the result to ...at()...