The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Gunnar Kudrjavets <gunnarku@amazon.com>
Cc: peterhuewe@gmx.de, jgg@ziepe.ca, noodles@meta.com,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
	Justinien Bouron <jbouron@amazon.com>,
	Muhammad Hammad Ijaz <mhijaz@amazon.com>
Subject: Re: [PATCH] tpm: Fix uninitialized name_size_alg in tpm_buf_append_name()
Date: Sat, 9 May 2026 22:35:20 +0300	[thread overview]
Message-ID: <af-MeEbJFmab4YQ8@kernel.org> (raw)
In-Reply-To: <20260507201837.8282-1-gunnarku@amazon.com>

On Thu, May 07, 2026 at 08:18:22PM +0000, Gunnar Kudrjavets wrote:
> When tpm_buf_append_name() is called with a non-NULL name for a
> handle, the code skips the tpm2_read_public() path (which sets
> name_size_alg from the return value) and falls through to memcpy()
> with an uninitialized name_size_alg as the size argument.
> 
> The contract for tpm_buf_append_name() supports callers passing a
> non-NULL name. No current in-tree callers do so, making this a latent
> bug that would trigger if a caller ever provides a pre-computed name
> for a handle.

This is great observation but it is not a regression technically.

Thus, this really should just state the issue and don't make it
look like a bug report based on transcript that does not happen
in the wild.

I guess this is better than parameter removal since name caching
would make sense [1] in future.

[1] Already done but gathered zero interest at the time:
    https://lore.kernel.org/linux-integrity/20260125192526.782202-1-jarkko@kernel.org/
    Probably patch set should be reworked to have only relevant patches
    as my tpm_get_random() patches did not gather too much following :-)

BR, Jarkko

  reply	other threads:[~2026-05-09 19:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 20:18 [PATCH] tpm: Fix uninitialized name_size_alg in tpm_buf_append_name() Gunnar Kudrjavets
2026-05-09 19:35 ` Jarkko Sakkinen [this message]
2026-05-09 22:34   ` [PATCH v2] " Gunnar Kudrjavets
2026-05-10  1:42     ` Jarkko Sakkinen
2026-05-10 17:11       ` [PATCH v2] tpm: Initialize name_size_alg for non-NULL name " Gunnar Kudrjavets
2026-05-10 18:26         ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af-MeEbJFmab4YQ8@kernel.org \
    --to=jarkko@kernel.org \
    --cc=gunnarku@amazon.com \
    --cc=jbouron@amazon.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhijaz@amazon.com \
    --cc=noodles@meta.com \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox