Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp148515rdb; Wed, 1 Nov 2023 21:43:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNr4DlciTr+ntILz05RdqcFiOk0I/rAZ54wVxnwvPKeU27tYpRwWWgY6fGrN3cWXUbnYMj X-Received: by 2002:a05:6358:881f:b0:168:db86:261b with SMTP id hv31-20020a056358881f00b00168db86261bmr23040970rwb.31.1698900228220; Wed, 01 Nov 2023 21:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698900228; cv=none; d=google.com; s=arc-20160816; b=NurTIZTOoiC51n6Mw4m+mUkNerDhVjdhZAFKsEnqcZboayGvx6OcAQghPQzGpVlpZz yOw+sO3qhzVQ69ItP+ni2gKRgx7jKQ5Qh7j3fkYiHDJuaxnD53phNXo9THyah9xBaco9 CJtjGMhXKIp96FG+lx2F6B556qVbVEQNAi0HLBJHCLE8lrrPu1MHzK7fCMjpzmpNkK5/ 05qZ5XZOE327Y9AV+MS+MB6/iekNGOQagAPNNL/56mpLLix4eiYJLlpVBgb5w3fDjNEP Ss//AmfEjxGlvfbK12wc6oxxArO1roZlLLkHlo98+yh5vrKIWUvTxL9abN90Tl4EMYa+ 5O4w== 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; bh=lCGmCEUEILHuLXsk/CZIEdxRUwZUrdE4RSf4cYRNNxY=; fh=ALAf64wWtr5chlw3NrvZyxqSFiqHZK9jJ3Ru4Mbb2I4=; b=TFJTYP0tei7sdcdBuUIYLUbfwW6siZ1/2ujwzgWB6d+y+yGWTC+9MzDEwfcxuD9RmJ HLHVnq4gn4rVE+peAIEOmeoJS3VCzJ1pMIftbZ6M8USriU7mTZCs0wDGwcjndsehYiB2 XmTuuo83Jd0qMMYZBb6Quh5b8w3hXb9JV/8ltrnqFQYgA2nz8+zEcmv020T4819yj3sX vSf5ASiclp8X+vvIkLvKgzVruutDS7GQh+vc7l9u9ewV3bgThPM9g9pUh6PlxqdpZfVx E5baVPppleHnIWEthWn/MOORmnG6r2tqc79g3WYqZj3a7HpvabuR8J+nwb1fcx5ar2tX YOtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 123-20020a630981000000b005ae598c71d8si1154738pgj.900.2023.11.01.21.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 21:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2B1588114EDD; Wed, 1 Nov 2023 21:43:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbjKBEnn (ORCPT + 99 others); Thu, 2 Nov 2023 00:43:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjKBEnm (ORCPT ); Thu, 2 Nov 2023 00:43:42 -0400 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4395A6 for ; Wed, 1 Nov 2023 21:43:36 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1qyPYC-00DSL0-8z; Thu, 02 Nov 2023 12:43:25 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Thu, 02 Nov 2023 12:43:31 +0800 Date: Thu, 2 Nov 2023 12:43:31 +0800 From: Herbert Xu To: Eric Biggers Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev, linux-crypto@vger.kernel.org, gilad@benyossef.com, samitolvanen@google.com Subject: Re: [PATCH] dm-verity: hash blocks with shash import+finup when possible Message-ID: References: <20231030023351.6041-1-ebiggers@kernel.org> <20231101054856.GA140941@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231101054856.GA140941@sol.localdomain> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 01 Nov 2023 21:43:43 -0700 (PDT) On Tue, Oct 31, 2023 at 10:48:56PM -0700, Eric Biggers wrote: > > Note that dm-verity also has to use an ugly and error-prone workaround to use > ahash at all, since its hash blocks can be cached in vmalloc memory; see > verity_hash_update(). shash handles vmalloc memory much more naturally, since > no translation from vmalloc address to page to linear address is needed. So why not drop ahash and always use shash? Does anybody care about offload for dm-verity? Alternatively, we could incorporate this into ahash itself. Then you could have an optimised code path that does not do SGs if the underlying algorithm is shash. I really do not wish to see this ahash/shash paradigm proliferate. > > On a side note, if we're going to use shash for bulk data then we > > should reintroduce the can/cannot sleep flag. > > This patch limits the use of shash to blocks of at most PAGE_SIZE (*), which is > the same as what ahash does internally. > > (*) Except when the data block size is <= PAGE_SIZE but the hash block size is > > PAGE_SIZE. I think that's an uncommon configuration that's not worth > worrying too much about, but it could be excluded from the shash-based code. OK. But we do still have the module signature verification code path and I think that one still needs the can-sleep flag. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt