* [PATCH util-linux] swapon: document encryption support and limitations
@ 2026-08-31 17:57 Eric Biggers
0 siblings, 0 replies; only message in thread
From: Eric Biggers @ 2026-08-31 17:57 UTC (permalink / raw)
To: util-linux; +Cc: Baoquan He, linux-fscrypt, Eric Biggers
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-31 17:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 17:57 [PATCH util-linux] swapon: document encryption support and limitations Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox