syzbot


possible deadlock in freezer_write

Status: auto-obsoleted due to no activity on 2023/08/23 09:07
Subsystems: cgroups
[Documentation on labels]
Reported-by: syzbot+6c9dbef55920042a75f7@syzkaller.appspotmail.com
First crash: 441d, last: 409d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [cgroups?] possible deadlock in freezer_write 0 (1) 2023/05/11 17:17

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.2.0-rc1-syzkaller #0 Tainted: G        W         
------------------------------------------------------
syz-executor.1/5140 is trying to acquire lock:
ffffffff8505b470 (cpu_hotplug_lock){++++}-{0:0}, at: cpus_read_lock+0x14/0x1c kernel/cpu.c:310

but task is already holding lock:
ffffffff851ad348 (freezer_mutex){+.+.}-{3:3}, at: freezer_change_state kernel/cgroup/legacy_freezer.c:387 [inline]
ffffffff851ad348 (freezer_mutex){+.+.}-{3:3}, at: freezer_write+0xa0/0x866 kernel/cgroup/legacy_freezer.c:426

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (freezer_mutex){+.+.}-{3:3}:
       lock_acquire.part.0+0x1d0/0x424 kernel/locking/lockdep.c:5668
       lock_acquire+0x54/0x6a kernel/locking/lockdep.c:5641
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x114/0xb42 kernel/locking/mutex.c:747
       mutex_lock_nested+0x14/0x1c kernel/locking/mutex.c:799
       freezer_attach+0x96/0x19a kernel/cgroup/legacy_freezer.c:163
       cgroup_migrate_execute+0x818/0xa3a kernel/cgroup/cgroup.c:2621
       cgroup_migrate kernel/cgroup/cgroup.c:2877 [inline]
       cgroup_attach_task+0x418/0x7ac kernel/cgroup/cgroup.c:2910
       __cgroup1_procs_write.constprop.0+0x250/0x2be kernel/cgroup/cgroup-v1.c:523
       cgroup1_procs_write+0x24/0x32 kernel/cgroup/cgroup-v1.c:536
       cgroup_file_write+0x1b2/0x3b8 kernel/cgroup/cgroup.c:4061
       kernfs_fop_write_iter+0x264/0x32e fs/kernfs/file.c:334
       call_write_iter include/linux/fs.h:2186 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x4a4/0x568 fs/read_write.c:584
       ksys_write+0x10a/0x224 fs/read_write.c:637
       __do_sys_write fs/read_write.c:649 [inline]
       sys_write+0x28/0x36 fs/read_write.c:646
       ret_from_syscall+0x0/0x2

-> #1 (cgroup_threadgroup_rwsem){++++}-{0:0}:
       lock_acquire.part.0+0x1d0/0x424 kernel/locking/lockdep.c:5668
       lock_acquire+0x54/0x6a kernel/locking/lockdep.c:5641
       percpu_down_write+0x4e/0x1d4 kernel/locking/percpu-rwsem.c:227
       cgroup_attach_lock kernel/cgroup/cgroup.c:2437 [inline]
       cgroup_procs_write_start+0x12a/0x46c kernel/cgroup/cgroup.c:2939
       __cgroup_procs_write+0xc2/0x3be kernel/cgroup/cgroup.c:5139
       cgroup_procs_write+0x22/0x48 kernel/cgroup/cgroup.c:5175
       cgroup_file_write+0x1b2/0x3b8 kernel/cgroup/cgroup.c:4061
       kernfs_fop_write_iter+0x264/0x32e fs/kernfs/file.c:334
       call_write_iter include/linux/fs.h:2186 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x4a4/0x568 fs/read_write.c:584
       ksys_write+0x10a/0x224 fs/read_write.c:637
       __do_sys_write fs/read_write.c:649 [inline]
       sys_write+0x28/0x36 fs/read_write.c:646
       ret_from_syscall+0x0/0x2

