syzbot


possible deadlock in proc_pid_attr_write (2)

Status: auto-closed as invalid on 2022/01/23 20:06
Reported-by: syzbot+9aae4f1b3237001b9ca2@syzkaller.appspotmail.com
First crash: 914d, last: 914d
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 1828d 1813d 0/1 public: reported C repro on 2019/04/11 00:00
linux-4.14 possible deadlock in proc_pid_attr_write 3 1525d 1614d 0/1 auto-closed as invalid on 2020/05/23 15:46
upstream possible deadlock in proc_pid_attr_write (2) fs 1 1502d 1498d 0/26 auto-closed as invalid on 2020/04/15 17:32
linux-4.19 possible deadlock in proc_pid_attr_write 1 1287d 1287d 0/1 auto-closed as invalid on 2021/01/16 05:53
upstream possible deadlock in proc_pid_attr_write fs C 281 1826d 2301d 0/26 closed as dup on 2017/12/12 22:00
linux-4.14 possible deadlock in proc_pid_attr_write (2) 1 1070d 1070d 0/1 auto-closed as invalid on 2021/08/21 09:25

Sample crash report:
kauditd_printk_skb: 1 callbacks suppressed
audit: type=1400 audit(1632600350.248:7327): apparmor="DENIED" operation="change_hat" info="unconfined can not change_hat" error=-1 profile="unconfined" pid=24286 comm="syz-executor.3"
======================================================
WARNING: possible circular locking dependency detected
4.19.207-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/24289 is trying to acquire lock:
00000000339d7287 (&sig->cred_guard_mutex){+.+.}, at: proc_pid_attr_write+0x2ab/0x6f0 fs/proc/base.c:2610

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

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:77 [inline]
       pipe_lock+0x63/0x80 fs/pipe.c:85
       iter_file_splice_write+0x183/0xbb0 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+0xfe7/0x16d0 fs/splice.c:1408
       do_syscall_64+0xf9/0x620 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:602
       lookup_open+0x893/0x1a20 fs/namei.c:3235
       do_last fs/namei.c:3327 [inline]
       path_openat+0x1094/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

-> #1 (&ovl_i_mutex_dir_key[depth]){++++}:
       inode_lock_shared include/linux/fs.h:758 [inline]
       do_last fs/namei.c:3326 [inline]
       path_openat+0x17ec/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_open_execat+0x11d/0x5b0 fs/exec.c:853
       __do_execve_file+0x1a8b/0x2360 fs/exec.c:1770
       do_execveat_common fs/exec.c:1879 [inline]
       do_execve+0x35/0x50 fs/exec.c:1896
       __do_sys_execve fs/exec.c:1977 [inline]
       __se_sys_execve fs/exec.c:1972 [inline]
       __x64_sys_execve+0x7c/0xa0 fs/exec.c:1972
       do_syscall_64+0xf9/0x620 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:937 [inline]
       __mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
       proc_pid_attr_write+0x2ab/0x6f0 fs/proc/base.c:2610
       __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+0x389/0x800 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+0xfe7/0x16d0 fs/splice.c:1408
       do_syscall_64+0xf9/0x620 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.3/24289:
 #0: 000000009aa05d44 (sb_writers#4){.+.+}, at: file_start_write include/linux/fs.h:2779 [inline]
 #0: 000000009aa05d44 (sb_writers#4){.+.+}, at: do_splice fs/splice.c:1153 [inline]
 #0: 000000009aa05d44 (sb_writers#4){.+.+}, at: __do_sys_splice fs/splice.c:1428 [inline]
 #0: 000000009aa05d44 (sb_writers#4){.+.+}, at: __se_sys_splice+0x11de/0x16d0 fs/splice.c:1408
 #1: 000000001a363669 (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:77 [inline]
 #1: 000000001a363669 (&pipe->mutex/1){+.+.}, at: pipe_lock+0x63/0x80 fs/pipe.c:85

