Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3380319lqo; Tue, 21 May 2024 15:45:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1+5vhPWBGx7zkkrlnye8pwirY1g49VZvrhr023JXXm4d6sZI6YYO6w2kniwsFkz9sULlBXbWraym2G6M1XccLT+Fi/U+PgUROQnjTbg== X-Google-Smtp-Source: AGHT+IFo7WbGRgE36dfWatAYgmhgKSCYYWvKK45AfIlwlq2Jyeoltn7J/Y+Gl1XbOaU8/JPncc6p X-Received: by 2002:a17:906:fb84:b0:a5c:dd34:2312 with SMTP id a640c23a62f3a-a6228125d3fmr8650766b.62.1716331526243; Tue, 21 May 2024 15:45:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716331526; cv=pass; d=google.com; s=arc-20160816; b=c2HUQ2EZa4kKhuM9MJCDPihayT9KW8XJXhsJlfWyxDlGhJcBX+K668aovBHKAdmKvT wPPsBjDzdzy9kw1XXYJAd5ibqwEO9MHGUWgnB5r84mspcmH+6XgExfnMEOou3YlAhROl MfgyT4PlGZ4clTfwRr1GT42iDtJyhf/gEwU7QcN4sp26pLB1zI+BGO8kq2gONqii1oUE +0jboTegfZIN3A5iLVsdhVBGGJ0nocoHYF4wQ8kem/T2AqeZvlj/xvzD//V0BC8i5u74 XIUcyNETa2i1umZPmq/XV4JpGeoomLf2yAz95Qo7gNKQ0HyE6uHJFGG6zZ2+uvzPiV1K ZnqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=AlnlHHqjgfI1MUCvfHlA0FE315vS6lTVBtY6wSYTwvM=; fh=IW24g7UMNfl2IdouwwYD1fx9AjOjgObrA2mAjxgCpJY=; b=fqIAgF5qvNED/OQdhazzic/upsq/AkzhNZba/sLnotrByx0ZBJGo1orBASdD1EyI0Q QEteKRvReUVEQES4mqJxl6CwMOJAlYO00pch+wHigqS20A+Ao1P3MDnpqt2Qu6LQUD+R zYGmNaMH6ZJEMXXkr+tnnEegRwQNiOL8y3mY5trGXX5lfGCjqll5DlJW/CXceE0WAnfe xLFL/HhZKTf7+BR3gBz6eCQNPDc+gxBNLj1xQj8DWdOtKXO0XZNyopoahHxjyljWSbKh RT7uD516ZB6TS/+aSBGGlUCW6k6JSvuTcCyqHm9u7DlwAtBDSxLHXQTzsUAKl6LhUJA2 c1BA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j5xisYrY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2c426si1403683766b.1001.2024.05.21.15.45.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 15:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j5xisYrY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4317-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E20501F214CC for ; Tue, 21 May 2024 22:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E4D56D1BA; Tue, 21 May 2024 22:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j5xisYrY" 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 0D2DA168BD; Tue, 21 May 2024 22:45:19 +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=1716331520; cv=none; b=B0uKuGUWUuuvNCd5IyO6Q51SG1fcH9biOkbIOMniM2McUZtQcHGA0EfWbOwBh0yO1vTZvHVdFrZ0t3+xXXACJttmYoMi16pVeD5PYLj6sK4aifJJtJRZdgAVwPVn/rnUx8EYfPMoNPTKLwguOmltfyQA7Yy9W9HmJsFFSXIaaS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716331520; c=relaxed/simple; bh=48kAszKzTfCBos6Qet3oVdY1gVv3I049U7CcY8p3F0k=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=a+b5QRa6I1dtWT+rYyR5WfJHIbroPX1HqY0f6YPl8k3Io5q4nC7r0CCmgkRUMwK8AsjbeE6n5xx+2rYl8qbNkiytcRhV38m/RR09xhyb0cptrSMjDO9oGpauFMmTvWvucdgGZoE/jla4t113Lzvs6neuwnYQOwAgeCBnI2s182Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j5xisYrY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DA2C2BD11; Tue, 21 May 2024 22:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716331519; bh=48kAszKzTfCBos6Qet3oVdY1gVv3I049U7CcY8p3F0k=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=j5xisYrYk4Z3Yz1WJ6Hq5lRGNQtJz0s65kjPsgKzPyBm6JFe/YX6hciCUaU/Qt9fH sJfL25lp6nC1+PKiLr+WBADs27TEMpKw6+6nyMfajkMiIMS4jHWeHokivANgsuDUsF 8HkE1GvABrY8uxeS8FY7j9FWTIr5DwU1nBjivZX1ZiUur0boWq0XpYlf6bxW5UXEIt rEveUwq2QuFvWEIyiaiRKHMNUQX3mjZFi12odPKMsQMgqZR+36pj6ppodN4Rw4HOT8 OX5vyxah0/OWh0DZwy3RMyRNFx9G9XeDTQwP51lUgMvzt5q5PyUTFV5qXSl+m/+o5V ajYkwmRfo902g== Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 22 May 2024 01:45:13 +0300 Message-Id: Cc: "Herbert Xu" , , , , "James Prestwood" , "David Woodhouse" , "Eric Biggers" , "David S. Miller" , "open list:CRYPTO API" , "open list" , "Peter Huewe" , "Jason Gunthorpe" , "Mimi Zohar" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , "open list:SECURITY SUBSYSTEM" Subject: Re: [PATCH v2 4/6] KEYS: trusted: Move tpm2_key_decode() to the TPM driver From: "Jarkko Sakkinen" To: "James Bottomley" , "David Howells" X-Mailer: aerc 0.17.0 References: <20240521031645.17008-1-jarkko@kernel.org> <20240521031645.17008-5-jarkko@kernel.org> <336755.1716327854@warthog.procyon.org.uk> <239a52eb5ed3a6c891382b63d08fe7b264850d38.camel@HansenPartnership.com> In-Reply-To: <239a52eb5ed3a6c891382b63d08fe7b264850d38.camel@HansenPartnership.com> On Wed May 22, 2024 at 12:59 AM EEST, James Bottomley wrote: > On Tue, 2024-05-21 at 22:44 +0100, David Howells wrote: > > Jarkko Sakkinen wrote: > >=20 > > > On Tue May 21, 2024 at 9:18 PM EEST, James Bottomley wrote: > > > ... > > > You don't save a single byte of memory with any constant that > > > dictates the size requirements for multiple modules in two disjoint > > > subsystems. > >=20 > > I think James is just suggesting you replace your limit argument with > > a constant not that you always allocate that amount of memory. > > Exactly. All we use it for is the -E2BIG check to ensure user space > isn't allowed to run away with loads of kernel memory. Not true. It did return -EINVAL. This patch changes it to -E2BIG. > > > What the limit should be, OTOH, is up for discussion, but PAGE_SIZE > > seems not unreasonable. > > A page is fine currently (MAX_BLOB_SIZE is 512). However, it may be > too small for some of the complex policies when they're introduced.=20 > I'm not bothered about what it currently is, I just want it to be able > to be increased easily when the time comes. MAX_BLOB_SIZE would be used to cap key blob, not the policy. And you are ignoring it yourself too in the driver. > James BR, Jarkko