syzbot


possible deadlock in ntfs_readpage

Status: upstream: reported C repro on 2022/09/26 05:24
Subsystems: ntfs
[Documentation on labels]
Reported-by: syzbot+9698d1feae8c8dc58a8f@syzkaller.appspotmail.com
First crash: 802d, last: 652d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in ntfs_readpage ntfs C 40 648d 802d 0/1 upstream: reported C repro on 2022/09/26 03:04
linux-5.15 possible deadlock in ntfs_readpage origin:upstream missing-backport C unreliable 211 9d12h 632d 0/3 upstream: reported C repro on 2023/03/15 17:04

Sample crash report:
IPVS: ftp: loaded support on port[0] = 21
ntfs: volume version 3.1.
syz-executor293 (8100): drop_caches: 1
syz-executor293 (8100): drop_caches: 1
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:0/7 is trying to acquire lock:
00000000e1f3a370 (&rl->lock){++++}, at: ntfs_read_block fs/ntfs/aops.c:265 [inline]
00000000e1f3a370 (&rl->lock){++++}, at: ntfs_readpage+0x1909/0x21b0 fs/ntfs/aops.c:452

but task is already holding lock:
0000000010cc17e8 (&ni->mrec_lock){+.+.}, at: map_mft_record+0x3c/0xc70 fs/ntfs/mft.c:168

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->mrec_lock){+.+.}:
       map_mft_record+0x3c/0xc70 fs/ntfs/mft.c:168
       ntfs_truncate+0x202/0x2820 fs/ntfs/inode.c:2395
       ntfs_truncate_vfs fs/ntfs/inode.c:2875 [inline]
       ntfs_setattr+0x1b6/0x620 fs/ntfs/inode.c:2925
       notify_change+0x70b/0xfc0 fs/attr.c:334
       do_truncate+0x134/0x1f0 fs/open.c:63
       handle_truncate fs/namei.c:3009 [inline]
       do_last fs/namei.c:3427 [inline]
       path_openat+0x2308/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_sys_open+0x3b3/0x520 fs/open.c:1085
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&rl->lock){++++}:
       down_read+0x36/0x80 kernel/locking/rwsem.c:24
       ntfs_read_block fs/ntfs/aops.c:265 [inline]
       ntfs_readpage+0x1909/0x21b0 fs/ntfs/aops.c:452
       do_read_cache_page+0x533/0x1170 mm/filemap.c:2828
       read_mapping_page include/linux/pagemap.h:402 [inline]
       ntfs_map_page fs/ntfs/aops.h:89 [inline]
       ntfs_sync_mft_mirror+0x24f/0x1d00 fs/ntfs/mft.c:494
       write_mft_record_nolock+0x13d2/0x16c0 fs/ntfs/mft.c:801
       write_mft_record fs/ntfs/mft.h:109 [inline]
       __ntfs_write_inode+0x609/0xe10 fs/ntfs/inode.c:3064
       write_inode fs/fs-writeback.c:1244 [inline]
       __writeback_single_inode+0x733/0x11d0 fs/fs-writeback.c:1442
       writeback_sb_inodes+0x537/0xef0 fs/fs-writeback.c:1647
       wb_writeback+0x28d/0xcc0 fs/fs-writeback.c:1820
       wb_do_writeback fs/fs-writeback.c:1965 [inline]
       wb_workfn+0x29b/0x1250 fs/fs-writeback.c:2006
       process_one_work+0x864/0x1570 kernel/workqueue.c:2153
       worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
       kthread+0x33f/0x460 kernel/kthread.c:259
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->mrec_lock);
                               lock(&rl->lock);
                               lock(&ni->mrec_lock);
  lock(&rl->lock);

 *** DEADLOCK ***

3 locks held by kworker/u4:0/7:
 #0: 000000003630507b ((wq_completion)"writeback"){+.+.}, at: process_one_work+0x767/0x1570 kernel/workqueue.c:2124
 #1: 000000008354c08c ((work_completion)(&(&wb->dwork)->work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128
 #2: 0000000010cc17e8 (&ni->mrec_lock){+.+.}, at: map_mft_record+0x3c/0xc70 fs/ntfs/mft.c:168

