syzbot


possible deadlock in split_huge_page_to_list

Status: auto-obsoleted due to no activity on 2022/10/21 15:38
Reported-by: syzbot+c915885f05d8e432e7b4@syzkaller.appspotmail.com
First crash: 360d, last: 350d

Cause bisection: introduced by (bisect log) :
commit 3ebffc96befbaf9de9297b00d67091bb702fad8e
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Sun Jun 28 02:19:08 2020 +0000

  mm: Use multi-index entries in the page cache

Crash: possible deadlock in split_huge_page_to_list (log)
Repro: C syz .config
Patch testing requests:
Created Duration User Patch Repo Result
2022/10/21 14:30 17m retest repro linux-next OK log
2022/10/21 10:30 16m retest repro linux-next OK log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.16.0-rc4-next-20211210-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor832/3602 is trying to acquire lock:
ffffffff8bca9b40 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:253 [inline]
ffffffff8bca9b40 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slab.h:739 [inline]
ffffffff8bca9b40 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:3145 [inline]
ffffffff8bca9b40 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc mm/slub.c:3239 [inline]
ffffffff8bca9b40 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc+0x3e/0x3a0 mm/slub.c:3244

but task is already holding lock:
ffff888011b43cc8 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: i_mmap_lock_read include/linux/fs.h:507 [inline]
ffff888011b43cc8 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: split_huge_page_to_list+0x533/0x5440 mm/huge_memory.c:2657

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&mapping->i_mmap_rwsem){++++}-{3:3}:
       down_write+0x90/0x150 kernel/locking/rwsem.c:1514
       i_mmap_lock_write include/linux/fs.h:492 [inline]
       dma_resv_lockdep+0x362/0x55a drivers/dma-buf/dma-resv.c:713
       do_one_initcall+0x103/0x650 init/main.c:1303
       do_initcall_level init/main.c:1378 [inline]
       do_initcalls init/main.c:1394 [inline]
       do_basic_setup init/main.c:1413 [inline]
       kernel_init_freeable+0x6b1/0x73a init/main.c:1618
       kernel_init+0x1a/0x1d0 init/main.c:1507
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 (fs_reclaim){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3063 [inline]
       check_prevs_add kernel/locking/lockdep.c:3186 [inline]
       validate_chain kernel/locking/lockdep.c:3801 [inline]
       __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5027
       lock_acquire kernel/locking/lockdep.c:5639 [inline]
       lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
       __fs_reclaim_acquire mm/page_alloc.c:4550 [inline]
       fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4564
       might_alloc include/linux/sched/mm.h:253 [inline]
       slab_pre_alloc_hook mm/slab.h:739 [inline]
       slab_alloc_node mm/slub.c:3145 [inline]
       slab_alloc mm/slub.c:3239 [inline]
       kmem_cache_alloc+0x3e/0x3a0 mm/slub.c:3244
       xas_split_alloc+0x142/0x480 lib/xarray.c:1017
       split_huge_page_to_list+0xd35/0x5440 mm/huge_memory.c:2683
       split_huge_page include/linux/huge_mm.h:192 [inline]
       truncate_inode_partial_folio+0xaed/0xe00 mm/truncate.c:275
       shmem_undo_range+0xc43/0x19b0 mm/shmem.c:959
       shmem_truncate_range mm/shmem.c:1037 [inline]
       shmem_fallocate+0xb11/0xe80 mm/shmem.c:2675
       vfs_fallocate+0x48d/0xe10 fs/open.c:308
       ksys_fallocate fs/open.c:331 [inline]
       __do_sys_fallocate fs/open.c:339 [inline]
       __se_sys_fallocate fs/open.c:337 [inline]
       __x64_sys_fallocate+0xcf/0x140 fs/open.c:337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&mapping->i_mmap_rwsem);
                               lock(fs_reclaim);
                               lock(&mapping->i_mmap_rwsem);
  lock(fs_reclaim);

 *** DEADLOCK ***

