Skip to contentSkip to conversation

vfs: prohibit writes to active swap devices

GIT PULL Merged Darrick J. Wong 2 participants 2 messages Sep 17, 2019 – Sep 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

Please pull this short series that prevents writes to active swap files and swap devices. There's no non-malicious use case for allowing userspace to scribble on storage that the kernel thinks it owns.

The branch merges cleanly against this morning's HEAD and survived an overnight run of xfstests. The merge was completely straightforward, so please let me know if you run into anything weird.

--D

The following changes since commit 609488bc979f99f805f34e9a32c1e3b71179d10b:

Linux 5.3-rc2 (2019-07-28 12:47:02 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git tags/vfs-5.4-merge-1

for you to fetch changes up to dc617f29dbe5ef0c8ced65ce62c464af1daaab3d:

vfs: don't allow writes to swap files (2019-08-20 07:55:16 -0700)

----------------------------------------------------------------
Changes for 5.4:
- Prohibit writing to active swap files and swap partitions.

----------------------------------------------------------------
Darrick J. Wong (2):
mm: set S_SWAPFILE on blockdev swap devices
vfs: don't allow writes to swap files

 fs/block_dev.c     |  3 +++
 include/linux/fs.h | 11 +++++++++++
 mm/filemap.c       |  3 +++
 mm/memory.c        |  4 ++++
 mm/mmap.c          |  8 ++++++--
 mm/swapfile.c      | 41 +++++++++++++++++++++++++----------------
 6 files changed, 52 insertions(+), 18 deletions(-)