Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1170597rwd; Tue, 13 Jun 2023 05:59:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C/y5SHC9s2Ue924r7fvNGGkgHY4Xgmi072hKlTfbQSGJBU7Ez7wf+OkOIllhFnKUGBtRv X-Received: by 2002:aa7:d358:0:b0:514:a650:99fb with SMTP id m24-20020aa7d358000000b00514a65099fbmr7793386edr.23.1686661171802; Tue, 13 Jun 2023 05:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686661171; cv=none; d=google.com; s=arc-20160816; b=oeh4DmeAJc68TiZzJipzg0xjDe0T7kB3a4CBD40I5EEMy5v8vcFW1Dl/9keDwIRRWl +1+U92culT/WJnGSHBznGvNZ8hFE5s7eZC/N/7RQ8VjyTse4OeyFXB5KM89CHdhoBf43 r5A3pHNauflYHorhieiNdoymGnQcAccd1bGE4pmDV7I878sYRobyv+T8dIveUNkklPbD fQCGRkVwO9b8AWqETCKzqIxDTDCJQj1c0E/2jv2RRdmJ5Y+BSyOj6YHVcXNT1xPb84m6 LCKWgCmE5ajBDIhQgKXlCy9WL+DS9BUG66v0DEqEz++fbwe4D3Yq/UWiXNXbv+ILZW9i ZK4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DJyvntNK5zxh7HK+mp4W1WMoJPxy7nqBJlYeYzOf6Og=; b=Hkwh2ds4gAN3kD6Jr/3e6045MmV+QJBg9LbrolsFRleEtquQdYO/0fb7tIsvyfTWJs JB0VO+7e9wqVMxLbzuxODKsN3M2oehSFj0W9sNSYVomAZjFQwrOxgoY7O20BQ0C+81j+ 0furJeewACwN9UUX6uU/xoBpfXes/s6/zDaTlyLeD/oN8d3v54gDJvMqHNihuc2h5CEP 5xKW/uSCV0HxTD5epXR6uumu0/HVSYGHJ0xn+ozbpzvSlMueSqRePOBVsv0f6FchwzO+ +6WpXLGv0AcaU3kKOOXWSI4yYS4Scdbc6J2Ow7P6jm4JHNxV8iwnBPvWBwDxd2Fc7bKz YhMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Pkja2Dqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020aa7cf08000000b005187aee0b5esi223829edy.396.2023.06.13.05.59.06; Tue, 13 Jun 2023 05:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Pkja2Dqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240371AbjFMMqU (ORCPT + 99 others); Tue, 13 Jun 2023 08:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242084AbjFMMqR (ORCPT ); Tue, 13 Jun 2023 08:46:17 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6AAE7A for ; Tue, 13 Jun 2023 05:46:16 -0700 (PDT) Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 38A4B3F273 for ; Tue, 13 Jun 2023 12:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686660375; bh=DJyvntNK5zxh7HK+mp4W1WMoJPxy7nqBJlYeYzOf6Og=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Pkja2DqtESh9d+TMgoRK0JBCtotZf60iugjn+jyYL33czHh1e9ZL3PMAJ12+ZZQMU qdZ4oF4dZWZqL6P9kLkbI58b3n7nwxD/nMb/l2wiAADXJWL/3Et67HzgUUShywK/Ep v0XTa51au8kIMjZUbcmC0CRA6WeP/rZJx4BEfHLunDwY/7I4pOizD3VxoqE2zyZgeA Zi6W4+jvkk+Yg5i3d9QrTrfRr1meryfb5ZzEMTmE9HA2XQHZVmq6j4gwqgHgOIRQ4H 7FkLfml0YtzJ2t4YGGKBNkkT9KPDrUxKRXGn07HAlfFTk0ie8lGFYFyMETYdD0QF6i awYY4VeZPuj3w== Received: by mail-yb1-f200.google.com with SMTP id 3f1490d57ef6-bc77a2d3841so3852860276.3 for ; Tue, 13 Jun 2023 05:46:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686660374; x=1689252374; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJyvntNK5zxh7HK+mp4W1WMoJPxy7nqBJlYeYzOf6Og=; b=lW4GgVopr0hicLVYj5gUHXktFf+GDoVSA3yhWNko3S5ewW8UMYpLFKAR089a5NLWRt pOgdPmBuNsNvby8sG2N5fgVNw/QbbBsc0nbMnvEbGTFCb93zpQ3d5gAUeTpHCZsGGTlZ TDoYLATHNj3ZowFGuNbswGJx2XRk6OsP8kxMIt0du7dGvLX2VIZ/XDY8S9EksrqPjNia p6hRYOtQGpcvt6A6rKyKCX3MNcjYlWvaxmRaWU81RESIpk1SZvb22SPG6ALDrvtEmdin tl2rqISv7F/k1xmmXVmbs2fPPXhGfR/HultBYzj/imIji9JqQOsJNf9M1O2AwiUrns1w OoWg== X-Gm-Message-State: AC+VfDxkvYI20CfSkg8mLybWn1wTy0XJNgV2xP8gUoc62KzAp7l+gVAW NL5paZbH+nND4C8CtZz6QpVytlsIj3MJ0iPbrzRJVGKPmkbbMc/XgoP0mwvqqQ9WRIbi63HILjj aEIcdU4blfCuhhAEUOmVEeFOCk3SVvIcc8iHWV7BjcBgyF8xiEuSSK3I7gA== X-Received: by 2002:a25:ba88:0:b0:ba8:3b3d:3dc0 with SMTP id s8-20020a25ba88000000b00ba83b3d3dc0mr1176567ybg.65.1686660374089; Tue, 13 Jun 2023 05:46:14 -0700 (PDT) X-Received: by 2002:a25:ba88:0:b0:ba8:3b3d:3dc0 with SMTP id s8-20020a25ba88000000b00ba83b3d3dc0mr1176550ybg.65.1686660373803; Tue, 13 Jun 2023 05:46:13 -0700 (PDT) MIME-Version: 1.0 References: <20230608154256.562906-1-aleksandr.mikhalitsyn@canonical.com> <20230609-alufolie-gezaubert-f18ef17cda12@brauner> In-Reply-To: From: Aleksandr Mikhalitsyn Date: Tue, 13 Jun 2023 14:46:02 +0200 Message-ID: Subject: Re: [PATCH v5 00/14] ceph: support idmapped mounts To: Xiubo Li Cc: Christian Brauner , Gregory Farnum , stgraber@ubuntu.com, linux-fsdevel@vger.kernel.org, Ilya Dryomov , Jeff Layton , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 13, 2023 at 3:43=E2=80=AFAM Xiubo Li wrote: > > > On 6/9/23 18:12, Aleksandr Mikhalitsyn wrote: > > On Fri, Jun 9, 2023 at 12:00=E2=80=AFPM Christian Brauner wrote: > >> On Fri, Jun 09, 2023 at 10:59:19AM +0200, Aleksandr Mikhalitsyn wrote: > >>> On Fri, Jun 9, 2023 at 3:57=E2=80=AFAM Xiubo Li w= rote: > >>>> > >>>> On 6/8/23 23:42, Alexander Mikhalitsyn wrote: > >>>>> Dear friends, > >>>>> > >>>>> This patchset was originally developed by Christian Brauner but I'l= l continue > >>>>> to push it forward. Christian allowed me to do that :) > >>>>> > >>>>> This feature is already actively used/tested with LXD/LXC project. > >>>>> > >>>>> Git tree (based on https://github.com/ceph/ceph-client.git master): > >>> Hi Xiubo! > >>> > >>>> Could you rebase these patches to 'testing' branch ? > >>> Will do in -v6. > >>> > >>>> And you still have missed several places, for example the following = cases: > >>>> > >>>> > >>>> 1 269 fs/ceph/addr.c <> > >>>> req =3D ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GE= TATTR, > >>>> mode); > >>> + > >>> > >>>> 2 389 fs/ceph/dir.c <> > >>>> req =3D ceph_mdsc_create_request(mdsc, op, USE_AUTH_M= DS); > >>> + > >>> > >>>> 3 789 fs/ceph/dir.c <> > >>>> req =3D ceph_mdsc_create_request(mdsc, op, USE_ANY_MD= S); > >>> We don't have an idmapping passed to lookup from the VFS layer. As I > >>> mentioned before, it's just impossible now. > >> ->lookup() doesn't deal with idmappings and really can't otherwise you > >> risk ending up with inode aliasing which is really not something you > >> want. IOW, you can't fill in inode->i_{g,u}id based on a mount's > >> idmapping as inode->i_{g,u}id absolutely needs to be a filesystem wide > >> value. So better not even risk exposing the idmapping in there at all. > > Thanks for adding, Christian! > > > > I agree, every time when we use an idmapping we need to be careful with > > what we map. AFAIU, inode->i_{g,u}id should be based on the filesystem > > idmapping (not mount), > > but in this case, Xiubo want's current_fs{u,g}id to be mapped > > according to an idmapping. > > Anyway, it's impossible at now and IMHO, until we don't have any > > practical use case where > > UID/GID-based path restriction is used in combination with idmapped > > mounts it's not worth to > > make such big changes in the VFS layer. > > > > May be I'm not right, but it seems like UID/GID-based path restriction > > is not a widespread > > feature and I can hardly imagine it to be used with the container > > workloads (for instance), > > because it will require to always keep in sync MDS permissions > > configuration with the > > possible UID/GID ranges on the client. It looks like a nightmare for sy= sadmin. > > It is useful when cephfs is used as an external storage on the host, bu= t if you > > share cephfs with a few containers with different user namespaces idmap= ping... > > Hmm, while this will break the MDS permission check in cephfs then in > lookup case. If we really couldn't support it we should make it to > escape the check anyway or some OPs may fail and won't work as expected. Hi Xiubo! Disabling UID/GID checks on the MDS side looks reasonable. IMHO the most important checks are: - open - mknod/mkdir/symlink/rename and for these checks we already have an idmapping. Also, I want to add that it's a little bit unusual when permission checks are done against the caller UID/GID. Usually, if we have opened a file descriptor and, for instance, passed this file descriptor through a unix socket then file descriptor holder will be able to use it in accordance with the flags (O_RDONLY, O_RDWR, ...). We also have ->f_cred on the struct file that contains credentials of the file opener and permission checks are usually done based on this. But in cephfs we are always using syscall caller's credentials. It makes cephfs file descriptor "not transferable" in terms of permission checks. Kind regards, Alex > > @Greg > > For the lookup requests the idmapping couldn't get the mapped UID/GID > just like all the other requests, which is needed by the MDS permission > check. Is that okay to make it disable the check for this case ? I am > afraid this will break the MDS permssions logic. > > Any idea ? > > Thanks > > - Xiubo > > > > Kind regards, > > Alex > > >