Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1591435ybi; Fri, 12 Jul 2019 19:46:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfqZK22pND68s15PwuBt1FMWKlU9qCWn86VaDWJO9bn6mbqmKOuc9lHi6ZCnOnm/Rf9KMN X-Received: by 2002:a17:902:846:: with SMTP id 64mr15479697plk.265.1562986007545; Fri, 12 Jul 2019 19:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562986007; cv=none; d=google.com; s=arc-20160816; b=XDme0Zq6XghpH7L9jT/s+0cHylOACWOCqC9zY6Zgo78iPViLSltqdGmtsNt42VK+JT pz7oXdW3N4NEBZ+KIJ0UJwEdXR+2gpZ+FT+GDVh0QTvBJotCLbrmA3jXx70qPdww924J WT67+rgzKPcmx78inaaMLJbg8F3W33FdA33JoIxxhaF6/ylc7G5MBu8vJRVL7i2+aq8d IXPcBAVHgbAYNJ82SdD7KAtFGd/sDwjPSISYabvL2aa2UEkdagYj1u/s9K+xr25lv91w wXva48yIz+mPfP8xLDuJpRZKo1+0bSl5OvkbfqemO+R9AGYfnVCvk6BZlP/+JyG8s3o7 VT4w== 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=NMR3ANfxEqodzEolaXPVPP7TxyHvGie6nrHja9wtJ+s=; b=G3etF75gIRj4wJWdOwO4gFDH1NXt3Fs6zxTmHBMOHoQGL6Gs52Y7/+tl2GkaNVMyuZ HBSda/GqzXNjDXsi5qYXXDeN7d4zmXLPQdt4zbw9jZIHaT6ArHMH93l9F1qlEmf7wvd3 M2UGKYOfk72crZFw/pXZAwnqRPFHW5IU0RKXbysERTaUbCZQdNzKTcy5BMZ3JIC2hQty QTPfC65p6E8ovsTtrhLAYY/mA2uyYl/VgCX1vG4j9mN3+Dh93Ji6MFENTH05BTRUf1AP 9FY6rUpuObwycJpNPHkkJqg4VqV0xJidNpG4JhQEjkfoYysx+uykzsHaNGyPbHjpJnd+ XitQ== 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 z13si9381564pjr.76.2019.07.12.19.45.49; Fri, 12 Jul 2019 19:46:47 -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 S1727547AbfGMCmV (ORCPT + 99 others); Fri, 12 Jul 2019 22:42:21 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:48010 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727338AbfGMCmU (ORCPT ); Fri, 12 Jul 2019 22:42:20 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hm7yz-0001A3-CY; Sat, 13 Jul 2019 02:41:53 +0000 Date: Sat, 13 Jul 2019 03:41:53 +0100 From: Al Viro To: Aleksa Sarai Cc: Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Christian Brauner , David Drysdale , Andy Lutomirski , Linus Torvalds , Eric Biederman , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , Chanho Min , Oleg Nesterov , Aleksa Sarai , containers@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v9 05/10] namei: O_BENEATH-style path resolution flags Message-ID: <20190713024153.GA3817@ZenIV.linux.org.uk> References: <20190706145737.5299-1-cyphar@cyphar.com> <20190706145737.5299-6-cyphar@cyphar.com> <20190712043341.GI17978@ZenIV.linux.org.uk> <20190712105745.nruaftgeat6irhzr@yavin> <20190712123924.GK17978@ZenIV.linux.org.uk> <20190712125552.GL17978@ZenIV.linux.org.uk> <20190712132553.GN17978@ZenIV.linux.org.uk> <20190712150026.GO17978@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712150026.GO17978@ZenIV.linux.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 12, 2019 at 04:00:26PM +0100, Al Viro wrote: > On Fri, Jul 12, 2019 at 02:25:53PM +0100, Al Viro wrote: > > > if (flags & LOOKUP_BENEATH) { > > nd->root = nd->path; > > if (!(flags & LOOKUP_RCU)) > > path_get(&nd->root); > > else > > nd->root_seq = nd->seq; > > BTW, this assignment is needed for LOOKUP_RCU case. Without it > you are pretty much guaranteed that lazy pathwalk will fail, > when it comes to complete_walk(). > > Speaking of which, what would happen if LOOKUP_ROOT/LOOKUP_BENEATH > combination would someday get passed? I don't understand what's going on with ->r_seq in there - your call of path_is_under() is after having (re-)sampled rename_lock, but if that was the only .. in there, who's going to recheck the value? For that matter, what's to guarantee that the thing won't get moved just as you are returning from handle_dots()? IOW, what does LOOKUP_IN_ROOT guarantee for caller (openat2())?