[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aF2NNHilFfZwBoxA@kernel.org>
Date: Thu, 26 Jun 2025 21:11:00 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: James Bottomley <James.Bottomley@...senpartnership.com>
Cc: linux-kernel@...r.kernel.org, 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, Jun 26, 2025 at 10:50:22AM -0400, James Bottomley wrote:
> 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.
Thanks for the valuable feedback.
I can drop "buf_size" parameter. It is not a priority, and I also
agree with your comments.
>
> Regards,
>
> James
BR, Jarkko
Powered by blists - more mailing lists