syzbot


possible deadlock in force_sig_info_to_task

Status: upstream: reported on 2024/05/17 20:42
Reported-by: syzbot+7d53f856fccbed9cb3ec@syzkaller.appspotmail.com
First crash: 38d, last: 13d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in force_sig_info_to_task bpf trace C error 6 53d 60d 26/27 fixed on 2024/05/23 00:16

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.92-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/3765 is trying to acquire lock:
ffff88807a33e5d8 (&sighand->siglock){....}-{2:2}, at: force_sig_info_to_task+0x69/0x470 kernel/signal.c:1333

but task is already holding lock:
ffff8880b993aa18 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:537

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&rq->__lock){-.-.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:378
       raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:537
       raw_spin_rq_lock kernel/sched/sched.h:1354 [inline]
       rq_lock kernel/sched/sched.h:1644 [inline]
       task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11869
       sched_cgroup_fork+0x374/0x400 kernel/sched/core.c:4686
       copy_process+0x2442/0x4060 kernel/fork.c:2384
       kernel_clone+0x222/0x920 kernel/fork.c:2682
       user_mode_thread+0x12e/0x190 kernel/fork.c:2758
       rest_init+0x23/0x300 init/main.c:699
       start_kernel+0x0/0x53f init/main.c:894
       start_kernel+0x496/0x53f init/main.c:1141
       secondary_startup_64_no_verify+0xcf/0xdb

-> #1 (&p->pi_lock){-.-.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       try_to_wake_up+0xad/0x12e0 kernel/sched/core.c:4112
       signal_wake_up_state kernel/signal.c:780 [inline]
       signal_wake_up include/linux/sched/signal.h:457 [inline]
       complete_signal+0x796/0xbd0 kernel/signal.c:1074
       __send_signal_locked+0xb1a/0xdc0 kernel/signal.c:1194
       do_notify_parent+0xe2b/0x1100 kernel/signal.c:2120
       exit_notify kernel/exit.c:744 [inline]
       do_exit+0x172e/0x26a0 kernel/exit.c:889
       do_group_exit+0x202/0x2b0 kernel/exit.c:1019
       __do_sys_exit_group kernel/exit.c:1030 [inline]
       __se_sys_exit_group kernel/exit.c:1028 [inline]
       __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1028
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&sighand->siglock){....}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       force_sig_info_to_task+0x69/0x470 kernel/signal.c:1333
       force_sig_fault_to_task kernel/signal.c:1724 [inline]
       force_sig_fault+0x127/0x1d0 kernel/signal.c:1730
       __bad_area_nosemaphore+0x126/0x730 arch/x86/mm/fault.c:828
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x30d/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       copy_user_short_string+0x3b/0x40 arch/x86/lib/copy_user_64.S:253
       copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
       raw_copy_from_user arch/x86/include/asm/uaccess_64.h:52 [inline]
       __copy_from_user_inatomic include/linux/uaccess.h:65 [inline]
       copy_from_user_nofault+0xb1/0x140 mm/maccess.c:125
       bpf_probe_read_user_common kernel/trace/bpf_trace.c:167 [inline]
       ____bpf_probe_read_compat kernel/trace/bpf_trace.c:291 [inline]
       bpf_probe_read_compat+0xe4/0x180 kernel/trace/bpf_trace.c:287
       bpf_prog_1878750df62aa1fb+0x40/0x42
       bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
       bpf_trace_run4+0x253/0x470 kernel/trace/bpf_trace.c:2314
       __traceiter_sched_switch+0x91/0xc0 include/trace/events/sched.h:222
       trace_sched_switch include/trace/events/sched.h:222 [inline]
       __schedule+0x2116/0x4550 kernel/sched/core.c:6555
       preempt_schedule_irq+0xf7/0x1c0 kernel/sched/core.c:6870
       irqentry_exit+0x53/0x80 kernel/entry/common.c:439
       asm_sysvec_reschedule_ipi+0x16/0x20 arch/x86/include/asm/idtentry.h:658
       lock_acquire+0x26f/0x5a0 kernel/locking/lockdep.c:5666
       rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
       rcu_read_lock include/linux/rcupdate.h:791 [inline]
       mt_find+0x2bb/0xc60 lib/maple_tree.c:6532
       find_vma+0x136/0x1b0 mm/mmap.c:1887
       lock_mm_and_find_vma+0x71/0x2e0 mm/memory.c:5369
       do_user_addr_fault arch/x86/mm/fault.c:1343 [inline]
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       __put_user_nocheck_8+0x3/0x21
       __do_sys_gettimeofday kernel/time/time.c:147 [inline]
       __se_sys_gettimeofday+0xd5/0x230 kernel/time/time.c:140
       emulate_vsyscall+0xc5c/0x1240 arch/x86/entry/vsyscall/vsyscall_64.c:247
       do_user_addr_fault arch/x86/mm/fault.c:1337 [inline]
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x154/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       _end+0x6d3da000/0x0