-> #0 (cpu_hotplug_lock){++++}-{0:0}:
       check_noncircular+0x1de/0x1fe kernel/locking/lockdep.c:2177
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain kernel/locking/lockdep.c:3831 [inline]
       __lock_acquire+0x198a/0x347a kernel/locking/lockdep.c:5055
       lock_acquire.part.0+0x1d0/0x424 kernel/locking/lockdep.c:5668
       lock_acquire+0x54/0x6a kernel/locking/lockdep.c:5641
       percpu_down_read.constprop.0+0x40/0x216 include/linux/percpu-rwsem.h:51
       cpus_read_lock+0x14/0x1c kernel/cpu.c:310
       static_key_slow_inc+0x1e/0x6a kernel/jump_label.c:185
       freezer_apply_state+0x156/0x17c kernel/cgroup/legacy_freezer.c:353
       freezer_change_state kernel/cgroup/legacy_freezer.c:398 [inline]
       freezer_write+0x552/0x866 kernel/cgroup/legacy_freezer.c:426
       cgroup_file_write+0x1b2/0x3b8 kernel/cgroup/cgroup.c:4061
       kernfs_fop_write_iter+0x264/0x32e fs/kernfs/file.c:334
       call_write_iter include/linux/fs.h:2186 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x4a4/0x568 fs/read_write.c:584
       ksys_write+0x10a/0x224 fs/read_write.c:637
       __do_sys_write fs/read_write.c:649 [inline]
       sys_write+0x28/0x36 fs/read_write.c:646
       ret_from_syscall+0x0/0x2

other info that might help us debug this:

Chain exists of:
  cpu_hotplug_lock --> cgroup_threadgroup_rwsem --> freezer_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(freezer_mutex);
                               lock(cgroup_threadgroup_rwsem);
                               lock(freezer_mutex);
  lock(cpu_hotplug_lock);

 *** DEADLOCK ***

5 locks held by syz-executor.1/5140:
 #0: ff6000000f24b768 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xc2/0xc4 fs/file.c:1046
 #1: ff6000000f258460 (sb_writers#9){.+.+}-{0:0}, at: vfs_write+0x1e8/0x568 fs/read_write.c:580
 #2: ff60000011c0fc88 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1fc/0x32e fs/kernfs/file.c:325
 #3: ff6000000f026a00 (kn->active#13){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x20e/0x32e fs/kernfs/file.c:326
 #4: ffffffff851ad348 (freezer_mutex){+.+.}-{3:3}, at: freezer_change_state kernel/cgroup/legacy_freezer.c:387 [inline]
 #4: ffffffff851ad348 (freezer_mutex){+.+.}-{3:3}, at: freezer_write+0xa0/0x866 kernel/cgroup/legacy_freezer.c:426

