Received: by 10.213.65.68 with SMTP id h4csp462003imn; Sat, 17 Mar 2018 10:24:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELsi6+vrvx8vbJT/y31LjLXUUXRMtTanrZlLYEenhI367/20n57oualj93iVkZj0lTnwxFpS X-Received: by 2002:a17:902:149:: with SMTP id 67-v6mr6476485plb.296.1521307482853; Sat, 17 Mar 2018 10:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521307482; cv=none; d=google.com; s=arc-20160816; b=OE2meB7R++5R1ZhwT2hRwzOa/04BNQaWRJHDmVsS56j5nooTJHnkT+9I3v+urL+YjJ fTn6hsiKBV/cKQFczmWENJaqtGMZlV4DWocMSTD1JFwuZwLFUvDTCU4XcBxh4OIuPnoo rBtXc2cH0uGgwnvQiTvJU9iFMg5pcMgqE8GH4G1p1mBBTbZiRvMGQv2DYf0uBqurHA9o wFYodP1W67H6xtB55jqucjLvlL5RMo0L0rvbn7QlMiVt9Rp69VU1jp8/93hMvWRZZj2r X8y8zO+XDen6nUpuklQ0VpmjU17Anm0jLeR9OO+IscOdpWQ2lBfU7NQqxXiPMxPdLa0L P76A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=dEQ25fZ0qtXJejYBlav1lGobIpXbnv8cNA/477bYF84=; b=MuFE7PGZEO+3Fr4XOyJjgDKCVqxziPX5U9kc/ZM8PHXv7qmH4T14rM72uh3MYwr903 09OaKDXl7erAz3gQm3zPZOul/3wbJzu9N+0WWVXq13iqK4Q1UqHg0zsnTJ4brhz54+cW ZvgFWCl3UlcvkR+cIUb+q/KrIVeK0/4JxZe9xIMDZNpNAknENdsWtrxXZX47J0xPZHpb Hm698hYeoUUKX1RmMJIhE/MdAZww00atQrHeEJTLTjpy7vwON/wwI1cWGejLkt4jmCDW SrOWL42NhuR3oeau8w1u7auNXU3AgNr9/ojbCOtFbd+vbBqVBd5vzEqkCkwhpDDdM8g0 D0BQ== 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 r22-v6si5682100pls.133.2018.03.17.10.24.29; Sat, 17 Mar 2018 10:24:42 -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 S1753672AbeCQRXF (ORCPT + 99 others); Sat, 17 Mar 2018 13:23:05 -0400 Received: from isilmar-4.linta.de ([136.243.71.142]:35120 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752709AbeCQRVL (ORCPT ); Sat, 17 Mar 2018 13:21:11 -0400 Received: from light.dominikbrodowski.net (isilmar.linta [10.0.0.1]) by isilmar-4.linta.de (Postfix) with ESMTPS id 770CC200913; Sat, 17 Mar 2018 17:21:10 +0000 (UTC) Received: by light.dominikbrodowski.net (Postfix, from userid 1000) id AC72A20CAA; Sat, 17 Mar 2018 18:04:38 +0100 (CET) Date: Sat, 17 Mar 2018 18:04:38 +0100 From: Dominik Brodowski To: Arnd Bergmann , Christoph Hellwig Cc: Linux Kernel Mailing List , Linus Torvalds , Al Viro , Andy Lutomirski , Ingo Molnar , Andrew Morton Subject: Re: [PATCH v2 17/36] fs: add ksys_chroot() helper; remove-in kernel calls to sys_chroot() Message-ID: <20180317170438.GA3351@light.dominikbrodowski.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180316084941.GF4151@infradead.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd, Christoph, On Thu, Mar 15, 2018 at 09:44:24PM +0100, Arnd Bergmann wrote: > > diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c > > index 4afb04686c8e..5743f04014ca 100644 > > --- a/drivers/base/devtmpfs.c > > +++ b/drivers/base/devtmpfs.c > > @@ -387,7 +387,7 @@ static int devtmpfsd(void *p) > > if (*err) > > goto out; > > sys_chdir("/.."); /* will traverse into overmounted root */ > > - sys_chroot("."); > > + ksys_chroot("."); > > complete(&setup_done); > > while (1) { > > spin_lock(&req_lock); > > Could this be done using kern_path()/set_fs_root() instead so we > avoid the __user pointer? > > Arnd On Fri, Mar 16, 2018 at 01:49:41AM -0700, Christoph Hellwig wrote: > Agreed. Especially as we don't need any of the permission checks here. Thanks for your input. As re-working this code to use the vfs-internal helpers would probably mean that the syscall-cleanup code has to wait for another release cycle, I propose to address this issue with the following paragraph in the commit message: In the near future, the fs-external callers of ksys_chroot() should be converted to use kern_path()/set_fs_root() directly. Then ksys_chroot() can be moved within sys_chroot() again. Thanks, Dominik