Skip to contentSkip to conversation

swapon: document encryption support and limitations

PATCH Applied Eric Biggers 2 participants 2 messages Aug 31 – Sep 16

Subsystems (2)
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

PATCH 1/1 swapon: document encryption support and limitations

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.

---
 sys-utils/swapon.8.adoc | 6 ++++++
 1 file changed, 6 insertions(+)
sys-utils/swapon.8.adoc +6 -0
index 923303cd3..ea4a786de 100644
@@ -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

Signature · 1 line
2.55.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Eric Biggers
 sys-utils/swapon.8.adoc | 6 ++++++
 1 file changed, 6 insertions(+)

Applied. Thanks, and sorry for the delay.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com