syzbot


possible deadlock in lookup_slow

Status: auto-closed as invalid on 2019/10/25 08:42
Reported-by: syzbot+582e9685d59dd0a41747@syzkaller.appspotmail.com
First crash: 1414d, last: 1173d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in lookup_slow 22 787d 1213d 0/1 auto-closed as invalid on 2020/10/12 22:59
linux-4.14 possible deadlock in lookup_slow C 1951 13h46m 1082d 0/1 upstream: reported C repro on 2019/08/24 01:53
upstream possible deadlock in lookup_slow (2) 7 941d 985d 0/23 auto-closed as invalid on 2020/05/11 09:17

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.2.0-rc1+ #1 Not tainted
------------------------------------------------------
syz-executor.4/1839 is trying to acquire lock:
00000000eedc00d5 (&ovl_i_mutex_dir_key[depth]){++++}, at: inode_lock_shared include/linux/fs.h:788 [inline]
00000000eedc00d5 (&ovl_i_mutex_dir_key[depth]){++++}, at: lookup_slow+0x4a/0x80 fs/namei.c:1685

but task is already holding lock:
000000005d3e9497 (&sig->cred_guard_mutex){+.+.}, at: __do_sys_perf_event_open+0x6d2/0x24d0 kernel/events/core.c:10830

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&sig->cred_guard_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:926 [inline]
       __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1073
       mutex_lock_killable_nested+0x16/0x20 kernel/locking/mutex.c:1103
       lock_trace+0x4a/0xe0 fs/proc/base.c:388
       proc_pid_stack+0xbf/0x200 fs/proc/base.c:432
       proc_single_show+0xf0/0x170 fs/proc/base.c:739
       seq_read+0x4ca/0x1110 fs/seq_file.c:229
       do_loop_readv_writev fs/read_write.c:714 [inline]
       do_loop_readv_writev fs/read_write.c:701 [inline]
       do_iter_read+0x4a4/0x660 fs/read_write.c:935
       vfs_readv+0xf0/0x160 fs/read_write.c:997
       kernel_readv fs/splice.c:359 [inline]
       default_file_splice_read+0x475/0x890 fs/splice.c:414
       do_splice_to+0x127/0x180 fs/splice.c:877
       splice_direct_to_actor+0x2d2/0x970 fs/splice.c:954
       do_splice_direct+0x1da/0x2a0 fs/splice.c:1063
       do_sendfile+0x597/0xd00 fs/read_write.c:1464
       __do_sys_sendfile64 fs/read_write.c:1525 [inline]
       __se_sys_sendfile64 fs/read_write.c:1511 [inline]
       __x64_sys_sendfile64+0x1dd/0x220 fs/read_write.c:1511
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #2 (&p->lock){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:926 [inline]
       __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1073
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088
       seq_read+0x71/0x1110 fs/seq_file.c:161
       do_loop_readv_writev fs/read_write.c:714 [inline]
       do_loop_readv_writev fs/read_write.c:701 [inline]
       do_iter_read+0x4a4/0x660 fs/read_write.c:935
       vfs_readv+0xf0/0x160 fs/read_write.c:997
       kernel_readv fs/splice.c:359 [inline]
       default_file_splice_read+0x475/0x890 fs/splice.c:414
       do_splice_to+0x127/0x180 fs/splice.c:877
       splice_direct_to_actor+0x2d2/0x970 fs/splice.c:954
       do_splice_direct+0x1da/0x2a0 fs/splice.c:1063
       do_sendfile+0x597/0xd00 fs/read_write.c:1464
       __do_sys_sendfile64 fs/read_write.c:1525 [inline]
       __se_sys_sendfile64 fs/read_write.c:1511 [inline]
       __x64_sys_sendfile64+0x1dd/0x220 fs/read_write.c:1511
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (sb_writers#4){.+.+}:
       percpu_down_read include/linux/percpu-rwsem.h:36 [inline]
       __sb_start_write+0x20b/0x360 fs/super.c:1608
       sb_start_write include/linux/fs.h:1627 [inline]
       mnt_want_write+0x3f/0xc0 fs/namespace.c:359
       ovl_want_write+0x76/0xa0 fs/overlayfs/util.c:24
       ovl_create_object+0xb3/0x2c0 fs/overlayfs/dir.c:599
       ovl_create+0x28/0x30 fs/overlayfs/dir.c:630
       lookup_open+0x12d5/0x1a90 fs/namei.c:3232
       do_last fs/namei.c:3322 [inline]
       path_openat+0x14ac/0x46d0 fs/namei.c:3533
       do_filp_open+0x1a1/0x280 fs/namei.c:3563
       do_sys_open+0x3fe/0x5d0 fs/open.c:1070
       ksys_open include/linux/syscalls.h:1382 [inline]
       __do_sys_creat fs/open.c:1128 [inline]
       __se_sys_creat fs/open.c:1126 [inline]
       __x64_sys_creat+0x61/0x80 fs/open.c:1126
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&ovl_i_mutex_dir_key[depth]){++++}:
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303
       down_read+0x3f/0x1e0 kernel/locking/rwsem.c:24
       inode_lock_shared include/linux/fs.h:788 [inline]
       lookup_slow+0x4a/0x80 fs/namei.c:1685
       walk_component+0x747/0x2000 fs/namei.c:1808
       lookup_last fs/namei.c:2271 [inline]
       path_lookupat.isra.0+0x1f5/0x8d0 fs/namei.c:2316
       filename_lookup+0x1b0/0x410 fs/namei.c:2346
       kern_path+0x36/0x40 fs/namei.c:2432
       create_local_trace_uprobe+0x87/0x4e0 kernel/trace/trace_uprobe.c:1389
       perf_uprobe_init+0x131/0x210 kernel/trace/trace_event_perf.c:314
       perf_uprobe_event_init+0x106/0x1a0 kernel/events/core.c:8787
       perf_try_init_event+0x131/0x3e0 kernel/events/core.c:10061
       perf_init_event kernel/events/core.c:10101 [inline]
       perf_event_alloc.part.0+0x1f5f/0x3220 kernel/events/core.c:10379
       perf_event_alloc kernel/events/core.c:10749 [inline]
       __do_sys_perf_event_open+0x830/0x24d0 kernel/events/core.c:10850
       __se_sys_perf_event_open kernel/events/core.c:10739 [inline]
       __x64_sys_perf_event_open+0xbe/0x150 kernel/events/core.c:10739
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  &ovl_i_mutex_dir_key[depth] --> &p->lock --> &sig->cred_guard_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sig->cred_guard_mutex);
                               lock(&p->lock);
                               lock(&sig->cred_guard_mutex);
  lock(&ovl_i_mutex_dir_key[depth]);

 *** DEADLOCK ***

