Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp944676pxu; Mon, 23 Nov 2020 07:58:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzsxEo/iRJge/2Z9dNyHhwP/sQAQ4XAkr7fo5M1dGtkpYERju63i1vFLpncMfvGgFOwBqg X-Received: by 2002:a17:906:eb46:: with SMTP id mc6mr292782ejb.54.1606147118419; Mon, 23 Nov 2020 07:58:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606147118; cv=none; d=google.com; s=arc-20160816; b=0tNLj0Ew6FHTuHDFZyx/UmONqNcpaYrCIRW2sKxqywiCrKa04d6rQcTsZOkG40+5SS 2gPIf/fBtmtNb6MOdEoin8NoPiefJoFTIKO2rLKy/JahU7t1FvPXWwSMEgvWZ72R9o9z fJAcShPN//qabgy6GUXOkxWtb1Bvc7IUJ67Fn2AdX67mZrJyCzc3Q6zhUdjzArd+Ca3s yj4hXDq6bBFA0om340CGs276nhyfjR13pYrahOY/mWFabt1xobJWL2hjnqOvXJyUjm3C Ycc6aEdC7FOjOuiMiD1rwQriw0DDEAb0w7ZujNd7/BfWNKHQa01W7U9qpGXq6bt3Nk57 MHvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=YCozEjPGEAusuu5kWcPoz4VuSguBS8YGOeXbic2f3Rk=; b=T3jXmEpPwFX46t7fu59OUXkNXSixf0B/kdENVeZsOUm7/OdIWQG/pcf7+zhP0L1qLT WEq2Un3+nJXgYr3PXfc2fJzbyvBv9CI3CykIPbfVjOiIScHERnfkD9/TOnQ1ufM5XkkY RehIvPoHWHSH/gvvRUAq7Uuf4S7x+uvh+KUAvRSr738efeP8zSaZq+OcKfzb0O+XdW0G b7kPCuIcQEbq9z2oq2fiGOUJGet5m9mOFTiLlGUvBM9H/A4FCEpXOeaUchZIjMDZDZZ8 crfFq76bN2g0GR15LEyVgGtZGpmjE8FCUWO6NZQoqMsQOxRzHSVco3uxpZVGuGz/TZ/P /GfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm1 header.b=pvyJJQ7d; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=WeTek+Xz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si2511697ejx.531.2020.11.23.07.58.06; Mon, 23 Nov 2020 07:58:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm1 header.b=pvyJJQ7d; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=WeTek+Xz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389665AbgKWPy2 (ORCPT + 99 others); Mon, 23 Nov 2020 10:54:28 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:57243 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732217AbgKWPsY (ORCPT ); Mon, 23 Nov 2020 10:48:24 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id D00855803A4; Mon, 23 Nov 2020 10:47:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 23 Nov 2020 10:47:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=YCozEjPGEAusuu5kWcPoz4VuSgu BS8YGOeXbic2f3Rk=; b=pvyJJQ7dtuKuZyz5d3i/Y2P3BtpwgiXvwkMU5BeT/T2 WF7NIU3puTeGziHc3V8c4P08DDWx0C/mg8YCh+U9Sca9z/JBHq4wxcxz+bm/x/Js ill0yaXVsNoxFGfzUBheTBFxcrVd8m1grxm7s7iqfhMx/pqXZTmktPvPSGUH1K+i VvxsyMeiQnZ801Wg/2mHiLsPZGF/gI01gimS5m/ZBxf0fuByrLF38kRtIG8KpJoC GjM0bMurgM8uw9HPIxfjJfQMxd6piCxFrXhJwKKVnPi4S2MGSK9vrSe50wmN6ozJ wPMGgnj6yqYl5/R8VxfTmCS+UTwBxYo6D54TxCJcS8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=YCozEj PGEAusuu5kWcPoz4VuSguBS8YGOeXbic2f3Rk=; b=WeTek+Xz2c2hE5akKms3c+ JeQuMni5IamwAYJBT/m7URxRjdbl3G1N+579hB8TJU7hVr8i4qroe26PJ3If/+wN Qy/X8fRJQXhvKWoGWjNKkJOYeaW/AZ0EpTpZIyp6yvUY5A3Rrv+LpcWilbxoFfyJ OP2LRptG+oKP0efDk+2PvtUyoy9XYB07mY8m0aI7DiEIgovl7mAXAN3Bf0YNAFRl jxkRqX5pKm7uJ55WMJLJWPae4lZpqOCzd0ZA9zA5cLRvER2UcwplWM5qIoZCOWR5 wc6xoAs15KiJGximzPI2SWI4DgpHPxy+EhzRGjAX7GrlMgOFuCnOTi8X3+CgTwPw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudegiedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefvhigthhho ucetnhguvghrshgvnhcuoehthigthhhosehthigthhhordhpihiiiigrqeenucggtffrrg htthgvrhhnpeegkeefjeegkedtjefgfeduleekueetjeeghffhuefgffefleehgeeifedv gfethfenucfkphepuddvkedruddtjedrvdeguddrudejgeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthigthhhosehthigthhhordhpihii iigr X-ME-Proxy: Received: from cisco (unknown [128.107.241.174]) by mail.messagingengine.com (Postfix) with ESMTPA id C041D3064ABE; Mon, 23 Nov 2020 10:47:21 -0500 (EST) Date: Mon, 23 Nov 2020 10:47:19 -0500 From: Tycho Andersen To: Christian Brauner Cc: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org, Lennart Poettering , Mimi Zohar , James Bottomley , Andreas Dilger , containers@lists.linux-foundation.org, Christoph Hellwig , Jonathan Corbet , smbarber@chromium.org, linux-ext4@vger.kernel.org, Mrunal Patel , Kees Cook , Arnd Bergmann , Jann Horn , selinux@vger.kernel.org, Josh Triplett , Seth Forshee , Aleksa Sarai , Andy Lutomirski , OGAWA Hirofumi , Geoffrey Thomas , David Howells , John Johansen , Theodore Tso , Dmitry Kasatkin , Stephen Smalley , linux-security-module@vger.kernel.org, linux-audit@redhat.com, "Eric W. Biederman" , linux-api@vger.kernel.org, Casey Schaufler , Alban Crequy , linux-integrity@vger.kernel.org, Todd Kjos Subject: Re: [PATCH v2 07/39] mount: attach mappings to mounts Message-ID: <20201123154719.GD4025434@cisco> References: <20201115103718.298186-1-christian.brauner@ubuntu.com> <20201115103718.298186-8-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201115103718.298186-8-christian.brauner@ubuntu.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Nov 15, 2020 at 11:36:46AM +0100, Christian Brauner wrote: > +static inline struct user_namespace *mnt_user_ns(const struct vfsmount *mnt) > +{ > + return mnt->mnt_user_ns; > +} I think you might want a READ_ONCE() here. Right now it seems ok, since the mnt_user_ns can't change, but if we ever allow it to change (and I see you have a idmapped_mounts_wip_v2_allow_to_change_idmapping branch on your public tree :D), the pattern of, user_ns = mnt_user_ns(path->mnt); if (mnt_idmapped(path->mnt)) { uid = kuid_from_mnt(user_ns, uid); gid = kgid_from_mnt(user_ns, gid); } could race. Tycho