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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9rWqCutMrz6sAgQ@earth.li>
Date: Wed, 19 Mar 2025 14:37:28 +0000
From: Jonathan McDowell <noodles@...th.li>
To: Peter Huewe <peterhuewe@....de>, Jarkko Sakkinen <jarkko@...nel.org>,
	Jason Gunthorpe <jgg@...pe.ca>,
	James Bottomley <James.Bottomley@...senpartnership.com>
Cc: linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tpm: End any active auth session before shutdown

Gentle poke about this patch, which I haven't seen any feedback for.  
It's causing us a problem in terms of having a string of kexecs result 
in the kernel no longer being able to talk to the TPM with an HMAC 
session, and the rng random data fetches from the TPM then failing.

On Fri, Mar 07, 2025 at 12:25:23PM +0000, Jonathan McDowell wrote:
>From: Jonathan McDowell <noodles@...a.com>
>
>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@...ian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@...ian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@...ian-qemu-efi:~# kexec --load --kexec-file-syscall …
>root@...ian-qemu-efi:~# systemctl kexec
>…
>root@...ian-qemu-efi:~# tpm2_getcap handles-loaded-session
>- 0x2000000
>root@...ian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@...ian-qemu-efi:~#
>(repeat kexec steps)
>root@...ian-qemu-efi:~# tpm2_getcap handles-loaded-session
>- 0x2000000
>- 0x2000001
>root@...ian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@...ian-qemu-efi:~#
>
>After:
>
>root@...ian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@...ian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@...ian-qemu-efi:~# kexec --load --kexec-file-syscall …
>root@...ian-qemu-efi:~# systemctl kexec
>…
>root@...ian-qemu-efi:~# tpm2_getcap handles-loaded-session
>root@...ian-qemu-efi:~# tpm2_getcap handles-saved-session
>root@...ian-qemu-efi:~#
>
>Signed-off-by: Jonathan McDowell <noodles@...a.com>
>---
> 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 7df7abaf3e52..87f01269b9b5 100644
>--- a/drivers/char/tpm/tpm-chip.c
>+++ b/drivers/char/tpm/tpm-chip.c
>@@ -300,6 +300,7 @@ 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.48.1
>
>

J.

-- 
I've got a trigger inside.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