Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1707898imm; Sat, 13 Oct 2018 02:05:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jVQgcgz5ijylP7NDwjouFev8WJ3Srk+Kg7LgoNH6WK8tVWPw7wrq4nePVMp2JnHkYgBtn X-Received: by 2002:a63:6203:: with SMTP id w3-v6mr8548933pgb.53.1539421522063; Sat, 13 Oct 2018 02:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539421522; cv=none; d=google.com; s=arc-20160816; b=ZPeBbq4qktMFuHbbIT4ZCdO6J3nPj1eidbpJHqp7cxiYxi0tbQP30PGrxRGooZ9Wy6 ttvcBzItDFjZGTZo75woZrvjBX9hx04ca0jnLG/q7h1wq7w4GQwqIuZMXOCfsItDTDwt 3gs0zICRc5xb/LUfpHKtCzLmbFHyG8p+CRyL9Ef/A0yo3HV5s2AFBCxhLAmCxJXqtueJ vf2x1lHxVYGAu8WQZbETZCWx+E+XB6kQdnHxxS6vx9pSS081G+C6GaH0N6NTZ86XkAkW 6znbiwQV+Mf5LzVg/7mDd74g7FhzLX6rfBCnEKyArsAjvtKipobDrzSWLQgpi2Z1llJJ pHfw== 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=dICsb+T6aKY+BSNfcSkl4w5wqe8pTwuXwcIf+oTo45o=; b=T42jgM70/NX5eNaSAH+b4pQ40Sb5vaxXsBol3jLMARjs9OxmBPDRQNuekZ+q0J6A0B J6X64ylLm8ApBpiG6ndOABucPrCe9XzhG2ZcXWqq5Q3wnQmV7u6ZPf5TZDc2ZagBDHnG p3oWmq7M4KDyIZNyNl0uQJXxuWw6Qrazw0wUfJhCoyQRCo74uzhc7J1NrFtedYMQ08wz klwX17dzAodsSYbadKF5rgPs4rry78RGhH+Ok6c7C9L37B9RevRzm1KI0suFFjigw6/5 7kZJMH5Y6atGkMR6Lny9OeeDdBS+XxnjxC/h1BOBMdSWISW4nNmirPN4LSDfvha38uQQ GqMg== 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 j19-v6si3937747pgh.198.2018.10.13.02.05.07; Sat, 13 Oct 2018 02:05:22 -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 S1726786AbeJMQlJ (ORCPT + 99 others); Sat, 13 Oct 2018 12:41:09 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:48870 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbeJMQlJ (ORCPT ); Sat, 13 Oct 2018 12:41:09 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBFqa-0006TX-Vq; Sat, 13 Oct 2018 09:04:33 +0000 Date: Sat, 13 Oct 2018 10:04:32 +0100 From: Al Viro To: Aleksa Sarai Cc: Aleksa Sarai , Jann Horn , "Eric W. Biederman" , jlayton@kernel.org, Bruce Fields , Arnd Bergmann , Andy Lutomirski , David Howells , christian@brauner.io, Tycho Andersen , David Drysdale , dev@opencontainers.org, containers@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, kernel list , linux-arch , Linux API Subject: Re: [PATCH v3 3/3] namei: aggressively check for nd->root escape on ".." resolution Message-ID: <20181013090432.GV32577@ZenIV.linux.org.uk> References: <20181009070230.12884-1-cyphar@cyphar.com> <20181009070230.12884-4-cyphar@cyphar.com> <20181009153728.2altaqxclntvyc7b@mikami> <20181013082210.GU32577@ZenIV.linux.org.uk> <20181013085326.gx6rvgqbbyuntfvv@ryuk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181013085326.gx6rvgqbbyuntfvv@ryuk> 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 07:53:26PM +1100, Aleksa Sarai wrote: > I didn't know about path_is_under() -- I just checked and it appears to > not take &rename_lock? From my understanding, in order to protect > against the rename attack you need to take &rename_lock (or check > against &rename_lock at least and retry if it changed). > > I could definitely use path_is_under() if you prefer, though I think > that in this case we'd need to take &rename_lock (right?). Also is there > a speed issue with taking the write-side of a seqlock when we are just > reading -- is this more efficient than doing a retry like in __d_path? ??? 1) it uses is_subdir(), which does deal with rename_lock 2) what it does is taking mount_lock.lock. I.e. the same thing as the second retry in __d_path(). _If_ it shows up in profiles, we can switch it to read_seqbegin_or_lock(), but I'd like to see the profiling data first.