From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0679FC0650E for ; Mon, 1 Jul 2019 15:43:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D492E20B7C for ; Mon, 1 Jul 2019 15:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561995804; bh=+m8Ocelpq6IIEdvehzEZ7RfzLRSFhV0Ix0maHlwbSlI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=Hmzh6Az6ULrmnb3/vwCzXi5gdLUomHy5q/tPYF7tCIU6wD4cWeASMxT+Fw7veahgt pffRKLP2lKrqJBCdaVzqa5GQj+lhPrBQvFnK0S94DDZLzDY8cBGFiIO29CkOigh+On fInGKGZ5QHSoEsXA/o49r1whNnt53fy9gKw1Sa5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729757AbfGAPnU (ORCPT ); Mon, 1 Jul 2019 11:43:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:48542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727640AbfGAPnU (ORCPT ); Mon, 1 Jul 2019 11:43:20 -0400 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 428EC205C9; Mon, 1 Jul 2019 15:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561995799; bh=+m8Ocelpq6IIEdvehzEZ7RfzLRSFhV0Ix0maHlwbSlI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I3WXaZ/toRpBKp2h1GgJ2CKzOjeyx7woYnDHIKnJE93FDeYQs3Q7TMmTdQddUCdG6 l5QQzWkGSFwppS0ZtBwytsfPTWxaVHs3oxNOOPViOCbYfYW3hS2BW7DOtKwBGmSM+X IDbCt+3HYx0fCQ1Z5jZIY++u2tTyWCVWi85bur/8= Date: Mon, 1 Jul 2019 08:43:17 -0700 From: Eric Biggers To: Al Viro Cc: linux-fsdevel@vger.kernel.org, David Howells , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] vfs: move_mount: reject moving kernel internal mounts Message-ID: <20190701154317.GB790@sol.localdomain> References: <20190629202744.12396-1-ebiggers@kernel.org> <20190629203916.GV17978@ZenIV.linux.org.uk> <20190701010847.GA23778@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190701010847.GA23778@ZenIV.linux.org.uk> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Jul 01, 2019 at 02:08:48AM +0100, Al Viro wrote: > > Let's reorder that a bit: > /* The mountpoint must be in our namespace. */ > if (!check_mnt(p)) > goto out; > > /* The thing moved must be mounted... */ > if (!is_mounted(old_path->mnt)) > goto out; > > /* ... and either ours or the root of anon namespace */ > if (!(attached ? check_mnt(old) : is_anon_ns(ns))) > goto out; > > IMO that looks saner and all it costs us is a redundant check > in attached case. Objections? Looks good to me. - Eric