stack backtrace:
CPU: 1 PID: 7 Comm: kworker/u4:0 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Workqueue: writeback wb_workfn (flush-7:0)
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 down_read+0x36/0x80 kernel/locking/rwsem.c:24
 ntfs_read_block fs/ntfs/aops.c:265 [inline]
 ntfs_readpage+0x1909/0x21b0 fs/ntfs/aops.c:452
 do_read_cache_page+0x533/0x1170 mm/filemap.c:2828
 read_mapping_page include/linux/pagemap.h:402 [inline]
 ntfs_map_page fs/ntfs/aops.h:89 [inline]
 ntfs_sync_mft_mirror+0x24f/0x1d00 fs/ntfs/mft.c:494
 write_mft_record_nolock+0x13d2/0x16c0 fs/ntfs/mft.c:801
 write_mft_record fs/ntfs/mft.h:109 [inline]
 __ntfs_write_inode+0x609/0xe10 fs/ntfs/inode.c:3064
 write_inode fs/fs-writeback.c:1244 [inline]
 __writeback_single_inode+0x733/0x11d0 fs/fs-writeback.c:1442
 writeback_sb_inodes+0x537/0xef0 fs/fs-writeback.c:1647
 wb_writeback+0x28d/0xcc0 fs/fs-writeback.c:1820
 wb_do_writeback fs/fs-writeback.c:1965 [inline]
 wb_workfn+0x29b/0x1250 fs/fs-writeback.c:2006
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_fr

Crashes (51):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/01 16:07 linux-4.19.y 3f8a27f9e27b 4c2a66e8 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/25 16:35 linux-4.19.y 3f8a27f9e27b 74a66371 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/10/01 06:12 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report syz C [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/09/26 05:23 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report syz C ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/23 00:21 linux-4.19.y 3f8a27f9e27b 9f1e2cb3 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/22 01:17 linux-4.19.y 3f8a27f9e27b 42a4d508 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/20 02:11 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/19 11:53 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/18 19:29 linux-4.19.y 3f8a27f9e27b d02e9a70 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/18 11:19 linux-4.19.y 3f8a27f9e27b d02e9a70 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/16 11:42 linux-4.19.y 3f8a27f9e27b 38b317a7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/13 07:44 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/09 09:02 linux-4.19.y 3f8a27f9e27b 14a312c8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/02/06 05:09 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/28 14:45 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/27 03:47 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/26 15:49 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/26 15:37 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/16 07:29 linux-4.19.y 3f8a27f9e27b a63719e7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/09 13:20 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/07 07:45 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/06 07:20 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/05 09:58 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/05 07:49 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/04 09:40 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2023/01/04 09:01 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/31 04:31 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/27 02:19 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/25 13:43 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/25 03:00 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/21 15:32 linux-4.19.y 3f8a27f9e27b 4067838e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/16 10:27 linux-4.19.y 3f8a27f9e27b 6f9c033e .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/14 20:42 linux-4.19.y 3f8a27f9e27b b18f0a64 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/13 20:04 linux-4.19.y 3f8a27f9e27b f6511626 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/12 06:15 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/08 08:17 linux-4.19.y 3f8a27f9e27b d88f3abb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/12/07 18:19 linux-4.19.y 3f8a27f9e27b d88f3abb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/27 03:20 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/27 01:53 linux-4.19.y 3f8a27f9e27b f4470a7b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/24 16:50 linux-4.19.y 3f8a27f9e27b ff68ff8f .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/23 14:12 linux-4.19.y 3f8a27f9e27b 52fdf57a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/23 02:36 linux-4.19.y 3f8a27f9e27b 9da37ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/22 07:33 linux-4.19.y 3f8a27f9e27b 1c576c23 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/22 04:39 linux-4.19.y 3f8a27f9e27b 1c576c23 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/09 15:24 linux-4.19.y 3f8a27f9e27b bebca8b7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/04 18:40 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/03 15:10 linux-4.19.y 3f8a27f9e27b 7a2ebf95 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/11/01 22:05 linux-4.19.y 3f8a27f9e27b 08977f5d .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/10/27 07:29 linux-4.19.y 3f8a27f9e27b 86777b7f .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/10/22 01:17 linux-4.19.y 3f8a27f9e27b 63e790dd .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
2022/10/15 16:27 linux-4.19.y 3f8a27f9e27b 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in ntfs_readpage
* Struck through repros no longer work on HEAD.