Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp159218ybi; Thu, 13 Jun 2019 13:27:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyo7V/tLTPL/5sIRkI/I5qMxJ13UwJYawItcVMsD04DHBSTjPDYVxidlowwkhRnp/85Eeah X-Received: by 2002:aa7:9087:: with SMTP id i7mr37833787pfa.40.1560457654244; Thu, 13 Jun 2019 13:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560457654; cv=none; d=google.com; s=arc-20160816; b=xY8R+Ch4qfvbm402E1Ne/i2NhW1kKPVhAy9ENuMNxZXKz+mXNJTADzJUxgHJ5utZfD 3cR8p3EbGy54L/E+xYjW1G4g9KT9eDxJ9IGOUtr0lwhm/pHltfKX1gQnTSOCXIp40wPH INvIW7s8xyKjnhwa/ys2apWu6ydqHeCLsnx7/2VMECyYq3cgfjkmlRt/KDt3HLTLq58f UpAySi7pQWF1YytIbDoY4gfr7q2jgcpQMNk0l9hGAFbBBMk2WTwQIkckyXcZ0+XKLbd+ KTAdKRp7QO/HNdzn77bSjTpThIqKtuDLa8nkbn8ngpHU+V0Q9thN5xYL/DmDtfoWCAz4 UwNw== 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=wxJBMcBvwVkpAf1cgG4dPli24Ww6q68XEHKC5A8aObk=; b=x3NB6GXZC2uN6RAliejD2HR+KpS8uPt1OOjdscioOvGTySVvw1zDMbUW6jVLtMLkfn 0gBLp2B6BKcXUPF+TtdX6OHvQgdGZDDwmRDKdudD9U5zUkULKtAADff2Oqa+pDpGxrcv 1I4PMnGDWavqUUkAWekUfaGyvQNWVoRjoCpuSQNlr5HxU3DzMELJ1eZMbVP6EpEkyYmR huxQ02rufG1DEX66mFBfePbtTy/l266KpJ19AojIJ/6nHKcx7gJae1gTcWdXZWwi/n97 LK0k+PAy2p7oXLsgJFPKTBfH3c0X/fCZTMiW73OpmeB0PoJOPOYAbylnL0JbLUmzVJOd ykFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bj2NYJPm; 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 d30si403195pla.419.2019.06.13.13.27.19; Thu, 13 Jun 2019 13:27:34 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bj2NYJPm; 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 S1729938AbfFMUZ4 (ORCPT + 99 others); Thu, 13 Jun 2019 16:25:56 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43833 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbfFMUZz (ORCPT ); Thu, 13 Jun 2019 16:25:55 -0400 Received: by mail-io1-f68.google.com with SMTP id k20so749291ios.10 for ; Thu, 13 Jun 2019 13:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wxJBMcBvwVkpAf1cgG4dPli24Ww6q68XEHKC5A8aObk=; b=bj2NYJPmryyGgICLn1E4HRmF1agezEr1mo/1DGIrMGTjMFw2iRKv0i5eOhE8Zta66r U6KFwJt4gOWZi92tahMKfmQ8UY8j/pm+wRNG67dGzNobX9JOaEDJGZJVbFDwUGqEwzg2 cnnWpEBl0bH0iH50UGlUHlLISbl3cSfjL8rEU= 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=wxJBMcBvwVkpAf1cgG4dPli24Ww6q68XEHKC5A8aObk=; b=qE1VbD5jFJyJj6gsN4hJNlLf9wTX0FJzdbo+ugjU9qusWCERsjIxIhQ4trqrM0elG7 FMuyxGsxL0+t2kmuBsDIzYRIFJzKnzrw4/tenpIvqj0QQeGpEDCkh0h2LHdbMAN5XKsr 3Tc+jDS+IAW64G731joEILfc0FydP/nOA7GiY8vl8MsZB9kmFfE6uVryrRSZu5NqcbIo WT0Z47aR6XJ/umgie6bvlJoFEYCxtjwfnWbij6B/VUqpotln5hlQ7AD+pn+lVye5/5kW w0izl8voHgbguU1azviLa6biLqXRIXVcYqUw52FQRs+Aff3PdqbYQYib8oNRnuN2f3Go fz0w== X-Gm-Message-State: APjAAAVeGEYht1/6/7G1ePnvUf27PBtqk3+eeAqSCMHE5YEo2cKywbTx D0svKdehBZHCZRdYj5/U13/EKA5Jcmb0xVVD1mHHmA== X-Received: by 2002:a6b:7e41:: with SMTP id k1mr14643948ioq.285.1560457555275; Thu, 13 Jun 2019 13:25:55 -0700 (PDT) MIME-Version: 1.0 References: <20190612225431.p753mzqynxpsazb7@brauner.io> <20190613132250.u65yawzvf4voifea@brauner.io> <871rzxwcz7.fsf@xmission.com> In-Reply-To: <871rzxwcz7.fsf@xmission.com> From: Miklos Szeredi Date: Thu, 13 Jun 2019 22:25:44 +0200 Message-ID: Subject: Re: Regression for MS_MOVE on kernel v5.1 To: "Eric W. Biederman" Cc: Christian Brauner , Linus Torvalds , Al Viro , Linux List Kernel Mailing , linux-fsdevel , Linux API , David Howells 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 Thu, Jun 13, 2019 at 8:35 PM Eric W. Biederman wrote: > > Christian Brauner writes: > > > On Wed, Jun 12, 2019 at 06:00:39PM -1000, Linus Torvalds wrote: > >> On Wed, Jun 12, 2019 at 12:54 PM Christian Brauner wrote: > >> > > >> > The commit changes the internal logic to lock mounts when propagating > >> > mounts (user+)mount namespaces and - I believe - causes do_mount_move() > >> > to fail at: > >> > >> You mean 'do_move_mount()'. > >> > >> > if (old->mnt.mnt_flags & MNT_LOCKED) > >> > goto out; > >> > > >> > If that's indeed the case we should either revert this commit (reverts > >> > cleanly, just tested it) or find a fix. > >> > >> Hmm.. I'm not entirely sure of the logic here, and just looking at > >> that commit 3bd045cc9c4b ("separate copying and locking mount tree on > >> cross-userns copies") doesn't make me go "Ahh" either. > >> > >> Al? My gut feel is that we need to just revert, since this was in 5.1 > >> and it's getting reasonably late in 5.2 too. But maybe you go "guys, > >> don't be silly, this is easily fixed with this one-liner". > > > > David and I have been staring at that code today for a while together. > > I think I made some sense of it. > > One thing we weren't absolutely sure is if the old MS_MOVE behavior was > > intentional or a bug. If it is a bug we have a problem since we quite > > heavily rely on this... > > It was intentional. > > The only mounts that are locked in propagation are the mounts that > propagate together. If you see the mounts come in as individuals you > can always see/manipulate/work with the underlying mount. > > I can think of only a few ways for MNT_LOCKED to become set: > a) unshare(CLONE_NEWNS) > b) mount --rclone /path/to/mnt/tree /path/to/propagation/point > c) mount --move /path/to/mnt/tree /path/to/propgation/point > > Nothing in the target namespace should be locked on the propgation point > but all of the new mounts that came across as a unit should be locked > together. Locked together means the root of the new mount tree doesn't have MNT_LOCKED set, but all mounts below do have MNT_LOCKED, right? Isn't the bug here that the root mount gets MNT_LOCKED as well? > > Then it breaking is definitely a regression that needs to be fixed. > > I believe the problematic change as made because the new mount > api allows attaching floating mounts. Or that was the plan last I > looked. Those floating mounts don't have a mnt_ns so will result > in a NULL pointer dereference when they are attached. Well, it's called anonymous namespace. So there *is* an mnt_ns, and its lifetime is bound to the file returned by fsmount(). Thanks, Miklos