other info that might help us debug this:

Chain exists of:
  &sighand->siglock --> &p->pi_lock --> &rq->__lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&rq->__lock);
                               lock(&p->pi_lock);
                               lock(&rq->__lock);
  lock(&sighand->siglock);

 *** DEADLOCK ***

4 locks held by syz-executor.2/3765:
 #0: ffff88807e44bd58 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
 #0: ffff88807e44bd58 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5304 [inline]
 #0: ffff88807e44bd58 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x2e/0x2e0 mm/memory.c:5366
 #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #1: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: mt_find+0x29a/0xc60 lib/maple_tree.c:6532
 #2: ffff8880b993aa18 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:537
 #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2272 [inline]
 #3: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run4+0x16a/0x470 kernel/trace/bpf_trace.c:2314

stack backtrace:
CPU: 1 PID: 3765 Comm: syz-executor.2 Not tainted 6.1.92-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 force_sig_info_to_task+0x69/0x470 kernel/signal.c:1333
 force_sig_fault_to_task kernel/signal.c:1724 [inline]
 force_sig_fault+0x127/0x1d0 kernel/signal.c:1730
 __bad_area_nosemaphore+0x126/0x730 arch/x86/mm/fault.c:828
 handle_page_fault arch/x86/mm/fault.c:1462 [inline]
 exc_page_fault+0x30d/0x660 arch/x86/mm/fault.c:1518
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0010:copy_user_short_string+0x3b/0x40 arch/x86/lib/copy_user_64.S:254
Code: 8d 76 08 48 8d 7f 08 ff c9 75 ee 21 d2 74 10 89 d1 8a 06 88 07 48 ff c6 48 ff c7 ff c9 75 f2 31 c0 0f 01 ca c3 8d 14 ca eb 02 <89> ca eb a1 90 0f 01 cb 83 fa 08 0f 82 95 00 00 00 89 f9 83 e1 07
RSP: 0000:ffffc900053273a8 EFLAGS: 00050002
RAX: 000000000000000e RBX: dffffc0000000000 RCX: 0000000000000002
RDX: 0000000000000002 RSI: 0000000000000900 RDI: ffffc90005327428
RBP: ffff888020c11770 R08: 0000000000000005 R09: ffffffff81eeb403
R10: 0000000000000003 R11: ffff888020c10000 R12: 1ffff110041822ee
R13: 0000000000000002 R14: ffffc90005327428 R15: 0000000000000900
 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
 raw_copy_from_user arch/x86/include/asm/uaccess_64.h:52 [inline]
 __copy_from_user_inatomic include/linux/uaccess.h:65 [inline]
 copy_from_user_nofault+0xb1/0x140 mm/maccess.c:125
 bpf_probe_read_user_common kernel/trace/bpf_trace.c:167 [inline]
 ____bpf_probe_read_compat kernel/trace/bpf_trace.c:291 [inline]
 bpf_probe_read_compat+0xe4/0x180 kernel/trace/bpf_trace.c:287
 bpf_prog_1878750df62aa1fb+0x40/0x42
 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
 __bpf_prog_run include/linux/filter.h:603 [inline]
 bpf_prog_run include/linux/filter.h:610 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
 bpf_trace_run4+0x253/0x470 kernel/trace/bpf_trace.c:2314
 __traceiter_sched_switch+0x91/0xc0 include/trace/events/sched.h:222
 trace_sched_switch include/trace/events/sched.h:222 [inline]
 __schedule+0x2116/0x4550 kernel/sched/core.c:6555
 preempt_schedule_irq+0xf7/0x1c0 kernel/sched/core.c:6870
 irqentry_exit+0x53/0x80 kernel/entry/common.c:439
 asm_sysvec_reschedule_ipi+0x16/0x20 arch/x86/include/asm/idtentry.h:658
