Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4008532rdh; Tue, 28 Nov 2023 09:18:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5ca9Xq2fz0mV5xcjabK5fd97We4Eu7qipDPcz++JW+k5KQXr9fgPQ9a/OtnyJ9Qmzvz/L X-Received: by 2002:a17:90b:4a09:b0:27d:433e:e69c with SMTP id kk9-20020a17090b4a0900b0027d433ee69cmr23171052pjb.18.1701191918617; Tue, 28 Nov 2023 09:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701191918; cv=none; d=google.com; s=arc-20160816; b=ys6hoBJxQRXD6BJA8qGBoNDRpZUSvmxZCm5QQevg5SoCQ66GMyo5W1B13lz38Cowh2 BnYjLnNVpVXYHmAI1YYk4uMgjj2FlLAslpvLOk1eFms7DEMCf/LknKa1T1mRPQd/brwf 7q2lbUeukOynnEQXDKdo6ZAVzA30oztqPcSgJJ3ggpNs39UcbWn/cPqFXOUX++n/LmdD /JwGmVA8kvTdSsUS0hznpWiFXbqLVwCiDwcoxLrT79dIeDKxv3LDMYHTRUGLlx0ZebfE a5Peu2rRRRHEly91ifdLml5kaA4E8oIqlgSHRsA29zb6i2BUTbQZh1guXBflQZiebp21 xqNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yIOkFVLeYmR7APzKuCtGZzsgZPX3098sKld8riILa4w=; fh=JJ6XuJws04ZTDoXMtogHpkKD8YDwoIWFzY7xNjodiaE=; b=qWVs7yFw9jLKTLuVqYXx3AbnEFD47LhaDsV4s8KtN2vVKiXkeqJmOcm2zTHRML/jMc fPZuYUJjXkkYRpTl8Faq0pjHjCvMRWsf7rbBJx87FDe1P3lYSDvf6yYf1k4nwbwlY2pi Z9jOyB9hvb1z8Ig2P/XgsCbTJ4OhRRHZeMnuIDGR2Su6i2pj39ERN+nRnUFkG8K6jgBS jW4unlDp6X8irw/6DWD75nXB5aTiZFXq3a+Yy2VWbbIuKe9Xe53HrYhKzyWDms9ZNOvd Jx2ESxj+7/mi+65zz1KJhbNkSyA42wmlx5RPwzMyb6rOXdERYrt5JBsrB5kbwdlbg4I6 MnSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTHgE9PP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v5-20020a17090a458500b00273e2f407casi12745131pjg.76.2023.11.28.09.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 09:18:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTHgE9PP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 045A48315C8C; Tue, 28 Nov 2023 09:18:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233170AbjK1RSV (ORCPT + 99 others); Tue, 28 Nov 2023 12:18:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjK1RSU (ORCPT ); Tue, 28 Nov 2023 12:18:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5361FD6 for ; Tue, 28 Nov 2023 09:18:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7251DC433C7; Tue, 28 Nov 2023 17:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701191905; bh=V7IKAf0Hbu6oP2LSWp5l10ZwtBSliEPvVOx9m0gWfYQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DTHgE9PPklBAMdua0Gq+s/PRw++bw+Gj2frl4hyn3VWGoVDnO+zsrE+nNNl9kJCnm Aif6OPqLGkuMeO87bQeZNkZxecGgE35op+PwvNVEC2SVi6UE42oxDvc1NCf0whVyze u8jJwbYkbzVJX9f4i+TBbmFu3kC7Li++6kX/8uQ9anTcQ4LX74JdAzadEKlFWGdl5W h4rVFVKK67H6Cj6TLoi6TfcG2mi/7B1FgCnuhoSHVgdEqmLzIa4r2Lgph6KRcxAgDc GLP7RCT6Ldry21zdNGa0876otyOA+nuP48lukN/ibWTlhZV9gY3exB+auhSbDec+Yn v/iSmyghEjysQ== Date: Tue, 28 Nov 2023 09:18:23 -0800 From: Eric Biggers To: Sergei Shtepa Cc: axboe@kernel.dk, hch@infradead.org, corbet@lwn.net, snitzer@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, viro@zeniv.linux.org.uk, brauner@kernel.org, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Sergei Shtepa Subject: Re: [PATCH v6 11/11] blksnap: prevents using devices with data integrity or inline encryption Message-ID: <20231128171823.GA1148@sol.localdomain> References: <20231124165933.27580-1-sergei.shtepa@linux.dev> <20231124165933.27580-12-sergei.shtepa@linux.dev> <20231127224719.GD1463@sol.localdomain> <6cabaa42-c366-4928-8294-ad261dae0043@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6cabaa42-c366-4928-8294-ad261dae0043@linux.dev> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 09:18:36 -0800 (PST) On Tue, Nov 28, 2023 at 12:00:17PM +0100, Sergei Shtepa wrote: > But I haven't tested the code on a device where hardware inline encryption is > available. I would be glad if anyone could help with this. > > > > Anyway, this patch is better than ignoring the problem. It's worth noting, > > though, that this patch does not prevent blksnap from being set up on a block > > device on which blk-crypto-fallback is already being used (or will be used). > > When that happens, I/O will suddenly start failing. For usability reasons, > > ideally that would be prevented somehow. > > I didn't observe any failures during testing. It's just that the snapshot > image shows files with encrypted names and data. Backup in this case is > useless. Unfortunately, there is no way to detect a blk-crypto-fallback on > the block device filter level. Huh, I thought that this patch is supposed to exclude blk-crypto-fallback too. __submit_bio() calls bio->bi_bdev->bd_filter->ops->submit_bio(bio) before blk_crypto_bio_prep(), so doesn't your check of ->bi_crypt_context exclude blk-crypto-fallback? I think you're right that it might actually be fine to use blksnap with blk-crypto-fallback, provided that the encryption is done first. I would like to see a proper explanation of that, though. And we still have this patch which claims that it doesn't work, which is confusing. - Eric