3 locks held by syz-executor832/3602:
 #0: ffff888073d6a460 (sb_writers#3){.+.+}-{0:0}, at: ksys_fallocate fs/open.c:331 [inline]
 #0: ffff888073d6a460 (sb_writers#3){.+.+}-{0:0}, at: __do_sys_fallocate fs/open.c:339 [inline]
 #0: ffff888073d6a460 (sb_writers#3){.+.+}-{0:0}, at: __se_sys_fallocate fs/open.c:337 [inline]
 #0: ffff888073d6a460 (sb_writers#3){.+.+}-{0:0}, at: __x64_sys_fallocate+0xcf/0x140 fs/open.c:337
 #1: ffff888011b43a70 (&sb->s_type->i_mutex_key#8){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:777 [inline]
 #1: ffff888011b43a70 (&sb->s_type->i_mutex_key#8){+.+.}-{3:3}, at: shmem_fallocate+0x154/0xe80 mm/shmem.c:2651
 #2: ffff888011b43cc8 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: i_mmap_lock_read include/linux/fs.h:507 [inline]
 #2: ffff888011b43cc8 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: split_huge_page_to_list+0x533/0x5440 mm/huge_memory.c:2657

stack backtrace:
CPU: 0 PID: 3602 Comm: syz-executor832 Not tainted 5.16.0-rc4-next-20211210-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2143
 check_prev_add kernel/locking/lockdep.c:3063 [inline]
 check_prevs_add kernel/locking/lockdep.c:3186 [inline]
 validate_chain kernel/locking/lockdep.c:3801 [inline]
 __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5027
 lock_acquire kernel/locking/lockdep.c:5639 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
 __fs_reclaim_acquire mm/page_alloc.c:4550 [inline]
 fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4564
 might_alloc include/linux/sched/mm.h:253 [inline]
 slab_pre_alloc_hook mm/slab.h:739 [inline]
 slab_alloc_node mm/slub.c:3145 [inline]
 slab_alloc mm/slub.c:3239 [inline]
 kmem_cache_alloc+0x3e/0x3a0 mm/slub.c:3244
 xas_split_alloc+0x142/0x480 lib/xarray.c:1017
 split_huge_page_to_list+0xd35/0x5440 mm/huge_memory.c:2683
 split_huge_page include/linux/huge_mm.h:192 [inline]
 truncate_inode_partial_folio+0xaed/0xe00 mm/truncate.c:275
 shmem_undo_range+0xc43/0x19b0 mm/shmem.c:959
 shmem_truncate_range mm/shmem.c:1037 [inline]
 shmem_fallocate+0xb11/0xe80 mm/shmem.c:2675
 vfs_fallocate+0x48d/0xe10 fs/open.c:308
 ksys_fallocate fs/open.c:331 [inline]
 __do_sys_fallocate fs/open.c:339 [inline]
 __se_sys_fallocate fs/open.c:337 [inline]
 __x64_sys_fallocate+0xcf/0x140 fs/open.c:337
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f6a5c9e8819
Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcf59ddff8 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6a5c9e8819
RDX: 0000000000000004 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007f6a5c9a8390 R08: 0000000000000000 R09: 000000000

Crashes (526):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-linux-next-kasan-gce-root 2021/12/11 10:02 linux-next ea922272cbe5 49ca1f59 .config log report syz C possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/11 09:44 linux-next ea922272cbe5 49ca1f59 .config log report syz C possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 10:58 linux-next fbf252e09678 021b36cb .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 10:40 linux-next fbf252e09678 021b36cb .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 09:34 linux-next fbf252e09678 021b36cb .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 08:30 linux-next fbf252e09678 021b36cb .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 07:31 linux-next fbf252e09678 021b36cb .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 06:07 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 04:48 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 03:18 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/20 01:03 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 23:52 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 21:46 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 17:46 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 16:05 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 14:51 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 13:37 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 12:34 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 07:27 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/19 04:17 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 16:58 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 15:19 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 09:43 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 07:57 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 06:18 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 05:10 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 03:43 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 02:25 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/18 00:27 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 22:37 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 21:24 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 18:38 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 18:27 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 12:42 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 11:10 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 07:14 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 04:24 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 03:17 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 02:13 linux-next fbf252e09678 44068e19 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 01:02 linux-next fbf252e09678 8dd6a5e3 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/17 00:00 linux-next 93bf6eee76c0 8dd6a5e3 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/16 15:41 linux-next 93bf6eee76c0 8dd6a5e3 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/16 15:22 linux-next 93bf6eee76c0 8dd6a5e3 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/16 14:21 linux-next 93bf6eee76c0 8dd6a5e3 .config log report info possible deadlock in split_huge_page_to_list
ci-upstream-linux-next-kasan-gce-root 2021/12/11 00:58 linux-next ea922272cbe5 49ca1f59 .config log report info possible deadlock in split_huge_page_to_list
* Struck through repros no longer work on HEAD.