Linux block layer
 help / color / mirror / Atom feed
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>,
	Sean Rhodes <sean@starlabs.systems>,
	Evan Green <evgreen@chromium.org>,
	linux-kernel@vger.kernel.org, Xueqin Luo <luoxueqin@kylinos.cn>,
	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
Subject: [PATCH v2 0/4] PM: hibernate: encrypted snapshots under lockdown
Date: Tue,  4 Aug 2026 11:14:33 +0100	[thread overview]
Message-ID: <cover.1785838445.git.sean@starlabs.systems> (raw)

v1 was sent as an RFC. This version keeps TPM policy and seed unsealing in
early userspace, while the kernel encrypts and authenticates the uswsusp image
from a locked seed.

The stack adds the snapshot_seed ABI, permits the snapshot device under
lockdown only once encryption is enabled, documents the userspace flow, and
restricts lockdown-time block writes to the active encrypted snapshot
image/header path.

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.
- Only split the encrypted stream at the metadata boundary when a user key
  switch is used.
- Return -EFAULT for userspace copy failures.
- Document resume meta_size handling.

Tested on StarFighter MTL with a TPM-sealed seed: encrypted uswsusp
suspend/resume completed and restored the image. Also tested with lockdown
enabled through the encrypted snapshot device path.

Evan Green (1):
  PM: hibernate: add seed-wrapped encrypted snapshots

Sean Rhodes (3):
  PM: hibernate: permit encrypted snapshot device under lockdown
  PM: hibernate: document encrypted snapshot seed ABI
  PM: hibernate: harden encrypted snapshot write path

 Documentation/ABI/testing/sysfs-power   |  14 +
 Documentation/power/userland-swsusp.rst |  20 +
 block/fops.c                            |  55 +-
 include/linux/suspend.h                 |  22 +
 include/linux/swap.h                    |  16 +
 include/uapi/linux/suspend_ioctls.h     |  31 +-
 kernel/power/Kconfig                    |  15 +
 kernel/power/Makefile                   |   1 +
 kernel/power/hibernate.c                |  32 +
 kernel/power/power.h                    |   4 +
 kernel/power/snapenc.c                  | 940 ++++++++++++++++++++++++
 kernel/power/snapshot.c                 |   5 +
 kernel/power/swap.c                     |  98 +++
 kernel/power/user.c                     | 247 ++++++-
 kernel/power/user.h                     | 151 ++++
 mm/swapfile.c                           |  32 +
 16 files changed, 1651 insertions(+), 32 deletions(-)
 create mode 100644 kernel/power/snapenc.c
 create mode 100644 kernel/power/user.h


             reply	other threads:[~2026-08-04 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 10:14 Sean Rhodes [this message]
2026-08-04 10:14 ` [PATCH v2 1/4] PM: hibernate: add seed-wrapped encrypted snapshots Sean Rhodes
2026-08-04 10:14 ` [PATCH v2 2/4] PM: hibernate: permit encrypted snapshot device under lockdown Sean Rhodes
2026-08-04 10:14 ` [PATCH v2 3/4] PM: hibernate: document encrypted snapshot seed ABI Sean Rhodes
2026-08-04 10:14 ` [PATCH v2 4/4] PM: hibernate: harden encrypted snapshot write path 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.1785838445.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=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