Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31738021rwd; Fri, 7 Jul 2023 03:51:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlGbHlFiVNBZUByeVoRwdFHYh67xMBmWD8hPytmqlwePN5NUaue1yVkVhZw0e6DWouJBtUCl X-Received: by 2002:a17:902:db12:b0:1b8:9215:9163 with SMTP id m18-20020a170902db1200b001b892159163mr5545702plx.6.1688727085128; Fri, 07 Jul 2023 03:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688727085; cv=none; d=google.com; s=arc-20160816; b=ceKds5YOZOQF+7GBWaeIw79NFVGEJsUbNFwWjzORHm31ccApzGWCVmrz+5GXE1RXD/ 3/oKeOQfXA0KcAheiURElcqELGdHF0tDTJIAkeT8tTCojNVKS0Hv30cQfoBCxyTZlUTL AdrYndBAmNTsn865gjKIOgqXPBpzdbcbJoqwE8yNfv1pEXEI4/NwS9q+YwOepNAu2m4w TKJOrlh7yLzduMZI9/D/rvg6PB7QGxHUm8fivvtMOB9jvXJugx9O43yKNb/69vY1s7yL mO/CBhCuKOQTlcw7EzmaZ4c2X9b7oELFaoxhegm5IaWwE+9OyaVuUWtZSGQ76cRcCtEx q6LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=k2/vCgILvmVJSsmBnlxcM6iJxhHNGN00w3k9umPrbhE=; fh=Epgggzb5PZgxJgVcpZLkTpAMSonvD7KkcwAOKTggXQA=; b=KulKu1R49cbbd77+hH5ebXbH2+u88rcOZvxhZcZ+rQl+eCGMlXlmopHR0syf+Zs2L4 1bFVXM+0cqLzC85o0tUwXWDhgSRAiKGFVza9iJ/td5n8/vwb13XR76ct7mLfRB4DRZun YCmfES5cp+4gqYqPnPUZXdFNt9m965B0jIc9ydP+Wo1KnfMjnFlxAvypfW14A1zthExm zxC4DkTSjIrYqKicY8iozH8o+pspLcRTE4uIfmhCVhCd6rA+GwrClVwQfNhFDXNLH+hx DIwhzA8VFFV1x885VWtnnGTlzTjM4oMNdMw3Fmqac+QFdFtU4iXMRXQQ47rOswZbJzpb qT5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CoKcEfzd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020a17090340c700b001b3ada5bbc5si3255817pld.506.2023.07.07.03.51.04; Fri, 07 Jul 2023 03:51:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@redhat.com header.s=mimecast20190719 header.b=CoKcEfzd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjGGKmI (ORCPT + 99 others); Fri, 7 Jul 2023 06:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjGGKmI (ORCPT ); Fri, 7 Jul 2023 06:42:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F17F81737 for ; Fri, 7 Jul 2023 03:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688726485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k2/vCgILvmVJSsmBnlxcM6iJxhHNGN00w3k9umPrbhE=; b=CoKcEfzdE5EnLrbR6oQYifhwf+d3cHEC4cNWKQFZMA7QTGZNYLu/yWrqxXonBFpTSPpbuH qsiERoKU0h93AnYthXnH9SsA9RvZ32/57UNAQulTM4M04SRU+nPIlDEPYEHiMQVw2CxhZn 7LeZLuOUp8+1MPQwWvkKgnYH5zGpVvE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-35-_-BNR3qjO8ycyI6cBa31ZQ-1; Fri, 07 Jul 2023 06:41:20 -0400 X-MC-Unique: _-BNR3qjO8ycyI6cBa31ZQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 395B63C0F68E; Fri, 7 Jul 2023 10:41:19 +0000 (UTC) Received: from file1-rdu.file-001.prod.rdu2.dc.redhat.com (unknown [10.11.5.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F4B6F640B; Fri, 7 Jul 2023 10:41:19 +0000 (UTC) Received: by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix, from userid 12668) id 0A67530C0457; Fri, 7 Jul 2023 10:41:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix) with ESMTP id 06C5A3FB76; Fri, 7 Jul 2023 12:41:19 +0200 (CEST) Date: Fri, 7 Jul 2023 12:41:19 +0200 (CEST) From: Mikulas Patocka To: Eric Biggers cc: Giovanni Cabiddu , Fiona Trahe , herbert@gondor.apana.org.au, horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, heinzm@redhat.com, snitzer@kernel.org, linux-kernel@vger.kernel.org, qat-linux@intel.com, iuliana.prodan@nxp.com, dm-devel@redhat.com, meenakshi.aggarwal@nxp.com, linux-crypto@vger.kernel.org, davem@davemloft.net, agk@redhat.com, V.Sethi@nxp.com Subject: Re: [dm-devel] [PATCH 2/3] crypto: api - adjust meaning of CRYPTO_ALG_ALLOCATES_MEMORY In-Reply-To: <20230705201812.GB866@sol.localdomain> Message-ID: References: <20230705164009.58351-1-giovanni.cabiddu@intel.com> <20230705164009.58351-3-giovanni.cabiddu@intel.com> <20230705201812.GB866@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 5 Jul 2023, Eric Biggers wrote: > On Wed, Jul 05, 2023 at 05:40:08PM +0100, Giovanni Cabiddu wrote: > > > Algorithms that do not set this flag will guarantee > > "will guarantee" => "guarantee" > > > that memory is not allocated during request processing, except in > > the avoidable exception cases described below. > > "avoidable exception cases" => "exception cases" > > Whether they are avoidable depends on the user. > > > * Users can request an algorithm with this flag unset if they can't handle > > * memory allocation failures or sleeping during request processing. > > Why add the "sleeping during request processing" part? Isn't that controlled on > a per-request basis by CRYPTO_TFM_REQ_MAY_SLEEP which is a separate thing? > > > * They should also follow the constraints below. > > "should" => "must" > > > + * - The input and output scatterlists must have no more than 4 entries. > > + * If the scatterlists contain more than 4 entries, the algorithm may > > + * allocate memory. > > "If the scatterlists contains" => "If either scatterlist contains" > > Otherwise it is unclear whether this is talking about the length of each > scatterlist individually, or the sum of their lengths. > > - Eric Hi I wouldn't change the meaning of CRYPTO_ALG_ALLOCATES_MEMORY (because people will forget about this subtle change anyway). Also note that dm-integrity allocates arbitrarily large sg-lists when encrypting the journal, so if you change the meaning of CRYPTO_ALG_ALLOCATES_MEMORY, there would be no flag left for dm-integrity to test. I would introduce a new flag, something like CRYPTO_ALG_ALLOCATES_MEMORY_FOR_5_OR_MORE_SG_ENTRIES. dm-crypt can then filter the algorithms based on this flag - and the rest of the kernel code may stay unchanged. Mikulas