Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1722804imm; Sat, 13 Oct 2018 02:28:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV63SCDFTWIIwocpctRjmS9tPfi0cKLld7tfx138LeejwQ+gdPbkvcaF7NgypPOYLULFckCk/ X-Received: by 2002:a17:902:447:: with SMTP id 65-v6mr9106304ple.325.1539422890786; Sat, 13 Oct 2018 02:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539422890; cv=none; d=google.com; s=arc-20160816; b=HHAONlo25JaVHRkah6gdJnJSGcOWosKUh7j54W1L0PQJjVrbQ1D+mbnXnn0Nfl4W+S dVt+IpZfebjRERZQSjhpTstQPdyrbKUcNhEKh7Sh/eZd1YV/iP8pYRW2mAZZwbFkC8Ka fWbCrb3b/i6HlG/2L8jvZppP8aD7oE/0ZO9c6Lc3WyWDPnQyDrcRq5csL/zmvtPrvWR+ +EuguRN9kRq5bNcfEN8Rp0EDvtt1bDsI+uvmuCLf2rkRx6SuIcMbuTNI9d/WMOnoPbyE KMnhrYR41SiphssYnOIt0wrfKbklj+fIR2hI9wLVaMX4ogJUh2YuTeNzSNqn6/BvmMa0 +80A== 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=N9qb/V6zTREtjgykFET3Sx6+1FDZEcn3uR0v0LZTF8c=; b=qGluYPMOsbDytgrLsGQ7d78MD70JtnnWZXLyjBUbvusCPL6dqgK7lWp0batNgMsTwG aC+1jk8M3YIcCPBu12V5GlwOePrUCx9bV5oA+g1RFOOcEJB+cCwyoH/lwOT5LhMBBVW2 LxUh48X+FTI83a2anCFPYHjjCEiZkNr3OgQpq9H2KSzSKFEg/KSEaQoWz7frCABWM4Vq Y0v/hh2+VPsXLyMosIg2tuPMEzCfd04UOXPsGgfapN/Uz/ODVe8oOTDuy/HgXHYqzyWe JreOP2YIsOp/fTuB2xsckVhCCoiAvxknZOwZWO+RBqWnWfNhHl7BUCpJh6DRy5o01L1r XCkA== 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 o32-v6si3971054pld.284.2018.10.13.02.27.55; Sat, 13 Oct 2018 02:28: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 S1726798AbeJMREA (ORCPT + 99 others); Sat, 13 Oct 2018 13:04:00 -0400 Received: from mx1.mailbox.org ([80.241.60.212]:39492 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbeJMREA (ORCPT ); Sat, 13 Oct 2018 13:04:00 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (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 1ADA64B2E7; Sat, 13 Oct 2018 11:27:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id xVVze7cyAvX3; Sat, 13 Oct 2018 11:27:24 +0200 (CEST) Date: Sat, 13 Oct 2018 20:27:02 +1100 From: Aleksa Sarai To: Al Viro 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: <20181013092702.mf4gjnq2cfqhkvah@ryuk> 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> <20181013090432.GV32577@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tdpm54ekpnomwcqn" Content-Disposition: inline In-Reply-To: <20181013090432.GV32577@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tdpm54ekpnomwcqn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2018-10-13, Al Viro wrote: > On Sat, Oct 13, 2018 at 07:53:26PM +1100, Aleksa Sarai wrote: >=20 > > 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). > >=20 > > 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? >=20 > ??? >=20 > 1) it uses is_subdir(), which does deal with rename_lock Oh -- complete brain-fart on my part. Sorry about that. > 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. Sure, I'll switch it to use path_is_under(). --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --tdpm54ekpnomwcqn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXzbGxhtUYBJKdfWmnhiqJn3bjbQFAlvBumYACgkQnhiqJn3b jbT2oA/8Dm/EBSA4DrGPauqXWpfU9wnpoF4LIaqtaAsPIVRsmt149Pe/XLvjGhvG uTQR5R43kWVcZUbhDGNiTLLemWMHsClDsNyY08WE9SI7dGt1nwVmvJMxQU9RetW8 lzQqdU2iuUL2CPAupyJqTAy5GZz6OoDVY3db3qsANzCPvmJbDDdTRJ4SMQnxvGZL iajDMWEwzt9SDDOiY/AAjmag+U/dY7WoO/K6MKi3J8y1+qYpgWD2gI7hJLzlfGlx +BZgXTu5+P77kyNNg6MhcINYD9HSfaAPooCQlAjyOdjqAlPuwa8roe/o4McUoH4r 4SGI2tvMxUgJTl+xfL/06K+w4k8bmii8LlX2Bj59jeq/IUVj24cbW4MU8lFvwakV kvi9bY+o+GYOlR5v5LmS/FZ9Urycn/dN3qtXRL/fEuoPs5ZRW7ikDLELWEs1qM66 r8IZHDE8wlGMwKP9HzNp40Abn1prfuBCU8jm2enRfm3JK/xxOasVaJwoB0LY/pfy AL6+8AK4jARdJvBsGTmpcGrPgGuswT/5Oo5SXp6MErpC11S7kZXVBSJ/E3SLSZvm np99T3DjQG+F2HyBUhrcTxcG3Gcs7sxs+xqXGVmephY5c0KqTsnv702k/ZiYCmKh Q6sd9EmSXoQUm225ZDIyaSf5nJpHEUiN11LzG0KgJw+N99ZA41U= =CD2O -----END PGP SIGNATURE----- --tdpm54ekpnomwcqn--