Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp588417pxp; Sat, 5 Mar 2022 12:15:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAIABKizdvzTfgfWx1sO7Gneaip0CEiPsceWFlxrS1apD+hSbRHqKwDD831q0gB+T8ITtH X-Received: by 2002:a17:906:698a:b0:6ce:b983:babf with SMTP id i10-20020a170906698a00b006ceb983babfmr3713148ejr.553.1646511324007; Sat, 05 Mar 2022 12:15:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646511323; cv=none; d=google.com; s=arc-20160816; b=S0wcpDN5Un8cxV6XcqDXP9GLHBBKcd3P/Bd5z5+dnaTUc4fMVe5AUDH/DnTE6T3N3o RcqBDYQ1KRMYa8ZY2xqGHlvcNAkyKm1jf3jHGfvYSmCwLrTD1NGVyejDbDTUrbwQf/TR DvQ8cpaqhmj4L+Kz7vJcV2fI95EQl2bNFIMTgJpQfMIox4umvBLv2dwLYuB8UtoU38I8 4NpZtRyBIbsCW7iW/6nrrQWh1elt7Tkxk5Hw4nVZ+sN09PKN6KUad9jJ+weoraP4W5hP Ci7US6WjLtV5dgJf9MzBdPu0sjmNWOdjbxf6FbrBX8MA+kRjvJ8UU2tHzP7a/Oy5bbji zQQA== 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=Jp5Wvbe6b7Bf06yAjd7FM+rHWIKWVoVK1y8+Zp4O8dw=; b=cpb4UNOiElLRIUcLAd8bR/T+G8myl7zDsH7Ii+14zilruUcAYjroHGiV9Wwr/VMUOr iN+N68in2dmZeNoDpM1DfTFN5kqZPBa7pSQUwGqyE13PjivqF4ueSLPtRUddfWHpGWRr o1Z8VKwm1t6Y2tIi61am8bEffxORkdGKaBhh1KvpgLSq2dpUy4WvplXxVjqPV7l9FjXK oGk74+acPfTl7HZvQKZ2cvvazg3gQLWMTTqm9b7sD6GjsBawmjKvcIY6z9IYWJsOvrX9 NWwnUGhN5xRnX0zpZLprNPZo+3MvXpgH3LKH0F9TMfrBY90ObeGfIaDOi5WBixUb6cMj 758Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XmvePgKU; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s24-20020aa7d798000000b004162f404e04si573152edq.422.2022.03.05.12.15.01; Sat, 05 Mar 2022 12:15:23 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=XmvePgKU; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbiCEO50 (ORCPT + 99 others); Sat, 5 Mar 2022 09:57:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbiCEO5Z (ORCPT ); Sat, 5 Mar 2022 09:57:25 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A31C9396AE; Sat, 5 Mar 2022 06:56:35 -0800 (PST) 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 60E481F38E; Sat, 5 Mar 2022 14:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646492194; 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=Jp5Wvbe6b7Bf06yAjd7FM+rHWIKWVoVK1y8+Zp4O8dw=; b=XmvePgKUuL9Ym+RXKAAweGwNfLsajH4+93iGDbWjnheMuQqOS0Xoas9jAZJDm0GoSdHtnR vdAV1tw0IsDHny0zTWCgOJKYjKhcvNtnvF9uylglGvr2XG1hD4xLw03mbWt/DGge3GCbgk xrosyxSahLs+9AkGMBZp2L7Wt/ccIKo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646492194; 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=Jp5Wvbe6b7Bf06yAjd7FM+rHWIKWVoVK1y8+Zp4O8dw=; b=4WmqA8beWlH1y1PFB7pNfSB3ps2EiCmHnL22xKoaLmOISE3KSHkZ3j7baUZfWhEkGjHoIF HT7jtf7CZH6/y0DA== 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 EE0F613519; Sat, 5 Mar 2022 14:56:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8abJNiF6I2KMYAAAMHmgww (envelope-from ); Sat, 05 Mar 2022 14:56:33 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id 4730fb07; Sat, 5 Mar 2022 14:56:49 +0000 (UTC) From: =?utf-8?Q?Lu=C3=ADs_Henriques?= To: Jeff Layton Cc: Xiubo Li , Ilya Dryomov , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] ceph: minor fixes and encrypted snapshot names References: <20220304161403.19295-1-lhenriques@suse.de> <87fsnx4rb3.fsf@brahms.olymp> Date: Sat, 05 Mar 2022 14:56:49 +0000 In-Reply-To: (Jeff Layton's message of "Fri, 04 Mar 2022 13:30:50 -0500") Message-ID: <878rtoo3bi.fsf@brahms.olymp> MIME-Version: 1.0 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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Jeff Layton writes: > On Fri, 2022-03-04 at 16:26 +0000, Lu=C3=ADs Henriques wrote: >> Lu=C3=ADs Henriques writes: >>=20 >> > Hi! >> >=20 >> > I'm sending another iteration of the encrypted snapshot names patch. = This >> > patch assumes PR#45224 [1] to be merged as it adds support for the >> > alternate names. >> >=20 >> > Two notes: >> >=20 >> > 1. Patch 0001 is just a small fix from another fscrypt patch. It's >> > probably better to simply squash it. >> >=20 >> > 2. I'm not sure how easy it is to hit the UAF fixed by patch 0002. I = can >> > reproduce it easily by commenting the code that adds the >> > DCACHE_NOKEY_NAME flag in patch 0003. >>=20 >> Obviously, immediately after sending this patchset I realized I failed to >> mention a very (*VERY*) important note: >>=20 >> Snapshot names can not start with a '_'. I think the reason is related >> with the 'long snapshot names', but I can't really remember the details >> anymore. The point is that an encrypted snapshot name base64-encoded >> *may* end-up starting with an '_' as we're using the base64-url variant. >>=20 >> I really don't know if it's possible to fix that. I guess that in that >> case the user will get an error and fail to create the snapshot but he'll >> be clueless because the reason. Probably a warning can be added to the >> kernel logs, but maybe there are other ideas. >>=20 > > > Ouch. Is that imposed by the MDS? It'd be best if we could remove that > limitation from it altogether if we can. I do remember hitting this limitation in the past, but a quick grep didn't show anything in the documentation about it. This seems to have been added to the MDS a *long* time ago, with commit 068553473c82 ("mds: adjust trace encoding, clean up snap naming") but (as usual) there aren't a lot of details. > > If we can't, then we might be able to get away with prepending all the > encrypted names with some legal characte. Then when we go to decrypt it > we just strip that off. This is probably the best way to fix it, but it's worth trying to find out the origins of this limitation. I do seem to remember some obscure reasons, related with the long snap names (for which Xiubo has a patch), which will start with '_'. But yeah I'll have to go dig deeper. > We could also consider changing the base64 routine to use something else > in lieu of '_' but that's more of a hassle. Cheers, --=20 Lu=C3=ADs