syzbot


possible deadlock in proc_pid_attr_write

Status: auto-closed as invalid on 2021/01/16 05:53
Reported-by: syzbot+e5eebb43705b23829b3c@syzkaller.appspotmail.com
First crash: 1478d, last: 1478d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 possible deadlock in proc_pid_attr_write C 203 2019d 2004d 0/1 public: reported C repro on 2019/04/11 00:00
linux-4.14 possible deadlock in proc_pid_attr_write 3 1716d 1805d 0/1 auto-closed as invalid on 2020/05/23 15:46
upstream possible deadlock in proc_pid_attr_write (2) fs 1 1693d 1689d 0/28 auto-closed as invalid on 2020/04/15 17:32
upstream possible deadlock in proc_pid_attr_write fs C 281 2018d 2492d 0/28 closed as dup on 2017/12/12 22:00
linux-4.14 possible deadlock in proc_pid_attr_write (2) 1 1261d 1261d 0/1 auto-closed as invalid on 2021/08/21 09:25
linux-4.19 possible deadlock in proc_pid_attr_write (2) 1 1105d 1105d 0/1 auto-closed as invalid on 2022/01/23 20:06

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.19.146-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/32596 is trying to acquire lock:
00000000145dc40c (&sig->cred_guard_mutex){+.+.}, at: proc_pid_attr_write+0x2ac/0x770 fs/proc/base.c:2600

