Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp82462pxj; Wed, 16 Jun 2021 20:57:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytYHLsxi/EgbdcD9jFcdPwF2OQzkeRyjErd6ki6ZGOb2Lb6yiinnDd2fpceYa+9dH18tuE X-Received: by 2002:a17:906:3b4d:: with SMTP id h13mr2810729ejf.228.1623902271979; Wed, 16 Jun 2021 20:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623902271; cv=none; d=google.com; s=arc-20160816; b=v3a3pri3a9Hogu0VsgQgC3sdkxs09fX8RymcIuIJeu7D8vvliQqDMgwup2SiRCGxJ2 Y0qP2DSYPj6sQMr2wdOGzwqCYDfdna/uMH7q9Jm2bDMHkAGT/Ssf6RHuLdqADxCEIzFB Ng/ZgQhOqbVNJakVuSwQhwwkTY8gxH0MGCQAGYC6KFGJAE0uIi4JrxKjrVk00ZYfKX3t B9lkFbQUwJZikn+lXfiiDP+gTQScsp5Xp/ddti5T449fTdcqK6sP+yLjSNruTOWvhlim w/nrYGx5rG5J2xBd/2Jrmmhcxs7j5EwXqIg/v/SZMbMbwk5k0ddKv1/A/+8b3h8nE/Cn Zzbw== 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=6a1helf0EFCbHUrNjLogALPPfV4m1Wg0ELJkYECTK7o=; b=lM6Q3/Uo+2rWksD64hsHCZ+x7RigsB83pCz6X/gaCmxv61vCq8K/C7mo1D2Hqohf52 n3RQWiUBG+P2b7WBzas/TR/mDxUhLGlxgzx6DgNwS1noQJmUvmrCvRoqY4HoCVedwi4/ 5UD7oZpXkd1YOGHa2Ps5oygpYt3LobnyosU9dnlTtRNhynRvqg+pcojGySpXOYuRrM0p Sh+aNrLFpgD0pPPy5hXaeSvlwt+RMsy1aJuDvENHJ+AEU7OXudmTHr262fN5bVDrycES lPVYkS1Q5v8Ytz0NQ5vjGVFTdJVvCKxEg/fGj4hvc5xv/PVtCTEfwJLGcr3s9npfYK/6 TJTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=usY7AOlu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz16si3021610ejc.342.2021.06.16.20.57.04; Wed, 16 Jun 2021 20:57:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=usY7AOlu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbhFQDxM (ORCPT + 99 others); Wed, 16 Jun 2021 23:53:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbhFQDxK (ORCPT ); Wed, 16 Jun 2021 23:53:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8C106117A; Thu, 17 Jun 2021 03:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623901863; bh=1flQ5v/jNp4/ps/FZDuKqGxBV/Yzlof4nAnM0HGqJPQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=usY7AOlur5KXNcKsTy+fPuDEOvwWgNyLPfAa2n4xELsWhM7bYgpnKVmgONbrZKWHF 67cSWdPCiiKB0B0Ymw6LH+nQGPGNov/05A7DOi+65gtpLWTQ1CyxckqtIaXD6zQsxQ 1e6sRdXeduApgyJM32w2I+Yztm13DlDQysbcpKdH0VsmixMdX5nZQMFMOL2PK58H/s iD/AdVvZKLl/nGJwIbXY9qvA9uZa4H2450vdMAzYoaMHg+7puhDygj7Wm+f5UhNqfJ f86KsDt9/r0GatXnf1AkEKMGlQLaGX1M8cJUTObblfHYv3yDoN46d1vXy2Hm333BWg zQhCXrunwVOFA== Date: Wed, 16 Jun 2021 20:51:01 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: Re: [PATCH v3 00/10] ensure bios aren't split in middle of crypto data unit Message-ID: References: <20210604195900.2096121-1-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604195900.2096121-1-satyat@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 04, 2021 at 07:58:50PM +0000, Satya Tangirala wrote: > When a bio has an encryption context, its size must be aligned to its > crypto data unit size. A bio must not be split in the middle of a data > unit. Currently, bios are split at logical block boundaries, but a crypto > data unit size might be larger than the logical block size - e.g. a machine > could be using fscrypt (which uses 4K crypto data units) with an eMMC block > device with inline encryption hardware that has a logical block size of 512 > bytes. So we need to support cases where the data unit size is larger than > the logical block size. It's worth explaining the motivation for this more clearly. Currently the only user of blk-crypto is fscrypt (on ext4 and f2fs), which (currently) only submits bios where the size of each segment is a multiple of data_unit_size. That happens to avoid most of the cases where bios could be split in the middle of a data unit. However, when support for direct I/O on encrypted files is added, or when support for filesystem metadata encryption is added, it will be possible for bios to have segment lengths that are only multiples of the logical block size. So the block layer needs to start handling this case appropriately. - Eric