stack backtrace:
CPU: 1 PID: 5140 Comm: syz-executor.1 Tainted: G        W          6.2.0-rc1-syzkaller #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff8000b9ea>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:121
[<ffffffff83402b96>] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:127
[<ffffffff83442726>] __dump_stack lib/dump_stack.c:88 [inline]
[<ffffffff83442726>] dump_stack_lvl+0xe0/0x14c lib/dump_stack.c:106
[<ffffffff834427ae>] dump_stack+0x1c/0x24 lib/dump_stack.c:113
[<ffffffff8012199a>] print_circular_bug+0x370/0x3fa kernel/locking/lockdep.c:2055
[<ffffffff80121c02>] check_noncircular+0x1de/0x1fe kernel/locking/lockdep.c:2177
[<ffffffff80125e68>] check_prev_add kernel/locking/lockdep.c:3097 [inline]
[<ffffffff80125e68>] check_prevs_add kernel/locking/lockdep.c:3216 [inline]
[<ffffffff80125e68>] validate_chain kernel/locking/lockdep.c:3831 [inline]
[<ffffffff80125e68>] __lock_acquire+0x198a/0x347a kernel/locking/lockdep.c:5055
[<ffffffff80128932>] lock_acquire.part.0+0x1d0/0x424 kernel/locking/lockdep.c:5668
[<ffffffff80128bda>] lock_acquire+0x54/0x6a kernel/locking/lockdep.c:5641
[<ffffffff8005b3f6>] percpu_down_read.constprop.0+0x40/0x216 include/linux/percpu-rwsem.h:51
[<ffffffff8005b5e0>] cpus_read_lock+0x14/0x1c kernel/cpu.c:310
[<ffffffff8037974e>] static_key_slow_inc+0x1e/0x6a kernel/jump_label.c:185
[<ffffffff801f863c>] freezer_apply_state+0x156/0x17c kernel/cgroup/legacy_freezer.c:353
[<ffffffff801f912c>] freezer_change_state kernel/cgroup/legacy_freezer.c:398 [inline]
[<ffffffff801f912c>] freezer_write+0x552/0x866 kernel/cgroup/legacy_freezer.c:426
[<ffffffff801d9e1e>] cgroup_file_write+0x1b2/0x3b8 kernel/cgroup/cgroup.c:4061
[<ffffffff806c57c4>] kernfs_fop_write_iter+0x264/0x32e fs/kernfs/file.c:334
[<ffffffff80548b2c>] call_write_iter include/linux/fs.h:2186 [inline]
[<ffffffff80548b2c>] new_sync_write fs/read_write.c:491 [inline]
[<ffffffff80548b2c>] vfs_write+0x4a4/0x568 fs/read_write.c:584
[<ffffffff80548f54>] ksys_write+0x10a/0x224 fs/read_write.c:637
[<ffffffff80549096>] __do_sys_write fs/read_write.c:649 [inline]
[<ffffffff80549096>] sys_write+0x28/0x36 fs/read_write.c:646
[<ffffffff80005ff6>] ret_from_syscall+0x0/0x2

Crashes (63):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/08 12:11 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 058b3a5a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/08 05:56 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 058b3a5a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/07 11:12 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 7086cdb9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/05 08:27 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/03 08:30 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/03 05:02 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/03 00:12 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/02 14:54 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/02 07:18 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/02 05:47 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 a4ae4f42 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/06/01 07:22 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 babc4389 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/31 22:18 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 e2a77acd .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/31 12:53 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 09898419 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/31 02:43 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 09898419 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/30 18:24 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 8d5c7541 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/30 05:26 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/28 12:30 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/28 10:43 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/28 02:45 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/27 16:44 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/27 09:40 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/27 06:32 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 cf184559 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/26 18:43 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 1497c3f6 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/26 01:51 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 b40ef614 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/25 11:20 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 51e154a0 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/25 05:45 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/24 09:13 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/24 09:12 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/21 15:40 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/21 14:54 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/20 23:13 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/20 19:50 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 4bce1a3e .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/20 14:20 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 96689200 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/20 09:36 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 96689200 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/19 04:51 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 3bb7af1d .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/18 17:32 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 3bb7af1d .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/18 11:59 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 3bb7af1d .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/17 16:01 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 eaac4681 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/17 01:12 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 11c89444 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/16 18:33 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 11c89444 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/15 20:23 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 b8bae4ab .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/15 12:36 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 b8bae4ab .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/14 14:27 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 2b9ba477 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/14 07:11 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 2b9ba477 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/14 06:42 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 2b9ba477 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/13 08:16 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 2b9ba477 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/12 16:57 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 893599a2 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/12 10:51 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 adb9a3cd .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/12 00:13 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 adb9a3cd .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/11 03:32 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 0fbd49f4 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/10 04:38 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 1964022b .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/09 23:28 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 1964022b .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/09 14:55 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 f4168103 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/09 13:01 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 f4168103 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/08 19:46 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 33db58a6 .config console log report info ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/08 14:54 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/07 19:46 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
2023/05/07 17:11 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 950b879b7f02 90c93c40 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 possible deadlock in freezer_write
* Struck through repros no longer work on HEAD.