Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp106008lqp; Mon, 10 Jun 2024 20:50:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+ESSTavPMuZlHx94oycD98ZXDflfhzPf2Gef1NXy0ondpOO0k+tUeXKk8ozd0PgfI4LopNPUC5G4HW22bKwPAvM4e6ywbRcdXEpmiEg== X-Google-Smtp-Source: AGHT+IEtCaMR8mvHU3TBhB+zMYOrCyNhI3UVB1R9IiKlHdcgfgDjRXyBAYfScxN9l01htVTosuCU X-Received: by 2002:a92:d787:0:b0:374:93d5:e370 with SMTP id e9e14a558f8ab-375803a4e39mr95749225ab.23.1718077825938; Mon, 10 Jun 2024 20:50:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718077825; cv=pass; d=google.com; s=arc-20160816; b=ANIPvzWlNMRy/O7abLcwMBebTSy6RVwmo9RExo0ls3d0U0MgEqKWrujpXXxbvIOz2U V1DSSeHbmkNICVShfEK1n5sAteBi0n2rxK3WVmEv9BBQ0ggLglg4N3HYA7WilporqVsV safhFJnkOlSgcR2xC4JYKAXqHO/t1do9dP81495KSuCmXEtiHpWgExzu/vYUUQKcJwt6 WBecm7HdIjUH4h1pozzJ0A+aRTfuLYDUT/bD4WtT4dbn5qPu+QJwOCV6Jtljd/y4ldir RUiJJK70tnbgqTXxHz6q0ewHogqIwDSqXyOrqY87pFL+8X65SfXgG6NF4QpYvNmoNDGP hx4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=btkK1VOq4ZqgXFKiGdy1Isa8V1yTMlaiGvgEXncMUtU=; fh=VNAK3rZTmzGmLjsPiuN/ds8cSSZe1Uv1lmlL2pGWyq4=; b=V24geY46r/V5gN04swPQf6B8gWUURM8z+MD1nrUpjRnhr7gGgzbJrZltYIQl4xWuvt +PbA7biu68KFTW6Nhm66QZZAyBqA+58/ADuU365z7gUXYRlgCanAbmLUb8V1bmpBBFAV 94SLUbMk+rG94uEG/NSCft3G3tBpsjKNnKzoiNZtAjaglK6Df0UD1VnKfa4rRHoXMFea 79gO371c2DAtgAjb4eQCIHAnWMBcPLFHB5jjIzy9zd5sQVL+XOCvG3L6KWXjsqh08Uvr QkKLf+X5sAb6H+VOV757q515i+z4qJZSrMy7iGBGgTZAfOCICOcPTdI+S+lLEbFwinH5 /tjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fhpkSPea; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4885-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e6296c11a7si5550377a12.294.2024.06.10.20.50.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 20:50:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4885-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fhpkSPea; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4885-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8AA6A28517F for ; Tue, 11 Jun 2024 03:50:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A127171092; Tue, 11 Jun 2024 03:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fhpkSPea" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05C82171085; Tue, 11 Jun 2024 03:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718077755; cv=none; b=Hyjok7xf5lGlkuz3xPMU4MKNv4n1OxLCjHgy9qIJLqzcktwBwRjz6uLIzi4gnW8JWFXlmVOgz8SLwcs6InkuVXgUDhlrFUr8iY+Gc2y1Y5aJcgh8Z/9JaQKlWw4XGYamJAqFCQaEvv3UpV1UlOUDtRFiMpUoP02W5JdqqEPmL4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718077755; c=relaxed/simple; bh=ukGSgX5MesqBbGJj7yzKjyDULlLyq2Ow1gHuSG/PLIk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JAVjymsFb8+imFa45nSqmumyOP/b4hypuwWkQyzRx8U2+VZVdfMUbtvZzl5tHVlbC9ucATuFOCPskSoaGaQKb8dipQoBfkF2YGWqn8c1BCDmAzpCosoMvFJ0mVggnxFAx70vUhsQRdKdZP+Ax9KTeqsxBLOvR4S//KLojAD6PVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fhpkSPea; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97374C4AF1C; Tue, 11 Jun 2024 03:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718077754; bh=ukGSgX5MesqBbGJj7yzKjyDULlLyq2Ow1gHuSG/PLIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhpkSPeaAOYUhZnC1IAvTG86aeMudfDvPq1AJ6d6PBVbWVNiywtoyarmcuYIVIRgT mt0/r3cn4fzilUMhCwJ1eZndrcwxywUR+FtWNh8uxCsfANn6/0Mq2lD9u6PZ05I/mD /mU6ttCVE6/nJOtzF70jguI/TQy8ARn0fQC5r2FnWiIibMSiQ3ozGBG6h1j2bjbut4 w+71Z7NyZWRqgc2Zv1cPBRT38X4gYHu5L2hb2JwTkGYX6ZYyL3UmAAQc01fLBC0D4o I5vibPzddTy2imZTf+oBNSPIy6dWOwbuAlQpVdorpq6gg5NAv6W8xbYK4ov+gFE0ap sLw30XMUFPUbg== From: Eric Biggers To: linux-crypto@vger.kernel.org, fsverity@lists.linux.dev, dm-devel@lists.linux.dev Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Sami Tolvanen , Bart Van Assche , Herbert Xu Subject: [PATCH v5 10/15] dm-verity: provide dma_alignment limit in io_hints Date: Mon, 10 Jun 2024 20:48:17 -0700 Message-ID: <20240611034822.36603-11-ebiggers@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611034822.36603-1-ebiggers@kernel.org> References: <20240611034822.36603-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Eric Biggers Since Linux v6.1, some filesystems support submitting direct I/O that is aligned to only dma_alignment instead of the logical_block_size alignment that was required before. I/O that is not aligned to the logical_block_size is difficult to handle in device-mapper targets that do cryptographic processing of data, as it makes the units of data that are hashed or encrypted possibly be split across pages, creating rarely used and rarely tested edge cases. As such, dm-crypt and dm-integrity have already opted out of this by setting dma_alignment to 'logical_block_size - 1'. Although dm-verity does have code that handles these cases (or at least is intended to do so), supporting direct I/O with such a low amount of alignment is not really useful on dm-verity devices. So, opt dm-verity out of it too so that it's not necessary to handle these edge cases. Signed-off-by: Eric Biggers --- drivers/md/dm-verity-target.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 4ef814a7faf4..c6a0e3280e39 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -1021,10 +1021,12 @@ static void verity_io_hints(struct dm_target *ti, struct queue_limits *limits) if (limits->physical_block_size < 1 << v->data_dev_block_bits) limits->physical_block_size = 1 << v->data_dev_block_bits; blk_limits_io_min(limits, limits->logical_block_size); + + limits->dma_alignment = limits->logical_block_size - 1; } static void verity_dtr(struct dm_target *ti) { struct dm_verity *v = ti->private; -- 2.45.1