2 locks held by syz-executor.4/1839:
 #0: 000000005d3e9497 (&sig->cred_guard_mutex){+.+.}, at: __do_sys_perf_event_open+0x6d2/0x24d0 kernel/events/core.c:10830
 #1: 00000000bfe573d3 (&pmus_srcu){....}, at: perf_event_alloc.part.0+0xd8a/0x3220 kernel/events/core.c:10375

stack backtrace:
CPU: 0 PID: 1839 Comm: syz-executor.4 Not tainted 5.2.0-rc1+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_circular_bug.cold+0x1cc/0x28f kernel/locking/lockdep.c:1565
 check_prev_add kernel/locking/lockdep.c:2310 [inline]
 check_prevs_add kernel/locking/lockdep.c:2418 [inline]
 validate_chain kernel/locking/lockdep.c:2800 [inline]
 __lock_acquire+0x3755/0x5490 kernel/locking/lockdep.c:3793
 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303
 down_read+0x3f/0x1e0 kernel/locking/rwsem.c:24
 inode_lock_shared include/linux/fs.h:788 [inline]
 lookup_slow+0x4a/0x80 fs/namei.c:1685
 walk_component+0x747/0x2000 fs/namei.c:1808
 lookup_last fs/namei.c:2271 [inline]
 path_lookupat.isra.0+0x1f5/0x8d0 fs/namei.c:2316
 filename_lookup+0x1b0/0x410 fs/namei.c:2346
 kern_path+0x36/0x40 fs/namei.c:2432
 create_local_trace_uprobe+0x87/0x4e0 kernel/trace/trace_uprobe.c:1389
 perf_uprobe_init+0x131/0x210 kernel/trace/trace_event_perf.c:314
 perf_uprobe_event_init+0x106/0x1a0 kernel/events/core.c:8787
 perf_try_init_event+0x131/0x3e0 kernel/events/core.c:10061
 perf_init_event kernel/events/core.c:10101 [inline]
 perf_event_alloc.part.0+0x1f5f/0x3220 kernel/events/core.c:10379
 perf_event_alloc kernel/events/core.c:10749 [inline]
 __do_sys_perf_event_open+0x830/0x24d0 kernel/events/core.c:10850
 __se_sys_perf_event_open kernel/events/core.c:10739 [inline]
 __x64_sys_perf_event_open+0xbe/0x150 kernel/events/core.c:10739
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459279
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffad7acec78 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000459279
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000180
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000246 R12: 00007ffad7acf6d4
R13: 00000000004c5c98 R14: 00000000004da338 R15: 00000000ffffffff

