Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp141707ybe; Wed, 4 Sep 2019 16:47:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyehdHnFdHdffFStyh19s9IaEOOVJvrYdSi9oqgbTcepbPPuKa3EX6aSZX0vRCqCle1yZSZ X-Received: by 2002:a62:7790:: with SMTP id s138mr284497pfc.243.1567640868529; Wed, 04 Sep 2019 16:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567640868; cv=none; d=google.com; s=arc-20160816; b=a7V2CxKS1FnIpXflavgaGcSSIvsQ3dnq50HZO1ZksSUTQ8dIoNypI8iWNy9SWZpk4+ UV63EL42qnrm2dHQ0bBx3tn1sxS53m/2/UntuxVp6PjnV56ak1mYweOE0fZTJsUoXHmO afcFsbDuousIuh4tLTRB9CIOTCBSs6+bdovj2pL0OK7ziXeKoCQW9G3TEpUDZw1R36ry 0yxHkK9ckveS/NG4mwk3eKXP/+5ySqZCYZ2Mm14ool9Ux8WlPnf4nD27wSIE1K142w+P HnLRxVLvkfLQX1Kc0QjqvWaXS74+1hHs4l8gsw6cU/qeqxwkxsCFTjFQ6FJKKqF+Nbgj rTxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lkW/YWLZKFkaRlur1cRxiMMOTA0gNhHwo+TbpZCC63g=; b=a9J0BhUH5fJ4rNTc5755yO/bARlXcoffLOXSD92fTF6Hx8IWHHL4PqYW+Dj/k1SUwd KJBT428UB4IDXGZhyB31lOODleNT3EWrZbbq+7LvIw8q7KqbmRyxU44kC86H+19Hq/LF rBAgj+/5SZcsmaDl3wbugSIzmQI7Vkuz5e69oWnI4HW+yOyf1TdYoXVuqGka7PUABnnI qTjlAmxh5xuHqVCSgXjuIbQlOjTE/Lc7x3BaW7nv0xXTgUn39RCPvJczbSPubUh2xVMB SdnRoue5gG4JIVdwqr5cb59RVMAnkkRGnLG8z9xbjtQDcmCcPOcLhbf0vcH5Z7IQ93Fs duvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="Cnu5WYs/"; 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 f24si259891pfn.139.2019.09.04.16.47.33; Wed, 04 Sep 2019 16:47:48 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b="Cnu5WYs/"; 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 S1730528AbfIDXpS (ORCPT + 99 others); Wed, 4 Sep 2019 19:45:18 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42557 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730386AbfIDXpR (ORCPT ); Wed, 4 Sep 2019 19:45:17 -0400 Received: by mail-lj1-f193.google.com with SMTP id y23so433000lje.9 for ; Wed, 04 Sep 2019 16:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lkW/YWLZKFkaRlur1cRxiMMOTA0gNhHwo+TbpZCC63g=; b=Cnu5WYs/aAthmsXfnwtWzL5CNjpaY23sMnhFtcX1zve3r2rc/Ho+dRzPF32HPRMBnj gveXLtTDU7YHSGctyOcfke7l1YNaudqputmw6AJ3ZcUOsNYmqHCIu9DY9WHGlywCQ4Su iCCcCFmwH9f6fkeMSqS83pY7B6dx4aSlHZljU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lkW/YWLZKFkaRlur1cRxiMMOTA0gNhHwo+TbpZCC63g=; b=EaqUPcW78B5oR6cQzbxEud0Gt2SY3qKqX25nHEAxhuWp1NzW6UeugyeZLopMIS/NmD 9DLFPMsFm5+wQff6ddMHmQL50N/lrlR4JFT6j1U0JsVmTwvpvxSQcqGrHIvS3Kv2Nrba 7VLwH5IR7iEQiahVVt+WcNPIIxgSwl/TdBX0h5+E2Ly6kNYW30NbDTaadsG7rmr6nn0U tivPuJ6WgouMe5PN5kTz/3JlZXyOYan+LDhH8NXN3NHqNPvxYtzXwnQ1yVrmzaGXOqwr nlLdHJO0HdnJRlkQlOIbz/y1c3BwYsR6qLlyBu4UghwXusVwTtAoieF+hLw08gnUXZhd JZWw== X-Gm-Message-State: APjAAAVjDP+p7YFM5xzaymAQh3n2ncARKgc6XqN6tqQR1y0yD3uEIlQU uVoNdP4K/kUppWJigTJI57DTO8rQUlw= X-Received: by 2002:a2e:2953:: with SMTP id u80mr110831lje.233.1567640715401; Wed, 04 Sep 2019 16:45:15 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id v6sm47826ljk.17.2019.09.04.16.45.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Sep 2019 16:45:14 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id 7so442005ljw.7 for ; Wed, 04 Sep 2019 16:45:12 -0700 (PDT) X-Received: by 2002:a2e:3a0e:: with SMTP id h14mr127121lja.180.1567640710863; Wed, 04 Sep 2019 16:45:10 -0700 (PDT) MIME-Version: 1.0 References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-11-cyphar@cyphar.com> <20190904214856.vnvom7h5xontvngq@yavin.dot.cyphar.com> <20592.1567636276@warthog.procyon.org.uk> <20190904232911.GN1131@ZenIV.linux.org.uk> In-Reply-To: <20190904232911.GN1131@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 4 Sep 2019 16:44:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution To: Al Viro Cc: David Howells , Aleksa Sarai , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , Jann Horn , Kees Cook , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Aleksa Sarai , Linux Containers , alpha , Linux API , linux-arch , Linux ARM , linux-fsdevel , linux-ia64@vger.kernel.org, Linux List Kernel Mailing , "open list:KERNEL SELFTEST FRAMEWORK" , linux-m68k , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390 , Linux-sh list , linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 4, 2019 at 4:29 PM Al Viro wrote: > > On Wed, Sep 04, 2019 at 03:38:20PM -0700, Linus Torvalds wrote: > > On Wed, Sep 4, 2019 at 3:31 PM David Howells wrote: > > > > > > It ought to be reasonably easy to make them per-sb at least, I think. We > > > don't allow cross-super rename, right? > > > > Right now the sequence count handling very much depends on it being a > > global entity on the reader side, at least. > > > > And while the rename sequence count could (and probably should) be > > per-sb, the same is very much not true of the mount one. > > Huh? That will cost us having to have a per-superblock dentry > hash table; recall that lockless lockup can give false negatives > if something gets moved from chain to chain, and rename_lock is > first and foremost used to catch those and retry. If we split > it on per-superblock basis, we can't have dentries from different > superblocks in the same chain anymore... That's exactly the "very much depends on it being a global entity on the reader side" thing. I'm not convinced that's the _only_ way to handle things. Maybe a combination of (wild handwaving) per-hashqueue sequence count and some clever scheme for pathname handling could work. I've not personally seen a load where the global rename lock has been a problem (very few things really do a lot of renames), but system-wide locks do make me nervous. We have other (and worse) ones. tasklist_lock comes to mind. Linus