RIP: 0010:lock_acquire+0x26f/0x5a0 kernel/locking/lockdep.c:5666
Code: 2b 00 74 08 4c 89 f7 e8 7f a9 77 00 f6 44 24 61 02 0f 85 84 01 00 00 41 f7 c7 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 44 25 00 00 00 00 00 43 c7 44 25 09 00 00 00 00 43 c7 44 25
RSP: 0000:ffffc900053278a0 EFLAGS: 00000206
RAX: 0000000000000001 RBX: 1ffff92000a64f20 RCX: 1ffff92000a64ec0
RDX: dffffc0000000000 RSI: ffffffff8aec1340 RDI: ffffffff8b3d45e0
RBP: ffffc900053279e8 R08: dffffc0000000000 R09: fffffbfff2093845
R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffff92000a64f1c
R13: dffffc0000000000 R14: ffffc90005327900 R15: 0000000000000246
 rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 rcu_read_lock include/linux/rcupdate.h:791 [inline]
 mt_find+0x2bb/0xc60 lib/maple_tree.c:6532
 find_vma+0x136/0x1b0 mm/mmap.c:1887
 lock_mm_and_find_vma+0x71/0x2e0 mm/memory.c:5369
 do_user_addr_fault arch/x86/mm/fault.c:1343 [inline]
 handle_page_fault arch/x86/mm/fault.c:1462 [inline]
 exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0010:__put_user_nocheck_8+0x3/0x21
Code: 00 00 48 39 d9 73 34 0f 01 cb 89 01 31 c9 0f 01 ca c3 66 0f 1f 44 00 00 48 bb f9 ef ff ff ff 7f 00 00 48 39 d9 73 14 0f 01 cb <48> 89 01 31 c9 0f 01 ca c3 0f 1f 44 00 00 0f 01 ca b9 f2 ff ff ff
RSP: 0000:ffffc90005327d98 EFLAGS: 00050283
RAX: 000000006668116d RBX: 00007fffffffeff9 RCX: 0000000000000019
RDX: 0000000000000000 RSI: ffffffff8aec1340 RDI: ffffffff8b3d45e0
RBP: ffffc90005327e58 R08: dffffc0000000000 R09: fffffbfff1ce712e
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90005327de0
R13: dffffc0000000000 R14: 1ffff92000a64fb8 R15: 0000000000000019
 __do_sys_gettimeofday kernel/time/time.c:147 [inline]
 __se_sys_gettimeofday+0xd5/0x230 kernel/time/time.c:140
 emulate_vsyscall+0xc5c/0x1240 arch/x86/entry/vsyscall/vsyscall_64.c:247
 do_user_addr_fault arch/x86/mm/fault.c:1337 [inline]
 handle_page_fault arch/x86/mm/fault.c:1462 [inline]
 exc_page_fault+0x154/0x660 arch/x86/mm/fault.c:1518
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:_end+0x6d3da000/0x0
Code: Unable to access opcode bytes at 0xffffffffff5fffd6.
RSP: 002b:00007f730a9e3b38 EFLAGS: 00010246
RAX: ffffffffffffffda RBX: 00007f7309db4120 RCX: 00007f7309c7cf69
RDX: 00007f730a9e3b40 RSI: 00007f730a9e3c70 RDI: 0000000000000019
RBP: 00007f7309cda6fe R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000007 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007f7309db4120 R15: 00007ffc778c5ca8
 </TASK>
----------------
Code disassembly (best guess):
   0:	8d 76 08             	lea    0x8(%rsi),%esi
   3:	48 8d 7f 08          	lea    0x8(%rdi),%rdi
   7:	ff c9                	dec    %ecx
   9:	75 ee                	jne    0xfffffff9
   b:	21 d2                	and    %edx,%edx
   d:	74 10                	je     0x1f
   f:	89 d1                	mov    %edx,%ecx
  11:	8a 06                	mov    (%rsi),%al
  13:	88 07                	mov    %al,(%rdi)
  15:	48 ff c6             	inc    %rsi
  18:	48 ff c7             	inc    %rdi
  1b:	ff c9                	dec    %ecx
  1d:	75 f2                	jne    0x11
  1f:	31 c0                	xor    %eax,%eax
  21:	0f 01 ca             	clac
  24:	c3                   	ret
  25:	8d 14 ca             	lea    (%rdx,%rcx,8),%edx
  28:	eb 02                	jmp    0x2c
* 2a:	89 ca                	mov    %ecx,%edx <-- trapping instruction
  2c:	eb a1                	jmp    0xffffffcf
  2e:	90                   	nop
  2f:	0f 01 cb             	stac
  32:	83 fa 08             	cmp    $0x8,%edx
  35:	0f 82 95 00 00 00    	jb     0xd0
  3b:	89 f9                	mov    %edi,%ecx
  3d:	83 e1 07             	and    $0x7,%ecx

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/11 08:57 linux-6.1.y 88690811da69 b7d9eb04 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/06/11 08:56 linux-6.1.y 88690811da69 b7d9eb04 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/06/11 08:56 linux-6.1.y 88690811da69 b7d9eb04 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/06/03 12:42 linux-6.1.y 88690811da69 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/05/29 22:28 linux-6.1.y 88690811da69 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/05/24 20:40 linux-6.1.y 4078fa637fcd a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
2024/05/17 20:41 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in force_sig_info_to_task
* Struck through repros no longer work on HEAD.