syzbot


possible deadlock in rfkill_send_events

Status: fixed on 2023/12/21 03:45
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+509238e523e032442b80@syzkaller.appspotmail.com
Fix commit: f2ac54ebf856 net: rfkill: reduce data->mtx scope in rfkill_fop_open
First crash: 291d, last: 276d
Cause bisection: introduced by (bisect log) :
commit 2c3dfba4cf84ac4f306cc6653b37b6dd6859ae9d
Author: Johannes Berg <johannes.berg@intel.com>
Date: Thu Sep 14 13:45:17 2023 +0000

  rfkill: sync before userspace visibility/changes

Crash: possible deadlock in rfkill_send_events (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] rfkill: fix deadlock in rfkill_send_events 5 (5) 2023/10/14 20:01
[syzbot] [net?] [wireless?] possible deadlock in rfkill_send_events 0 (1) 2023/10/09 20:09
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/10/10 00:18 23m twuufnxlz@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f291209eca5e OK log

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.6.0-rc4-syzkaller-00158-gf291209eca5e #0 Not tainted
--------------------------------------------
syz-executor675/5132 is trying to acquire lock:
ffff8880297ee088 (&data->mtx){+.+.}-{3:3}, at: rfkill_send_events+0x226/0x3f0 net/rfkill/core.c:286

but task is already holding lock:
ffff88801bfc0088 (&data->mtx){+.+.}-{3:3}, at: rfkill_fop_open+0x146/0x750 net/rfkill/core.c:1183

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&data->mtx);
  lock(&data->mtx);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by syz-executor675/5132:
 #0: ffffffff8d6f39e8 (misc_mtx){+.+.}-{3:3}, at: misc_open+0x59/0x4c0 drivers/char/misc.c:129
 #1: ffffffff8ea7fa68 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_fop_open+0x13c/0x750 net/rfkill/core.c:1182
 #2: ffff88801bfc0088 (&data->mtx){+.+.}-{3:3}, at: rfkill_fop_open+0x146/0x750 net/rfkill/core.c:1183

stack backtrace:
CPU: 1 PID: 5132 Comm: syz-executor675 Not tainted 6.6.0-rc4-syzkaller-00158-gf291209eca5e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 check_deadlock kernel/locking/lockdep.c:3062 [inline]
 validate_chain kernel/locking/lockdep.c:3855 [inline]
 __lock_acquire+0x2971/0x5de0 kernel/locking/lockdep.c:5136
 lock_acquire kernel/locking/lockdep.c:5753 [inline]
 lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x181/0x1340 kernel/locking/mutex.c:747
 rfkill_send_events+0x226/0x3f0 net/rfkill/core.c:286
 rfkill_event net/rfkill/core.c:301 [inline]
 rfkill_event net/rfkill/core.c:293 [inline]
 rfkill_set_block+0x3d0/0x550 net/rfkill/core.c:369
 rfkill_sync net/rfkill/core.c:379 [inline]
 rfkill_sync+0x10a/0x1c0 net/rfkill/core.c:372
 rfkill_fop_open+0x1d6/0x750 net/rfkill/core.c:1193
 misc_open+0x3da/0x4c0 drivers/char/misc.c:165
 chrdev_open+0x277/0x700 fs/char_dev.c:414
 do_dentry_open+0x88b/0x1730 fs/open.c:929
 do_open fs/namei.c:3639 [inline]
 path_openat+0x19af/0x29c0 fs/namei.c:3796
 do_filp_open+0x1de/0x430 fs/namei.c:3823
 do_sys_openat2+0x176/0x1e0 fs/open.c:1422
 do_sys_open fs/open.c:1437 [inline]
 __do_sys_openat fs/open.c:1453 [inline]
 __se_sys_openat fs/open.c:1448 [inline]
 __x64_sys_openat+0x175/0x210 fs/open.c:1448
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8b31dbc989
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 1e 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8b31f5ccc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f8b31e3c4c8 RCX: 00007f8b31dbc989
RDX: 0000000000000801 RSI: 0000000020000040 RDI: ffffffffffffff9c
RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f8b31f5c7f0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 00007f8b31f5cd00 R14: 00007f8b31f5cd40 R15: 0000000000000000
 </TASK>

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/10/06 05:32 upstream f291209eca5e db17ad9f .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/14 19:58 upstream 70f8c6f8f880 f757a323 .config console log report syz [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in rfkill_send_events
2023/10/17 01:26 upstream 58720809f527 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in rfkill_send_events
2023/10/16 11:23 upstream 58720809f527 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/16 10:28 upstream 58720809f527 6388bc36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/15 09:44 upstream 9a3dad63edbe f757a323 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in rfkill_send_events
2023/10/13 03:33 upstream 401644852d0b fc170927 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in rfkill_send_events
2023/10/10 22:01 upstream 1c8b86a3799f 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/10 20:33 upstream 94f6f0550c62 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/08 11:30 upstream b9ddbb0cde2a 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/08 10:01 upstream b9ddbb0cde2a 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in rfkill_send_events
2023/10/07 16:09 upstream 82714078aee4 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in rfkill_send_events
2023/10/07 15:45 upstream 82714078aee4 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/07 13:51 upstream 82714078aee4 5e837c76 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in rfkill_send_events
2023/10/05 20:06 upstream f291209eca5e db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in rfkill_send_events
2023/10/17 06:13 upstream 213f891525c2 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in rfkill_send_events
2023/10/10 17:52 upstream 94f6f0550c62 83165b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in rfkill_send_events
2023/10/05 21:43 upstream f291209eca5e db17ad9f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in rfkill_send_events
2023/10/19 11:46 upstream dd72f9c7e512 f62755ed .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in rfkill_send_events
2023/10/19 11:09 upstream dd72f9c7e512 f62755ed .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in rfkill_send_events
2023/10/20 02:14 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 78124b0c1d10 42e1d524 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in rfkill_send_events
2023/10/18 03:21 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c295ba49917a 342b9c55 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in rfkill_send_events
* Struck through repros no longer work on HEAD.