Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp814847pxb; Wed, 11 Nov 2020 17:37:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBosd9Htt31+mCD8Gg+9Ne8PQrb8NYMGaFhuHJDgubweZroK9KaZY7kIjMRe5bEGHv+zxj X-Received: by 2002:a17:906:6987:: with SMTP id i7mr28964023ejr.18.1605145030608; Wed, 11 Nov 2020 17:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605145030; cv=none; d=google.com; s=arc-20160816; b=qmq/JjJWHdAgIslSJuTrt/3WxH1UzabQfc4FNosUq0q4E2GR41kaurX3sNKnAXKAb4 dog3rnHbpTI9gSmJcrbIEWkyMkL7FHjAvKqCZhUURcduPzopKCJTBFoEZAYIIv8oggkr BXIDzCeToPB7j+JYfIjdUt8LaEvpVukKVc+PI7EkDWX8TYIuAPkW7Pf1wFZKuAgUfOPH +Him54cZmhGKMbKvFeNpHunSj8Vnd8WuzOao+TEmb3NnxhZZEPTEy94LHbJ7zzZ7lghw fWlWLuUjZcbJD3eh40cEhISvxBs161O0SIiwagqxEtSa2NvUEBZwg07n6t/GFoKaHxn7 8OSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8l0j+cAspJw3PKNvEwGXKQZgH357sPK1IXSg0Dm5rWM=; b=FB20mqBTJ52vTb6JW5Tn2iWxHUgZvOasZeI9XBeDVk2ON+aF9sRqioGC2wZparhF/P rscgcapQZ80vp6MU6PbPeMY5cWfOPWlGC9FcGB4Uw4xOLrZpyj6ld1PuRbOy8aBIRX52 NT+3l5itYz+WubflQgtjqVWmRBM/mYnPp07EE2734vgRT09vrtAL9jvgDvSoeImfmI3a LjlDfNgklljZwlgnSXK18zoslku6zy8KdV6daxnJwxxOzVGC3H/eh6d8BSDPgRHZdGNM HtVhBNYT72g68hoJbRN4Mgpcrp6MoDJF2QQYSP/+U8ory8uVgcvBhVOhEMAFLfUuerZ6 CEkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=LNGJWwVJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 rn17si3077478ejb.282.2020.11.11.17.36.30; Wed, 11 Nov 2020 17:37:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@sargun.me header.s=google header.b=LNGJWwVJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728358AbgKLBcT (ORCPT + 99 others); Wed, 11 Nov 2020 20:32:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728067AbgKLAbA (ORCPT ); Wed, 11 Nov 2020 19:31:00 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 411A1C0613D4 for ; Wed, 11 Nov 2020 16:31:00 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id l12so3709159ilo.1 for ; Wed, 11 Nov 2020 16:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8l0j+cAspJw3PKNvEwGXKQZgH357sPK1IXSg0Dm5rWM=; b=LNGJWwVJv/+IA3kzIbW9fZVxxRU3l/QIh+VULZZbgiI0DBdOi/8sRaA3pP1V6rSXl4 x7epCo6q0RIQza7V/yhUR37RzB+Z0Jtj8mF+Mgw3foZIc29WoH4RyrBlX46WajyP/ptQ pUDCbrrL6sPgMZeAN/TQqnhO2c0+Ar/MjfGls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=8l0j+cAspJw3PKNvEwGXKQZgH357sPK1IXSg0Dm5rWM=; b=nkUBl1oNynwigA45C7PY0oRffM96eyLjSPN3KZ9Pq37hrKN4giWdRxzrQXe8G1Lk5y X8deARmCC7CORnlDJSj5IfzmsfT/LKoN5peGuKm38jiO4yULlgRET95+vTNksdtc3IPY lCcovm5XKAcWjIEb5txpgV4Q7o00faivfUDHyE5iwuxrRBZhSjNw8n/zHMSeeQp/pK2v 1TsYpaxNOGj8fDKF5CMCI7wn5gA3UNDgZc5t0X9YXeM6US8xlfSQca+e0wDuGsVOnEZi h9C/WMUac4reMxDemlqTWLUZDllP3yycmLUDk7yiVvb3nE3gKpd+4pxPE7yPIcqgGsVI Jexg== X-Gm-Message-State: AOAM533Pus85ozU4yaZuIET1N3EcOL1C+lO223BqbV0yloA69e9ZE2/Y YMn9xGRHamuJSwlXKGS27jiinw== X-Received: by 2002:a92:3312:: with SMTP id a18mr21071286ilf.165.1605141059275; Wed, 11 Nov 2020 16:30:59 -0800 (PST) Received: from ircssh-2.c.rugged-nimbus-611.internal (80.60.198.104.bc.googleusercontent.com. [104.198.60.80]) by smtp.gmail.com with ESMTPSA id m9sm1831941ioc.15.2020.11.11.16.30.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Nov 2020 16:30:58 -0800 (PST) Date: Thu, 12 Nov 2020 00:30:57 +0000 From: Sargun Dhillon To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" , "smayhew@redhat.com" , "dhowells@redhat.com" , "linux-fsdevel@vger.kernel.org" , "chuck.lever@oracle.com" , "linux-kernel@vger.kernel.org" , "schumaker.anna@gmail.com" , "alban.crequy@gmail.com" , "anna.schumaker@netapp.com" , "mauricio@kinvolk.io" , "bfields@fieldses.org" Subject: Re: [PATCH v4 0/2] NFS: Fix interaction between fs_context and user namespaces Message-ID: <20201112003056.GA351@ircssh-2.c.rugged-nimbus-611.internal> References: <20201102174737.2740-1-sargun@sargun.me> <20201111111233.GA21917@ircssh-2.c.rugged-nimbus-611.internal> <8feccf45f6575a204da03e796391cc135283eb88.camel@hammerspace.com> <20201111185727.GA27945@ircssh-2.c.rugged-nimbus-611.internal> <17d0e6c2e30d5b28cc1cb0313822e5ca39a2245c.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <17d0e6c2e30d5b28cc1cb0313822e5ca39a2245c.camel@hammerspace.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Nov 11, 2020 at 08:03:18PM +0000, Trond Myklebust wrote: > On Wed, 2020-11-11 at 18:57 +0000, Sargun Dhillon wrote: > > On Wed, Nov 11, 2020 at 02:38:11PM +0000, Trond Myklebust wrote: > > > On Wed, 2020-11-11 at 11:12 +0000, Sargun Dhillon wrote: > > > > > > The current code for setting server->cred was developed > > > independently > > > of fsopen() (and predates it actually). I'm fine with the change to > > > have server->cred be the cred of the user that called fsopen(). > > > That's > > > in line with what we used to do for sys_mount(). > > > > > Just curious, without FS_USERNS, how were you mounting NFSv4 in an > > unprivileged user ns? > > The code was originally developed on a 5.1 kernel. So all my testing > has been with ordinary sys_mount() calls in a container that had > CAP_SYS_ADMIN privileges. > > > > However all the other stuff to throw errors when the user namespace > > > is > > > not init_user_ns introduces massive regressions. > > > > > > > I can remove that and respin the patch. How do you feel about that?? > > I would > > still like to keep the log lines though because it is a uapi change. > > I am > > worried that someone might exercise this path with GSS and allow for > > upcalls > > into the main namespaces by accident -- or be confused of why they're > > seeing > > upcalls "in a different namespace". > > > > Are you okay with picking up ("NFS: NFSv2/NFSv3: Use cred from > > fs_context during > > mount") without any changes? > > Why do we need the dprintk()s? It seems to me that either they should > be reporting something that the user needs to know (in which case they > should be real printk()s) or they are telling us something that we > should already know. To me they seem to fit more in the latter > category. > > > > > I can respin ("NFSv4: Refactor NFS to use user namespaces") without: > > /* > > ?* nfs4idmap is not fully isolated by user namespaces. It is > > currently > > ?* only network namespace aware. If upcalls never happen, we do not > > ?* need to worry as nfs_client instances aren't shared between > > ?* user namespaces. > > ?*/ > > if (idmap_userns(server->nfs_client->cl_idmap) != &init_user_ns && > > ????????!(server->caps & NFS_CAP_UIDGID_NOMAP)) { > > ????????error = -EINVAL; > > ????????errorf(fc, "Mount credentials are from non init user > > namespace and ID mapping is enabled. This is not allowed."); > > ????????goto error; > > } > > > > (and making it so we can call idmap_userns) > > > > Yes. That would be acceptable. Again, though, I'd like to see the > dprintk()s gone. > I can drop the dprintks, but given this is a uapi change, does it make sense to pr_info_once? Especially, because this can have security impact?