Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp611005yba; Wed, 15 May 2019 07:04:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaNWFYZfLab+JUnOdf162dd3fdl8JnDepqqnoZOfJ2gAdB4nCPD11y6vTndJpN6ADl/2a1 X-Received: by 2002:a63:4a5a:: with SMTP id j26mr42440434pgl.361.1557929051683; Wed, 15 May 2019 07:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557929051; cv=none; d=google.com; s=arc-20160816; b=nlcmerkq/8BdtP1h5MPmhafL+hAAvQ4hFeYoeOmOV2u7D2GjwhYwo3uyf/D35k+lqn 8gEUc1t6BUB6MZG8jmDCH09jzAcX6WgS50tk/INm7i3Waqs5PvZd5EeY+RCvS7/vfvBp M+1Mi98+NutYVPVYR0ki6PvNuSDHJq5lq0JILn0qrwlN3FmL5ctGMU2qZFINXA4/tBKt CdZoDItuxTvK86F0IuJqmQvnrXtSLYT4Ghqb0F/FtAPb0X3plamBcN1bdWh3l2tmZ2/s YT6HvLN6GmAKIe2rfrRpSbCu/qYLzNyq2U019IZmryJn+zrY1FFX/sSlFZ0q/CkzUSrT +qVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=JBYFczqJnPZdMDDp1vH/MfKdPWZlLdyqKzHHyeOicgQ=; b=WiyHL4x1zzCpetrHSuzwk+5aN8+Atqg8KrFCKwdtgp3EvWexyk/Yty4/xXrOE42OzB dkQPonaJLPIbOm9B3bOlNdmm2wjy8dO2xpTx389zrnBozXRLNBAPqElDZDEgDCZUtSm2 0rwc1DHrGXkvg8w0WP7yq/UOVHBt66umUB6IbYw+O4AJzYxENjCDdOhmVkxbbC11YiFb o/y6WTd8PIup7UWeO+XkJQIJqF1ytN+5cFq0qHhMf2sHLqYr+mEWK5hFGhZfeNkCa5j1 RCe2+OUKTSxuq/UPz0mItBC/UGJkz3OLa0nG9zawsb59Nldo1Ua6hRsZ27BL+CFjDgCz Eiyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-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 205si1869274pgd.481.2019.05.15.07.03.41; Wed, 15 May 2019 07:04:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727219AbfEOOBN (ORCPT + 99 others); Wed, 15 May 2019 10:01:13 -0400 Received: from fieldses.org ([173.255.197.46]:60740 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfEOOBN (ORCPT ); Wed, 15 May 2019 10:01:13 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 453B71CEA; Wed, 15 May 2019 10:01:12 -0400 (EDT) Date: Wed, 15 May 2019 10:01:12 -0400 To: Trond Myklebust Cc: steved@redhat.com, linux-nfs@vger.kernel.org Subject: Re: [RFC PATCH 0/5] Add a chroot option to nfs.conf Message-ID: <20190515140112.GA9291@fieldses.org> References: <20190514204153.79603-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190514204153.79603-1-trond.myklebust@hammerspace.com> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, May 14, 2019 at 04:41:48PM -0400, Trond Myklebust wrote: > The following patchset aims to allow the configuration of a 'chroot > jail' to rpc.nfsd, and allowing us to export a filesystem /foo (and > possibly subtrees) as '/'. This is great, thanks! Years ago I did an incomplete version that worked by just string manipulations on paths. Running part of mountd in a chrooted thread is a neat way to do it. If I understand right, the only part that's being run in a chroot is the writes to /proc/net/sunrpc/*/channel files. So that means that the path included in writes to /proc/net/sunrpc/nfsd_fh/channel will be resolved with respect to the chroot by the kernel code handling the write. That's not the only place in mountd that uses export paths, though. What about: - next_mnt(), which compares paths from the export file to paths in /etc/mtab. - is_mountpoint, which stats export paths. - match_fsid, which stats export paths. Etc. Doesn't that stuff also need to be done with respect to the chroot? Am I missing something? --b. > > Trond Myklebust (5): > mountd: Ensure we don't share cache file descriptors among processes. > Add a simple workqueue mechanism > Add a helper to write to a file through the chrooted thread > Add support for chrooted exports > Add support for chroot in exportfs > > aclocal/libpthread.m4 | 13 +- > configure.ac | 6 +- > nfs.conf | 1 + > support/include/misc.h | 11 ++ > support/misc/Makefile.am | 2 +- > support/misc/workqueue.c | 267 +++++++++++++++++++++++++++++++++++++ > systemd/nfs.conf.man | 3 +- > utils/exportfs/Makefile.am | 2 +- > utils/exportfs/exportfs.c | 31 ++++- > utils/mountd/Makefile.am | 3 +- > utils/mountd/cache.c | 39 +++++- > utils/mountd/mountd.c | 5 +- > utils/nfsd/nfsd.man | 4 + > 13 files changed, 369 insertions(+), 18 deletions(-) > create mode 100644 support/misc/workqueue.c > > -- > 2.21.0