[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYiZBPN-st_4DlFH@kernel.org>
Date: Sun, 8 Feb 2026 16:09:08 +0200
From: Jarkko Sakkinen <jarkko@...nel.org>
To: linux-integrity@...r.kernel.org
Cc: Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>,
Ross Philipson <ross.philipson@...cle.com>,
Stefan Berger <stefanb@...ux.ibm.com>,
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:KEYS-TRUSTED" <keyrings@...r.kernel.org>,
"open list:SECURITY SUBSYSTEM" <linux-security-module@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 11/11] tpm-buf: Implement managed allocations
On Sun, Jan 25, 2026 at 09:25:21PM +0200, Jarkko Sakkinen wrote:
> From: Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>
>
> Decouple kzalloc from buffer creation, so that a managed allocation can be
> used:
>
> struct tpm_buf *buf __free(kfree) buf = kzalloc(TPM_BUFSIZE,
> GFP_KERNEL);
> if (!buf)
> return -ENOMEM;
>
> tpm_buf_init(buf, TPM_BUFSIZE);
>
> Alternatively, stack allocations are also possible:
>
> u8 buf_data[512];
> struct tpm_buf *buf = (struct tpm_buf *)buf_data;
> tpm_buf_init(buf, sizeof(buf_data));
>
> This is achieved by embedding buffer's header inside the allocated blob,
> instead of having an outer wrapper.
>
> Cc: Ross Philipson <ross.philipson@...cle.com>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@...nsys.com>
> Reviewed-by: Stefan Berger <stefanb@...ux.ibm.com>
Since rest of the series does not seem to move forward maybe I should
rebase this to bottom and send it as a separate patch?
This patch eliminates a category of memory bugs and is that way useful.
It also starts to be pretty well stress tested.
BR, Jarkko
Powered by blists - more mailing lists