[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a70dbdba3cef9f7ec580ce0147b1c89feb28074.camel@HansenPartnership.com>
Date: Thu, 26 Jun 2025 10:50:22 -0400
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Jarkko Sakkinen <jarkko@...nel.org>, linux-kernel@...r.kernel.org
Cc: keyrings@...r.kernel.org, Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>,
Peter Huewe <peterhuewe@....de>, Jason Gunthorpe <jgg@...pe.ca>, Mimi
Zohar <zohar@...ux.ibm.com>, David Howells <dhowells@...hat.com>, Paul
Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>, "Serge E.
Hallyn" <serge@...lyn.com>, "open list:TPM DEVICE DRIVER"
<linux-integrity@...r.kernel.org>, "open list:SECURITY SUBSYSTEM"
<linux-security-module@...r.kernel.org>
Subject: Re: [PATCH v2] tpm: Cleanup class for tpm_buf
On Thu, 2025-06-26 at 13:19 +0300, Jarkko Sakkinen wrote:
> From: Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>
>
> Create a cleanup class for struct tpm_buf using DEFINE_CLASS(), which
> will guarantee that the heap allocated memory will be freed
> automatically for the transient instances of this structure, when
> they go out of scope.
>
> Wrap this all into help macro CLASS_TPM_BUF().
>
> A TPM buffer can now be declared trivially:
>
> CLASS_TPM_BUF(buf, buf_size);
Well, that's not all ... you're also adding a size to the API that we
didn't have before, which should at least be documented in the commit
message and probably be a separate patch.
What is the reason for this, though? The reason we currently use a
page is that it's easy for the OS to manage (no slab fragmentation
issues). The TCG reference platform defines this to be just under 4k
(actually 4096-0x80) precisely because TPM implementations don't do
scatter gather, so they don't want it going over an ARM page, so
there's no danger of us ever needing more than a page.
Regards,
James
Powered by blists - more mailing lists