lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aF3KoHdo6dY6nYbw@kernel.org>
Date: Fri, 27 Jun 2025 01:33:04 +0300
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: linux-kernel@...r.kernel.org, keyrings@...r.kernel.org,
	Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>,
	Peter Huewe <peterhuewe@....de>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	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] tpm: Create cleanup class for tpm_buf

On Thu, Jun 26, 2025 at 09:24:48PM +0300, Jarkko Sakkinen wrote:
> > At least I would add the class and drop the tpm_buf_destroy() as one
> > patch, and another would be to cleanup any empty gotos.
> > 
> > Also, I think the style guide for cleanup.h is to not use the
> > variable block, so it should be more like:
> > 
> > CLASS(tpm_buf, buf)();
> > if (!tpm_buf)
> >    return -ENOMEM;
> > 
> > AFAICT, but that seems to be some kind of tribal knowledge.
> 
> This was improved in v2 :-) If you have some proposal how you'd
> liked that version to be splitted, please give feedback.

After a bit of thought, II could split v2 e.g., into to the following
list of patches (a draft, along the lines):

1. Prepare internals for API changes.
2. Implement tpm_buf_alloc().
3. Implement CLASS_TPM_BUF() macro.
4. Changes for tpm{1,2}-cmd.c.
6. Changes for tpm2-sessions.c.
7. Changes for tpm2-space.c.
8. Changes for trusted_tpm{1,2}.c
9. Remove stuff left w/o a call site.

It's pretty good exercise for v2 actually as it is already somewhat
functional code. By doing this split this update will get already
reasonably well verified.

I should also probably emphasize the motivation better in the next
version.  Especially with multiple tpm_buf instances in the same
function scope, things do something are messy to backtrack. In addition,
this complexity might cap the motivation for someone to contribute a
useful feature.

I don't really have even followed Linus' opinions in this topic per se
I personally just think that since I have a measured argument for this.
I got with that and talk with Linus if he wants to bring it up :-)

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