From: Jarkko Sakkinen <jarkko@kernel.org>
To: Matthew Garrett <matthewg@nvidia.com>
Cc: mjg59@srcf.ucam.org, keyrings@vger.kernel.org,
James.Bottomley@hansenpartnership.com,
linux-integrity@vger.kernel.org, rafael@kernel.org,
linux-pm@vger.kernel.org, linux-efi@vger.kernel.org
Subject: Re: [RFC] Make hibernation work with lockdown
Date: Thu, 8 Oct 2026 18:56:41 +0300 [thread overview]
Message-ID: <ase9OQGWtEvDp0qH@kernel.org> (raw)
In-Reply-To: <20261008132532.1155166-1-matthewg@nvidia.com>
On Thu, Oct 08, 2026 at 06:20:16AM -0700, Matthew Garrett wrote:
> Hibernation writes out the full system state to disk in an unencrypted
> and unauthenticated manner. Resuming from hibernate reads that data and
> throws it directly into RAM, then jumps into it. This is effectively an
> entirely unauthenticated mechanism for putting whatever you want into
> kernel space. This violates the assumptions around lockdown (root can
> write whatever they want to the swap partition and then trigger a
> resume), and as such lockdown blocks hibernate.
>
> This has made many people unhappy.
>
> This patchset seeks to solve this problem. In order for hibernation to
> be trustworthy we need to be able to prove that the image was generated
> by the kernel and not modified after that. This is not an easy task, and
> requires some infrastructural framework. To that end, this patchset does
> the following:
>
> 1) Co-opts a TPM NV index for the kernel's sole use. This is currently a
> placeholder and we should register one explicitly from an appropriate
> range in order to ensure that we don't conflict with userland.
>
> 2) Does something horrifying with PCR 5 in order to prove that a given
> kernel supports (1). We need to extend and cap a PCR before userland is
> running in order to prove that the kernel has support for this feature,
> but since we don't currently cap any PCRs there's nothing stopping
> userland from doing the same and so achieving the same state. The way
> around this is to rely on a feature of PCR 5 - it is extended as a
> result of ExitBootServices being called, and since the boot stub can
> execute code before that happens we can perform the proof extension
> there and then have it implicitly capped by the firmware's extension.
>
> 3) Adds support for audited TPM sessions in the kernel, allowing us to
> generate signed digests of the commands that were executed in that
> session and their results
>
> 4) Adds support for generating a predictable AK that can be used to sign
> digests from those audit sessions
>
> 5) Adds support for generating a TPM signing key in such a session, and
> using the signed digest to prove that the session took place in the
> kernel
>
> 6) Signs the hibernation image with such a key
>
> An old kernel that doesn't implement (1) won't be able to mimic the same
> PCR 5 value. Userland won't be able to mimic the NV index value because
> the kernel will block it. This means that the only way that key could
> have been created is by the kernel, and so we can trust that the image
> was generated by the kernel.
>
> QUESTIONS:
>
> 1) I haven't tried to make the key management generic, since this isn't
> intended to ever be exposed to userland in any way. Should it be
> integrated into the trusted keys layer anyway?
If we don't have a use case, I don't think so...
>
> 2) Filtering TPM commands from userland isn't ideal - anyone able to
> poke commands into the TPM directly is in a position to violate the
> assumptions here. Is there any way we can get a secret into the kernel
> that can be used as an auth value? It would need to be impossible to
> obtain from userland and it would need to be consistent over platform
> reboots.
We could generate a primary key and a keyedhash key that would be stored
outside kernel while data is at rest. Then during power on they could be
read to the kernel memory.
I did not consider who would create the files in the first place.
I neither did look at the code yet meaning that my comments should
definitely be taken with a grain of salt. Just writing down a remark.
Br, Jarkko
prev parent reply other threads:[~2026-10-08 15:56 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 13:20 [RFC] Make hibernation work with lockdown Matthew Garrett
2026-10-08 13:20 ` [PATCH 01/17] tpm: Define a kernel-owned TPM NV index that can't be modified by userland Matthew Garrett
2026-10-08 13:41 ` Matthew Garrett
2026-10-08 16:24 ` Jarkko Sakkinen
2026-10-08 16:23 ` Jarkko Sakkinen
2026-10-09 8:33 ` Matthew Garrett
2026-10-08 17:06 ` Ilias Apalodimas
2026-10-10 9:22 ` James Bottomley
2026-10-08 13:20 ` [PATCH 02/17] efi: Add a mechanism to modify TPM state depending on kernel security features Matthew Garrett
2026-10-08 16:38 ` Jarkko Sakkinen
2026-10-08 13:20 ` [PATCH 03/17] tpm: Allow tpm2_start_auth_session() to start an audit session Matthew Garrett
2026-10-08 13:20 ` [PATCH 04/17] tpm: Log commands executed in " Matthew Garrett
2026-10-08 13:20 ` [PATCH 05/17] tpm: Add a kernel attestation key and signed audit digest retrieval Matthew Garrett
2026-10-08 16:45 ` James Bottomley
2026-10-09 8:29 ` Matthew Garrett
2026-10-08 13:20 ` [PATCH 06/17] tpm: Use TPM2_NV_ReadPublic to read NV index names Matthew Garrett
2026-10-08 13:20 ` [PATCH 07/17] tpm: Add in-kernel support for reading NV indices Matthew Garrett
2026-10-08 13:20 ` [PATCH 08/17] tpm: Add NV define, undefine and write helpers Matthew Garrett
2026-10-08 13:20 ` [PATCH 09/17] tpm: Provision the kernel NV index at registration Matthew Garrett
2026-10-08 13:20 ` [PATCH 10/17] tpm: Move the bounds-checked response reader to a header Matthew Garrett
2026-10-08 13:20 ` [PATCH 11/17] tpm: Add kernel signing key creation with audited provenance Matthew Garrett
2026-10-08 17:00 ` James Bottomley
2026-10-09 8:31 ` Matthew Garrett
2026-10-08 13:20 ` [PATCH 12/17] tpm: Add signing with the kernel signing key Matthew Garrett
2026-10-08 13:20 ` [PATCH 13/17] tpm: Add verification of kernel signing key provenance Matthew Garrett
2026-10-10 9:34 ` James Bottomley
2026-10-10 9:42 ` James Bottomley
2026-10-08 13:20 ` [PATCH 14/17] PM: hibernate: Add image digest and signature page infrastructure Matthew Garrett
2026-10-08 13:20 ` [PATCH 15/17] PM: hibernate: Sign and verify images with a kernel-generated TPM key Matthew Garrett
2026-10-08 13:20 ` [PATCH 16/17] PM: hibernate: Refuse to verify images with a virtual TPM Matthew Garrett
2026-10-08 13:20 ` [PATCH 17/17] PM: hibernate: Allow hibernation under lockdown with signed images Matthew Garrett
2026-10-08 16:53 ` Jarkko Sakkinen
2026-10-09 8:31 ` Matthew Garrett
2026-10-08 15:56 ` Jarkko Sakkinen [this message]
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=ase9OQGWtEvDp0qH@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthewg@nvidia.com \
--cc=mjg59@srcf.ucam.org \
--cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox