From: Jonathan McDowell <noodles@earth.li>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Jonathan McDowell <noodles@meta.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
peterhuewe@gmx.de, linux-integrity@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 5.4 9/9] tpm: End any active auth session before shutdown
Date: Fri, 4 Apr 2025 08:28:03 +0100 [thread overview]
Message-ID: <Z--KA3cyFGsqNBKE@earth.li> (raw)
In-Reply-To: <20250403192050.2682427-9-sashal@kernel.org>
NAK. Not sure on the logic that decided this was applicable for 5.4, but
it's obviously not even been compile tested:
noodles@sevai:~/checkouts/linux$ git checkout v5.4.291
Updating files: 100% (13517/13517), done.
Previous HEAD position was 219d54332a09 Linux 5.4
HEAD is now at 52bcf31d8e3d Linux 5.4.291
noodles@sevai:~/checkouts/linux$ git grep tpm2_end_auth_session
noodles@sevai:~/checkouts/linux$
The auth session bits were introduced in 699e3efd6c645 (tpm: Add HMAC
session start and end functions), which landed in 6.10.
On Thu, Apr 03, 2025 at 03:20:50PM -0400, Sasha Levin wrote:
>From: Jonathan McDowell <noodles@meta.com>
>
>[ Upstream commit 1dbf74e00a5f882b04b398399b6def65cd51ef21 ]
>
>Lazy flushing of TPM auth sessions can interact badly with IMA + kexec,
>resulting in loaded session handles being leaked across the kexec and
>not cleaned up. Fix by ensuring any active auth session is ended before
>the TPM is told about the shutdown, matching what is done when
>suspending.
>
>Before:
>
>root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@debian-qemu-efi:~# kexec --load --kexec-file-syscall …
>root@debian-qemu-efi:~# systemctl kexec
>…
>root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
>- 0x2000000
>root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@debian-qemu-efi:~#
>(repeat kexec steps)
>root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
>- 0x2000000
>- 0x2000001
>root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@debian-qemu-efi:~#
>
>After:
>
>root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@debian-qemu-efi:~# kexec --load --kexec-file-syscall …
>root@debian-qemu-efi:~# systemctl kexec
>…
>root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@debian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@debian-qemu-efi:~#
>
>Signed-off-by: Jonathan McDowell <noodles@meta.com>
>Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
>Signed-off-by: Sasha Levin <sashal@kernel.org>
>---
> drivers/char/tpm/tpm-chip.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
>index 17fbd7f7a2954..b33e938d80e8a 100644
>--- a/drivers/char/tpm/tpm-chip.c
>+++ b/drivers/char/tpm/tpm-chip.c
>@@ -290,6 +290,7 @@ static int tpm_class_shutdown(struct device *dev)
> down_write(&chip->ops_sem);
> if (chip->flags & TPM_CHIP_FLAG_TPM2) {
> if (!tpm_chip_start(chip)) {
>+ tpm2_end_auth_session(chip);
> tpm2_shutdown(chip, TPM2_SU_CLEAR);
> tpm_chip_stop(chip);
> }
>--
>2.39.5
>
>
J.
--
... Inside every living person there's a dead person trying to get out.
next prev parent reply other threads:[~2025-04-04 7:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 19:20 [PATCH AUTOSEL 5.4 1/9] drm: allow encoder mode_set even when connectors change for crtc Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 2/9] drm: panel-orientation-quirks: Add support for AYANEO 2S Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 3/9] drm: panel-orientation-quirks: Add new quirk for GPD Win 2 Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 4/9] drm/bridge: panel: forbid initializing a panel with unknown connector type Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 5/9] drm/amdkfd: clamp queue size to minimum Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 6/9] drm/amdkfd: Fix pqm_destroy_queue race with GPU reset Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 7/9] drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 8/9] fbdev: omapfb: Add 'plane' value check Sasha Levin
2025-04-03 19:20 ` [PATCH AUTOSEL 5.4 9/9] tpm: End any active auth session before shutdown Sasha Levin
2025-04-04 7:28 ` Jonathan McDowell [this message]
2025-04-14 0:11 ` Sasha Levin
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=Z--KA3cyFGsqNBKE@earth.li \
--to=noodles@earth.li \
--cc=jarkko@kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noodles@meta.com \
--cc=peterhuewe@gmx.de \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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.