From: Eric Biggers <ebiggers@kernel.org>
To: util-linux@vger.kernel.org
Cc: Baoquan He <baoquan.he@linux.dev>,
linux-fscrypt@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH util-linux] swapon: document encryption support and limitations
Date: Mon, 31 Aug 2026 10:57:38 -0700 [thread overview]
Message-ID: <20260831175738.37770-1-ebiggers@kernel.org> (raw)
The Linux kernel was recently updated to explicitly disallow using a
filesystem-level encrypted file directly as a swap file
(https://git.kernel.org/linus/c310a8932a3107c9), since it was broken.
It is unlikely that anyone was doing this anyway, since encrypted swap
is actually done in other ways, usually dm-crypt. However, as requested
(https://lore.kernel.org/linux-mm/amy7Biucbf-et5O2@MiWiFi-R3L-srv/) also
update the swapon(8) man page to explicitly document this.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
sys-utils/swapon.8.adoc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys-utils/swapon.8.adoc b/sys-utils/swapon.8.adoc
index 923303cd3..ea4a786de 100644
--- a/sys-utils/swapon.8.adoc
+++ b/sys-utils/swapon.8.adoc
@@ -209,6 +209,12 @@ Since version 2.41, the command *mkswap --file* can create a new swap file with
Swap over *NFS* may not work.
+=== Encryption
+
+Swap can be encrypted by using a dm-crypt device as the swap device.
+
+A filesystem-level encrypted file can also be used as swap, but only if a loop device is set up on top of it (see *losetup*(8)) and that loop device is used as the swap device. Using a filesystem-level encrypted file directly as a swap file is unsupported.
+
=== Suspend
*swapon* automatically detects and rewrites a swap space signature with old software suspend data (e.g., *S1SUSPEND*, *S2SUSPEND*, ...). The problem is that if we don't do it, then we get data corruption the next time an attempt at unsuspending is made.
base-commit: c3275e32946289641faf567af6748539acb3e802
--
2.55.0
reply other threads:[~2026-08-31 17:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260831175738.37770-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=linux-fscrypt@vger.kernel.org \
--cc=util-linux@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.