From: Sean Rhodes <sean@starlabs.systems>
To: linux-pm@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
Evan Green <evgreen@chromium.org>,
Sean Rhodes <sean@starlabs.systems>,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
Barry Song <baohua@kernel.org>,
Youngjun Park <youngjun.park@lge.com>,
linux-block@vger.kernel.org, linux-mm@kvack.org,
Xueqin Luo <luoxueqin@kylinos.cn>,
Nicolas Bouchinet <nicolas.bouchinet@oss.cyber.gouv.fr>
Subject: [PATCH v3 RESEND 0/4] PM: hibernate: encrypted snapshots under lockdown
Date: Thu, 17 Sep 2026 14:29:46 +0100 [thread overview]
Message-ID: <cover.1789651778.git.sean@starlabs.systems> (raw)
Lockdown disables hibernation because resume restores kernel memory from an
image userspace can modify. This also prevents a TPM-backed uswsusp
implementation from using /dev/snapshot under lockdown.
This series encrypts and authenticates the snapshot in the kernel. The kernel
generates the image key and wraps it with a seed supplied by trusted early
userspace. TPM policy and unsealing remain outside the PM code.
The seed interface is first-writer-wins and does not provide freshness.
Trusted early userspace must provision it before untrusted privileged code
runs and enforce the required TPM policy, rollback protection and recovery
handling.
Tested on StarFighter MTL with Secure Boot disabled, integrity lockdown
selected manually and a TPM-sealed seed. Keyless and user-key S4 cycles
resumed the same process and boot ID with the swap header restored. Corrupted
wrapped data, invalid magic, a corrupted complete-chunk tag and a wrong user
key were rejected. On exact v3, the user-key cycle and the allocation, free
and reallocation path used by swap-write confinement also passed.
Previous version as it was updated whist waiting review:
https://lore.kernel.org/all/cover.1785838445.git.sean@starlabs.systems/
Changes in v3:
- Rebase on current upstream master.
- Preserve and validate the saved encrypted metadata boundary on resume.
- Drain buffered metadata before a late user-key transition.
- Reserve enough encrypted image space if userspace adds a user key after
querying the image size.
- Apply swap-write confinement before enabling the lockdown exception, while
preserving the ordinary availability check which routes lockdown writes to
the confined path.
- Account the pages actually allocated through the snapshot API instead of
assuming a userspace swap-map format.
- Document the first-writer, anti-replay and userspace I/O requirements.
- Remove an unused swap reverse-mapping helper and tighten local naming.
Changes in v2:
- Keep raw writes to active swap blocked under lockdown.
- Track encrypted snapshot bytes and header writes before allowing
lockdown-time image writes.
- Split the encrypted stream at the metadata boundary only when a user-key
transition is used.
- Return -EFAULT for userspace copy failures.
- Document resume meta_size handling.
Evan Green (1):
PM: hibernate: add seed-wrapped encrypted snapshots
Sean Rhodes (3):
PM: hibernate: confine encrypted snapshot writes
PM: hibernate: permit encrypted snapshot device under lockdown
PM: hibernate: document encrypted snapshot seed ABI
Documentation/ABI/testing/sysfs-power | 18 +
Documentation/power/userland-swsusp.rst | 33 +
block/fops.c | 58 +-
include/linux/suspend.h | 24 +
include/linux/swap.h | 9 +
include/uapi/linux/suspend_ioctls.h | 31 +-
kernel/power/Kconfig | 15 +
kernel/power/Makefile | 1 +
kernel/power/hibernate.c | 32 +
kernel/power/power.h | 3 +
kernel/power/snapenc.c | 952 ++++++++++++++++++++++++
kernel/power/snapshot.c | 5 +
kernel/power/swap.c | 87 +++
kernel/power/user.c | 272 ++++++-
kernel/power/user.h | 150 ++++
mm/swapfile.c | 25 +
16 files changed, 1683 insertions(+), 32 deletions(-)
create mode 100644 kernel/power/snapenc.c
create mode 100644 kernel/power/user.h
next reply other threads:[~2026-09-17 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 13:29 Sean Rhodes [this message]
2026-09-17 13:29 ` [PATCH v3 RESEND 1/4] PM: hibernate: add seed-wrapped encrypted snapshots Sean Rhodes
2026-09-17 13:29 ` [PATCH v3 RESEND 2/4] PM: hibernate: confine encrypted snapshot writes Sean Rhodes
2026-09-17 13:29 ` [PATCH v3 RESEND 3/4] PM: hibernate: permit encrypted snapshot device under lockdown Sean Rhodes
2026-09-17 13:29 ` [PATCH v3 RESEND 4/4] PM: hibernate: document encrypted snapshot seed ABI Sean Rhodes
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=cover.1789651778.git.sean@starlabs.systems \
--to=sean@starlabs.systems \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=evgreen@chromium.org \
--cc=kasong@tencent.com \
--cc=lenb@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=luoxueqin@kylinos.cn \
--cc=nicolas.bouchinet@oss.cyber.gouv.fr \
--cc=nphamcs@gmail.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=shikemeng@huaweicloud.com \
--cc=youngjun.park@lge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®