From: Jarkko Sakkinen <jarkko@kernel.org>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>,
Jonathan McDowell <noodles@earth.li>,
linux-integrity@vger.kernel.org
Subject: Re: Unbalanced TPM2 HMAC session calls
Date: Thu, 6 Mar 2025 23:39:56 +0200 [thread overview]
Message-ID: <Z8oWLCVk4E1Ly2cQ@kernel.org> (raw)
In-Reply-To: <1e1f60fae0fa86a4f3c16106836f63cf1709ab5e.camel@HansenPartnership.com>
On Thu, Mar 06, 2025 at 11:30:01AM -0800, James Bottomley wrote:
> On Thu, 2025-03-06 at 13:59 -0500, Mimi Zohar wrote:
> > On Thu, 2025-03-06 at 15:15 +0000, Jonathan McDowell wrote:
> > > We're seeing a lot of:
> > >
> > > tpm tpm0: auth session is active
> > >
> > > messages in our logs. This is emitted (once per boot) by
> > > tpm2_start_auth_session() if the auth sessions is already active
> > > when it is called.
> > >
> > > Investigating I think this is because tpm2_pcr_extend() calls
> > > tpm_buf_append_hmac_session() which sets TPM2_SA_CONTINUE_SESSION
> > > so tpm_buf_check_hmac_response() does not cleanup the auth session,
> > > but then doesn't call tpm2_end_auth_session().
> > >
> > > Looking at tpm2_get_random() it uses TPM2_SA_CONTINUE_SESSION but
> > > *also* cleans up with tpm2_end_auth_session().
> > >
> > > I'd be sending a patch proposing the addition of
> > > tpm2_end_auth_session() to the end of tpm2_pcr_extend() but I
> > > recall a bunch of discussion about trying to cache the HMAC session
> > > to improve IMA performance, so I don't know if perhaps we should be
> > > dropping the warning instead?
> >
> > Hi Jonathan,
> >
> > That suggestion was nixed.
>
> Well it's also upstream as
>
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df745e25098dcb2f706399c0d06dd8d1bab6b6ec
>
> even though it didn't work out for large numbers of extends. However,
> that commit introduced this message on a warn once behaviour, so it
> seems to be expected that this gets printed once for some reason. From
> a code flow point of view, the lazy session handling seems to be
> working correctly, so I think just dropping the warn is correct.
+1
>
> Regards,
>
> James
BR, Jarkko
next prev parent reply other threads:[~2025-03-06 21:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 15:15 Unbalanced TPM2 HMAC session calls Jonathan McDowell
2025-03-06 18:59 ` Mimi Zohar
2025-03-06 19:30 ` James Bottomley
2025-03-06 19:43 ` Mimi Zohar
2025-03-06 21:39 ` Jarkko Sakkinen [this message]
2025-03-06 21:39 ` Jarkko Sakkinen
2025-03-07 10:56 ` [PATCH] tpm: Drop warning when an auth session is active Jonathan McDowell
2025-03-07 16:36 ` Jarkko Sakkinen
2025-03-07 17:25 ` Jonathan McDowell
2025-03-07 19:49 ` Jarkko Sakkinen
2025-03-07 10:58 ` [PATCH] tpm: Lazily flush auth session when getting random data Jonathan McDowell
2025-03-07 16:34 ` 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=Z8oWLCVk4E1Ly2cQ@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=linux-integrity@vger.kernel.org \
--cc=noodles@earth.li \
--cc=zohar@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.