Crashes (139):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2019/05/25 19:15 upstream b2ad81363f12 85c57315 .config log report
ci-upstream-kasan-gce-selinux-root 2019/05/24 19:54 upstream c50bbf615f2f 0dadcd9d .config log report
ci-upstream-kasan-gce-root 2019/04/23 14:25 upstream 085b7755808a 53199d6e .config log report
ci-upstream-kasan-gce-smack-root 2019/04/19 20:07 upstream 6d906f998179 b0e8efcb .config log report
ci-upstream-kasan-gce-root 2019/03/26 07:42 upstream a3ac7917b730 55684ce1 .config log report
ci-upstream-kasan-gce-root 2019/03/25 21:33 upstream 8c2ffd917477 2c86e0a5 .config log report
ci-upstream-kasan-gce-root 2019/03/22 20:01 upstream fd1f297b794c 3361bde5 .config log report
ci-upstream-kasan-gce-root 2019/03/21 23:48 upstream 0939221e6468 dce6e62f .config log report
ci-upstream-kasan-gce-smack-root 2019/03/14 13:12 upstream fa3d493f7a57 d09a902e .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/07 10:19 upstream f90d64483ebd 8c085c5e .config log report
ci-upstream-kasan-gce-root 2019/02/27 21:57 upstream 7d762d69145a 083cfd0e .config log report
ci-upstream-kasan-gce-smack-root 2019/02/17 00:56 upstream 5ded5871030e f42dee6d .config log report
ci-upstream-kasan-gce-root 2019/02/13 21:25 upstream 1f947a7a011f 0a49c954 .config log report
ci-upstream-kasan-gce-root 2019/02/05 20:16 upstream 8834f5600cf3 d672172c .config log report
ci-upstream-kasan-gce-root 2019/02/01 21:55 upstream 5eeb63359b1e 564f9a4f .config log report
ci-upstream-kasan-gce-root 2019/02/01 10:14 upstream 5b4746a03199 0c07abcf .config log report
ci-upstream-kasan-gce-root 2019/01/29 14:43 upstream 4aa9fc2a435a aa432daf .config log report
ci-upstream-kasan-gce-root 2019/01/29 13:33 upstream 4aa9fc2a435a aa432daf .config log report
ci-upstream-kasan-gce-root 2019/01/27 20:53 upstream 983542434e6b c73f090a .config log report
ci-upstream-kasan-gce-selinux-root 2019/01/27 18:17 upstream ba6069759381 c73f090a .config log report
ci-upstream-kasan-gce-selinux-root 2019/01/26 00:31 upstream ba6069759381 ebf7a37c .config log report
ci-upstream-kasan-gce-smack-root 2019/01/22 22:47 upstream 787a3b432276 b1ff06b2 .config log report
ci-upstream-kasan-gce-smack-root 2019/01/22 20:23 upstream 48b161983ae5 985f75cc .config log report
ci-upstream-kasan-gce-smack-root 2019/01/22 01:00 upstream 52e60b754438 badbbeee .config log report
ci-upstream-kasan-gce-root 2019/01/21 06:59 upstream 49a57857aeea fd37a550 .config log report
ci-upstream-kasan-gce-root 2019/01/20 13:40 upstream b0efca46b570 353f32ea .config log report
ci-upstream-kasan-gce-smack-root 2019/01/18 01:22 upstream 7fbfee7c80de 769e75ed .config log report
ci-upstream-kasan-gce-smack-root 2019/01/17 08:23 upstream 47bfa6d9dc8c c2faf9b2 .config log report
ci-upstream-kasan-gce-root 2019/01/01 12:30 upstream e1ef035d272e 3d85f48c .config log report
ci-upstream-kasan-gce-root 2018/12/30 01:59 upstream 195303136f19 35e3f847 .config log report
ci-upstream-kasan-gce-root 2018/12/29 13:04 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/29 11:51 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce-root 2018/12/28 16:20 upstream 00c569b567c7 fc6ae81a .config log report
ci-upstream-kasan-gce-root 2018/12/28 12:39 upstream 00c569b567c7 fc6ae81a .config log report
ci-upstream-kasan-gce-root 2018/12/25 23:33 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/25 18:56 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-smack-root 2018/12/24 07:28 upstream 8fe28cb58bcb be79df56 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/23 20:52 upstream 3c730b1041ae e3bd7ab8 .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/23 17:28 upstream 9105b8aa50c1 e3bd7ab8 .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/22 13:58 upstream 23203e3f34c9 e3bd7ab8 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/22 10:57 upstream 5092adb2272e 603b5124 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/21 22:03 upstream 5092adb2272e 588075e6 .config log report
ci-upstream-kasan-gce-selinux-root 2018/09/26 06:13 upstream 846e8dd47c26 b7e11289 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/04/22 23:41 linux-next 3f018f4a019a 53199d6e .config log report
ci-upstream-linux-next-kasan-gce-root 2019/04/22 05:52 linux-next 3f018f4a019a b0e8efcb .config log report
ci-upstream-linux-next-kasan-gce-root 2019/04/21 10:03 linux-next 3f018f4a019a b0e8efcb .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/17 10:25 linux-next cf08baa29613 bab43553 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/12 03:13 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/09 22:09 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/02/03 03:30 linux-next dc4c89997735 c198d5dd .config log report
ci-upstream-linux-next-kasan-gce-root 2019/01/25 21:34 linux-next 494367cb57c9 ebf7a37c .config log report
ci-upstream-linux-next-kasan-gce-root 2018/12/22 07:56 linux-next 6648e120dd1a 603b5124 .config log report