stack backtrace:
CPU: 0 PID: 24289 Comm: syz-executor.3 Not tainted 4.19.207-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+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
 __mutex_lock_common kernel/locking/mutex.c:937 [inline]
 __mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
 proc_pid_attr_write+0x2ab/0x6f0 fs/proc/base.c:2610
 __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+0x389/0x800 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+0xfe7/0x16d0 fs/splice.c:1408
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f6e11d47709
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6e0f2be188 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00007f6e11e4bf60 RCX: 00007f6e11d47709
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f6e11da1cb4 R08: 0000000000011300 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff45b7316f R14: 00007f6e0f2be300 R15: 0000000000022000
IPVS: ftp: loaded support on port[0] = 21
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
IPVS: ftp: loaded support on port[0] = 21
batman_adv: batadv0: Interface deactivated: batadv_slave_0
batman_adv: batadv0: Removing interface: batadv_slave_0
batman_adv: batadv0: Interface deactivated: batadv_slave_1
batman_adv: batadv0: Removing interface: batadv_slave_1
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
bridge0: port 1(bridge_slave_0) entered disabled state
device veth1_macvtap left promiscuous mode
device veth0_macvtap left promiscuous mode
device veth1_vlan left promiscuous mode
device veth0_vlan left promiscuous mode
device veth7 left promiscuous mode
bond3 (unregistering): Released all slaves
bond2 (unregistering): Released all slaves
bond1 (unregistering): Releasing active interface vlan1
bond1 (unregistering): Released all slaves
device hsr_slave_1 left promiscuous mode
device hsr_slave_0 left promiscuous mode
team0 (unregistering): Port device team_slave_1 removed
team0 (unregistering): Port device team_slave_0 removed
bond0 (unregistering): Releasing backup interface bond_slave_1
bond0 (unregistering): Releasing backup interface bond_slave_0
bond0 (unregistering): Released all slaves
IPVS: ftp: loaded support on port[0] = 21
chnl_net:caif_netlink_parms(): no params data found
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_1 entered promiscuous mode
bond0: Enslaving bond_slave_0 as an active interface with an up link
bond0: Enslaving bond_slave_1 as an active interface with an up link
IPv6: ADDRCONF(NETDEV_UP): team_slave_0: link is not ready
team0: Port device team_slave_0 added
IPv6: ADDRCONF(NETDEV_UP): team_slave_1: link is not ready
team0: Port device team_slave_1 added
batman_adv: batadv0: Adding interface: batadv_slave_0
batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active
batman_adv: batadv0: Adding interface: batadv_slave_1
batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active
IPv6: ADDRCONF(NETDEV_UP): bridge_slave_0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): bridge_slave_1: link is not ready
device hsr_slave_0 entered promiscuous mode
device hsr_slave_1 entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): hsr_slave_0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): hsr_slave_1: link is not ready
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered forwarding state
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered forwarding state
8021q: adding VLAN 0 to HW filter on device bond0
IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
bridge0: port 1(bridge_slave_0) entered disabled state
bridge0: port 2(bridge_slave_1) entered disabled state
IPv6: ADDRCONF(NETDEV_UP): team0: link is not ready
8021q: adding VLAN 0 to HW filter on device team0
IPv6: ADDRCONF(NETDEV_CHANGE): bridge_slave_0: link becomes ready
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered forwarding state
hsr0: Slave A (hsr_slave_0) is not up; please bring it up to get a fully working HSR network
hsr0: Slave B (hsr_slave_1) is not up; please bring it up to get a fully working HSR network
IPv6: ADDRCONF(NETDEV_UP): hsr0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): bridge_slave_1: link becomes ready
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered forwarding state
IPv6: ADDRCONF(NETDEV_CHANGE): team_slave_0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): team_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): hsr_slave_0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): hsr_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): hsr0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): team0: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): vxcan0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
8021q: adding VLAN 0 to HW filter on device batadv0
IPv6: ADDRCONF(NETDEV_UP): veth0_virt_wifi: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_virt_wifi: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): veth0_vlan: link is not ready
IPv6: ADDRCONF(NETDEV_UP): vlan0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): vlan1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_vlan: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vlan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vlan1: link becomes ready
device veth0_vlan entered promiscuous mode
device veth1_vlan entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): macvlan0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): macvlan1: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth0_macvtap: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): macvlan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): macvlan1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_macvtap: link becomes ready
device veth0_macvtap entered promiscuous mode
device veth1_macvtap entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): veth0_to_batadv: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth1_to_batadv: link is not ready
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_0: link is not ready
batman_adv: batadv0: Interface activated: batadv_slave_0
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_batadv: link becomes ready
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
Bluetooth: hci4: command 0x0409 tx timeout
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
ieee80211 phy33: Selected rate control algorithm 'minstrel_ht'
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
ieee80211 phy34: Selected rate control algorithm 'minstrel_ht'
wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
 loop3: p2 < > p3 p4
IPVS: ftp: loaded support on port[0] = 21
Cannot find del_set index 0 as target
loop3: p3 size 1912633224 extends beyond EOD, truncated
loop3: p4 size 3657465856 extends beyond EOD, truncated
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 8 bytes leftover after parsing attributes in process `syz-executor.0'.
Bluetooth: hci4: command 0x041b tx timeout

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/09/25 20:06 linux-4.19.y 2950c9c5e0df 8cac236e .config console log report info ci2-linux-4-19 possible deadlock in proc_pid_attr_write
* Struck through repros no longer work on HEAD.