linux-stable/fs/ext4
Theodore Ts'o d666dfaa57 ext4: don't BUG if someone dirty pages without asking ext4 first
[ Upstream commit cc5095747e ]

[un]pin_user_pages_remote is dirtying pages without properly warning
the file system in advance.  A related race was noted by Jan Kara in
2018[1]; however, more recently instead of it being a very hard-to-hit
race, it could be reliably triggered by process_vm_writev(2) which was
discovered by Syzbot[2].

This is technically a bug in mm/gup.c, but arguably ext4 is fragile in
that if some other kernel subsystem dirty pages without properly
notifying the file system using page_mkwrite(), ext4 will BUG, while
other file systems will not BUG (although data will still be lost).

So instead of crashing with a BUG, issue a warning (since there may be
potential data loss) and just mark the page as clean to avoid
unprivileged denial of service attacks until the problem can be
properly fixed.  More discussion and background can be found in the
thread starting at [2].

[1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@quack2.suse.cz
[2] https://lore.kernel.org/r/Yg0m6IjcNmfaSokM@google.com

Reported-by: syzbot+d59332e2db681cf18f0318a06e994ebbb529a8db@syzkaller.appspotmail.com
Reported-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/YiDS9wVfq4mM2jGK@mit.edu
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:08:22 +02:00
..
acl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
balloc.c ext4: fix potential race between online resizing and write operations 2020-03-11 18:02:42 +01:00
bitmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
block_validity.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
dir.c ext4: fix potential infinite loop in ext4_dx_readdir() 2021-10-06 15:05:09 +02:00
ext4.h ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
ext4_extents.h ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max 2020-06-20 10:25:15 +02:00
ext4_jbd2.c ext4: shutdown should not prevent get_write_access 2018-04-24 09:36:30 +02:00
ext4_jbd2.h ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
extents.c ext4: fix kernel infoleak via ext4_extent_header 2021-07-20 16:17:28 +02:00
extents_status.c ext4: remove check for zero nr_to_scan in ext4_es_scan() 2021-07-20 16:17:28 +02:00
extents_status.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT 2020-02-28 16:35:55 +01:00
fsmap.c ext4: limit entries returned when counting fsmap records 2020-10-29 09:07:11 +01:00
fsmap.h ext4: support GETFSMAP ioctls 2017-04-30 00:36:53 -04:00
fsync.c ext4: fix race between ext4_sync_parent() and rename() 2020-06-20 10:25:15 +02:00
hash.c ext4: remove useless test and assignment in strtohash functions 2017-08-24 15:11:34 -04:00
ialloc.c ext4: fix avefreec in find_group_orlov 2021-07-20 16:17:29 +02:00
indirect.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
inline.c ext4: fix error handling in ext4_restore_inline_data() 2022-02-08 18:16:30 +01:00
inode.c ext4: don't BUG if someone dirty pages without asking ext4 first 2022-04-20 09:08:22 +02:00
ioctl.c ext4: avoid trim error on fs with small groups 2022-01-27 09:00:52 +01:00
Kconfig
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mballoc.c ext4: avoid trim error on fs with small groups 2022-01-27 09:00:52 +01:00
mballoc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
migrate.c ext4: don't use the orphan list when migrating an inode 2022-01-27 09:00:59 +01:00
mmp.c ext4: don't assume that mmp_nodename/bdevname have NUL 2020-02-28 16:35:52 +01:00
move_extent.c ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
namei.c ext4: fix potential htree corruption when growing large_dir directories 2021-08-15 13:03:31 +02:00
page-io.c ext4: fix deadlock allocating crypto bounce page from mempool 2020-02-14 16:32:19 -05:00
readpage.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
resize.c ext4: add check to prevent attempting to resize an fs with sparse_super2 2022-03-16 12:57:09 +01:00
super.c ext4: Fix BUG_ON in ext4_bread when write quota data 2022-01-27 09:00:59 +01:00
symlink.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysfs.c ext4: sysfs: print ext4_super_block fields as little-endian 2018-09-05 09:26:36 +02:00
truncate.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr.c ext4: add reclaim checks to xattr code 2021-03-30 14:40:12 +02:00
xattr.h ext4: add extra checks to ext4_xattr_block_get() 2018-04-24 09:36:31 +02:00
xattr_security.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr_trusted.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr_user.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00