Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1647242pxp; Thu, 17 Mar 2022 13:32:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTMt/HBbXL5RDeehguwz0x30hvYHA/+tbxQ7LGHj9Jt1Dr6a2yU/uEj4Jl3feKUyJjvYXH X-Received: by 2002:a65:5a06:0:b0:375:81c9:74b1 with SMTP id y6-20020a655a06000000b0037581c974b1mr5237733pgs.122.1647549132419; Thu, 17 Mar 2022 13:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647549132; cv=none; d=google.com; s=arc-20160816; b=LhJHs0sE7Nis5O0b1gWShnVujcAQS47M3dS7uipW168rSviI691xqEu28XZGdIvccp gGI9C8xJu9vExQbiWxR8HTiAHCKvt5/58jt5n8yhl13PlIv+mBRca5QDuWrDIIvngMxt m4Gkyp1ZXS6SqIBzGpZMSIGz0rkOgnWj3+6FqHzbfx2F4stG/Mfyhf7mzfahT3NCc+ok XDnkdw7WWKUqYT0t8wRDPt3bs6aKZlbNLxxyDrRxBuP/WxlK4pHTKQ9HW9/BHvUjWBNk bfVV8umLItpORiCtyM84VMOy0TOD8IUgLkJEd7vSr6ECZsuh2Ze0/G5LQdnIZDQ201rL /wBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:in-reply-to:date:references:subject:cc:to:from :dkim-signature:dkim-signature; bh=iRWwxLu6tSwi4l2M+4CwPACdz/Ep8oZjcYHhi+zSnZo=; b=yi6mJwOfm6FFNZDCm/ZqIPgvTT7bHhx8Mr3tV/SuxVpM3JH9UB9lka+z8YlRjIWpnz 05aR0y2dO5cXhI/atTW511UPuCYLAfHPl7szhJ8Q1mzwolQlQ4+SPz+ufAapcmJbjjKJ z6m/syz4CvbAk/2sDwrktjvLNHAOM/R7QlsZNKCLKb0pVtDRSvo9/WL/6x5pRRz3KGxQ o32h6f8gYwZk/zZJxIMPN/nLEL9m1yMlMwahJbE26sR2kUx+0gyGCv+6QxP2nacVJg62 v+aHU5IGM23HQS5kAzpwXXt8pDV85saflBPRYcTIUJGA8dGs3GN+zIZZ+TooOUhkhOxd SbUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wJrdaEiR; dkim=neutral (no key) header.i=@suse.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p13-20020a056a000b4d00b004f73239dfcfsi6347161pfo.220.2022.03.17.13.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:32:12 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wJrdaEiR; dkim=neutral (no key) header.i=@suse.de; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 014542D6C9C; Thu, 17 Mar 2022 13:06:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbiCQLMw (ORCPT + 99 others); Thu, 17 Mar 2022 07:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbiCQLMv (ORCPT ); Thu, 17 Mar 2022 07:12:51 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5358D1CAF0F; Thu, 17 Mar 2022 04:11:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C968B1F37F; Thu, 17 Mar 2022 11:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1647515493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iRWwxLu6tSwi4l2M+4CwPACdz/Ep8oZjcYHhi+zSnZo=; b=wJrdaEiRrIq/v/zHa0n/T9So7Z/OgV9e6X9nB71bgOzvHXx5CrbIROlDYJ2L9po1akdsM/ u/ehH1s4g2BHMyYM3RDp8KgrC6mLNP9egXKFxkh5n2RJfWnWzkXV7U4NV33tiOgExerr2V osPLNhQWfkCv8Yay1us2m2/TFAvKWg4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1647515493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iRWwxLu6tSwi4l2M+4CwPACdz/Ep8oZjcYHhi+zSnZo=; b=kQJdk8Lb8wmauRJGsEpbnB3nlPP7su+Wfz+O8UauXC7T86RuGZjzQ+ZJh4iwXBkdmcQVkI kTFPNzjKJMcVMCBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 64BA613B64; Thu, 17 Mar 2022 11:11:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 57LBFWUXM2KFUAAAMHmgww (envelope-from ); Thu, 17 Mar 2022 11:11:33 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id ae5107b0; Thu, 17 Mar 2022 11:11:52 +0000 (UTC) From: =?utf-8?Q?Lu=C3=ADs_Henriques?= To: Xiubo Li Cc: Jeff Layton , Ilya Dryomov , Ceph Development , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 0/3] ceph: add support for snapshot names encryption References: <20220315161959.19453-1-lhenriques@suse.de> <5b53e812-d49b-45f0-1219-3dbc96febbc1@redhat.com> <329abedd9d9938de95bf4f5600acdcd6a846e6be.camel@kernel.org> <3c8b78c4-5392-b81c-e76f-64fcce4f3c0f@redhat.com> Date: Thu, 17 Mar 2022 11:11:52 +0000 In-Reply-To: <3c8b78c4-5392-b81c-e76f-64fcce4f3c0f@redhat.com> (Xiubo Li's message of "Thu, 17 Mar 2022 18:52:49 +0800") Message-ID: <87wngshlzb.fsf@brahms.olymp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Xiubo Li writes: > On 3/17/22 6:01 PM, Jeff Layton wrote: >> I'm not sure we want to worry about .snap directories here since they >> aren't "real". IIRC, snaps are inherited from parents too, so you could >> do something like >> >> mkdir dir1 >> mkdir dir1/.snap/snap1 >> mkdir dir1/dir2 >> fscrypt encrypt dir1/dir2 >> >> There should be nothing to prevent encrypting dir2, but I'm pretty sure >> dir2/.snap will not be empty at that point. > > If we don't take care of this. Then we don't know which snapshots should = do > encrypt/dencrypt and which shouldn't when building the path in lookup and= when > reading the snapdir ? In my patchset (which I plan to send a new revision later today, I think I still need to rebase it) this is handled by using the *real* snapshot parent inode. If we're decrypting/encrypting a name for a snapshot that starts with a '_' character, we first find the parent inode for that snapshot and only do the operation if that parent is encrypted. In the other email I suggested that we could prevent enabling encryption in a directory when there are snapshots above in the hierarchy. But now that I think more about it, it won't solve any problem because you could create those snapshots later and then you would still need to handle these (non-encrypted) "_name_xxxx" snapshots anyway. Cheers, --=20 Lu=C3=ADs > > -- Xiubo > >> >> -- Jeff >> >> On Thu, 2022-03-17 at 13:27 +0800, Xiubo Li wrote: >>> Hi Luis, >>> >>> There has another issue you need to handle at the same time. >>> >>> Currently only the empty directory could be enabled the file encryption, >>> such as for the following command: >>> >>> $ fscrypt encrypt mydir/ >>> >>> But should we also make sure that the mydir/.snap/ is empty ? >>> >>> Here the 'empty' is not totally empty, which allows it should allow long >>> snap names exist. >>> >>> Make sense ? >>> >>> - Xiubo >>> >>> >>> On 3/16/22 12:19 AM, Lu=C3=ADs Henriques wrote: >>>> Hi! >>>> >>>> A couple of changes since v1: >>>> >>>> - Dropped the dentry->d_flags change in ceph_mkdir(). Thanks to Xiubo >>>> suggestion, patch 0001 now skips calling ceph_fscrypt_prepare_cont= ext() >>>> if we're handling a snapshot. >>>> >>>> - Added error handling to ceph_get_snapdir() in patch 0001 (Jeff had >>>> already pointed that out but I forgot to include that change in pr= evious >>>> revision). >>>> >>>> - Rebased patch 0002 to the latest wip-fscrypt branch. >>>> >>>> - Added some documentation regarding snapshots naming restrictions. >>>> >>>> As before, in order to test this code the following PRs are required: >>>> >>>> mds: add protection from clients without fscrypt support #45073 >>>> mds: use the whole string as the snapshot long name #45192 >>>> mds: support alternate names for snapshots #45224 >>>> mds: limit the snapshot names to 240 characters #45312 >>>> >>>> Lu=C3=ADs Henriques (3): >>>> ceph: add support for encrypted snapshot names >>>> ceph: add support for handling encrypted snapshot names >>>> ceph: update documentation regarding snapshot naming limitations >>>> >>>> Documentation/filesystems/ceph.rst | 10 ++ >>>> fs/ceph/crypto.c | 158 +++++++++++++++++++++++++-= --- >>>> fs/ceph/crypto.h | 11 +- >>>> fs/ceph/inode.c | 31 +++++- >>>> 4 files changed, 182 insertions(+), 28 deletions(-) >>>> >