but task is already holding lock:
000000000735983c (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:62 [inline]
000000000735983c (&pipe->mutex/1){+.+.}, at: pipe_lock+0x63/0x80 fs/pipe.c:70

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&pipe->mutex/1){+.+.}:
       pipe_lock_nested fs/pipe.c:62 [inline]
       pipe_lock+0x63/0x80 fs/pipe.c:70
       iter_file_splice_write+0x183/0xbd0 fs/splice.c:700
       do_splice_from fs/splice.c:852 [inline]
       do_splice fs/splice.c:1154 [inline]
       __do_sys_splice fs/splice.c:1428 [inline]
       __se_sys_splice+0xf31/0x15f0 fs/splice.c:1408
       do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #2 (sb_writers#3){.+.+}:
       sb_start_write include/linux/fs.h:1579 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:360
       ovl_create_object+0x96/0x290 fs/overlayfs/dir.c:600
       lookup_open+0x86c/0x19c0 fs/namei.c:3235
       do_last fs/namei.c:3327 [inline]
       path_openat+0x10d6/0x2e90 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/0x670 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&ovl_i_mutex_dir_key[depth]){++++}:
       inode_lock_shared include/linux/fs.h:758 [inline]
       lookup_slow fs/namei.c:1688 [inline]
       walk_component+0x798/0xda0 fs/namei.c:1811
       lookup_last fs/namei.c:2274 [inline]
       path_lookupat+0x1ff/0x8d0 fs/namei.c:2319
       filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
       create_local_trace_uprobe+0x82/0x490 kernel/trace/trace_uprobe.c:1356
       perf_uprobe_init+0x128/0x200 kernel/trace/trace_event_perf.c:317
       perf_uprobe_event_init+0xf8/0x190 kernel/events/core.c:8587
       perf_try_init_event+0x124/0x2e0 kernel/events/core.c:9860
       perf_init_event kernel/events/core.c:9891 [inline]
       perf_event_alloc.part.0+0x1bad/0x3000 kernel/events/core.c:10165
       perf_event_alloc kernel/events/core.c:10535 [inline]
       __do_sys_perf_event_open kernel/events/core.c:10636 [inline]
       __se_sys_perf_event_open+0x54e/0x27c0 kernel/events/core.c:10525
       do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&sig->cred_guard_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:925 [inline]
       __mutex_lock+0xd7/0x13f0 kernel/locking/mutex.c:1072
       proc_pid_attr_write+0x2ac/0x770 fs/proc/base.c:2600
       __vfs_write+0xf7/0x770 fs/read_write.c:485
       __kernel_write+0x109/0x370 fs/read_write.c:506
       write_pipe_buf+0x153/0x1f0 fs/splice.c:798
       splice_from_pipe_feed fs/splice.c:503 [inline]
       __splice_from_pipe+0x3af/0x820 fs/splice.c:627
       splice_from_pipe fs/splice.c:662 [inline]
       default_file_splice_write+0xd8/0x180 fs/splice.c:810
       do_splice_from fs/splice.c:852 [inline]
       do_splice fs/splice.c:1154 [inline]
       __do_sys_splice fs/splice.c:1428 [inline]
       __se_sys_splice+0xf31/0x15f0 fs/splice.c:1408
       do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  &sig->cred_guard_mutex --> sb_writers#3 --> &pipe->mutex/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&pipe->mutex/1);
                               lock(sb_writers#3);
                               lock(&pipe->mutex/1);
  lock(&sig->cred_guard_mutex);

 *** DEADLOCK ***

2 locks held by syz-executor.1/32596:
 #0: 00000000e8311895 (sb_writers#4){.+.+}, at: file_start_write include/linux/fs.h:2780 [inline]
 #0: 00000000e8311895 (sb_writers#4){.+.+}, at: do_splice fs/splice.c:1153 [inline]
 #0: 00000000e8311895 (sb_writers#4){.+.+}, at: __do_sys_splice fs/splice.c:1428 [inline]
 #0: 00000000e8311895 (sb_writers#4){.+.+}, at: __se_sys_splice+0x1128/0x15f0 fs/splice.c:1408
 #1: 000000000735983c (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:62 [inline]
 #1: 000000000735983c (&pipe->mutex/1){+.+.}, at: pipe_lock+0x63/0x80 fs/pipe.c:70

stack backtrace:
CPU: 0 PID: 32596 Comm: syz-executor.1 Not tainted 4.19.146-syzkaller #0
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+0x22c/0x33e lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1221
 check_prev_add kernel/locking/lockdep.c:1865 [inline]
 check_prevs_add kernel/locking/lockdep.c:1978 [inline]
 validate_chain kernel/locking/lockdep.c:2419 [inline]
 __lock_acquire+0x37ad/0x3ff0 kernel/locking/lockdep.c:3415
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3907
 __mutex_lock_common kernel/locking/mutex.c:925 [inline]
 __mutex_lock+0xd7/0x13f0 kernel/locking/mutex.c:1072
 proc_pid_attr_write+0x2ac/0x770 fs/proc/base.c:2600
 __vfs_write+0xf7/0x770 fs/read_write.c:485
 __kernel_write+0x109/0x370 fs/read_write.c:506
 write_pipe_buf+0x153/0x1f0 fs/splice.c:798
 splice_from_pipe_feed fs/splice.c:503 [inline]
 __splice_from_pipe+0x3af/0x820 fs/splice.c:627
 splice_from_pipe fs/splice.c:662 [inline]
 default_file_splice_write+0xd8/0x180 fs/splice.c:810
 do_splice_from fs/splice.c:852 [inline]
 do_splice fs/splice.c:1154 [inline]
 __do_sys_splice fs/splice.c:1428 [inline]
 __se_sys_splice+0xf31/0x15f0 fs/splice.c:1408
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d5f9
Code: 5d b4 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 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f931edf6c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 0000000000033a00 RCX: 000000000045d5f9
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000118cf98 R08: 0000000008100000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007ffe3bc20a0f R14: 00007f931edf79c0 R15: 000000000118cf4c
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
EXT4-fs warning (device sda1): ext4_group_extend:1806: can't shrink FS - resize aborted
sg_write: process 1555 (syz-executor.5) changed security contexts after opening file descriptor, this is not allowed.
device lo left promiscuous mode
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
chnl_net:chnl_net_open(): err: Unable to register and open device, Err:-19
caif:caif_disconnect_client(): nothing to disconnect
chnl_net:chnl_flowctrl_cb(): NET flowctrl func called flow: CLOSE/DEINIT
chnl_net:chnl_net_open(): state disconnected
A link change request failed with some changes committed already. Interface caif0 may have been left with an inconsistent configuration, please check.
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
chnl_net:chnl_net_open(): err: Unable to register and open device, Err:-19
caif:caif_disconnect_client(): nothing to disconnect
chnl_net:chnl_flowctrl_cb(): NET flowctrl func called flow: CLOSE/DEINIT
chnl_net:chnl_net_open(): state disconnected
A link change request failed with some changes committed already. Interface caif0 may have been left with an inconsistent configuration, please check.
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
chnl_net:chnl_net_open(): err: Unable to register and open device, Err:-19
caif:caif_disconnect_client(): nothing to disconnect
chnl_net:chnl_flowctrl_cb(): NET flowctrl func called flow: CLOSE/DEINIT
chnl_net:chnl_net_open(): state disconnected
A link change request failed with some changes committed already. Interface caif0 may have been left with an inconsistent configuration, please check.
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
chnl_net:chnl_net_open(): err: Unable to register and open device, Err:-19
caif:caif_disconnect_client(): nothing to disconnect
chnl_net:chnl_flowctrl_cb(): NET flowctrl func called flow: CLOSE/DEINIT
chnl_net:chnl_net_open(): state disconnected
A link change request failed with some changes committed already. Interface caif0 may have been left with an inconsistent configuration, please check.
hfsplus: unable to find HFS+ superblock

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/18 05:52 linux-4.19.y 015e94d0e37b 8247808b .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.