syzbot


BUG: sleeping function called from invalid context in gsm_send

Status: fixed on 2024/04/26 10:41
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+b687fe9bf10db0839715@syzkaller.appspotmail.com
Fix commit: acdab4cb4ba7 Revert "tty: n_gsm: avoid call of sleeping functions from atomic context"
First crash: 609d, last: 91d
Cause bisection: failed (error log, bisect log)
  
Discussions (4)
Title Replies (including bot) Last reply
Re: BUG: sleeping function called from invalid context in gsm_send 1 (1) 2024/04/20 11:27
[syzbot] Monthly serial report (Mar 2024) 0 (1) 2024/03/05 11:10
[syzbot] Monthly serial report (Aug 2023) 0 (1) 2023/08/27 14:06
[syzbot] BUG: sleeping function called from invalid context in gsm_send 0 (1) 2022/09/28 17:48
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/04/14 05:34 21m retest repro linux-next report log
2024/04/14 05:34 18m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2024/03/18 10:36 23m retest repro upstream error OK
2024/01/30 01:48 35m retest repro linux-next report log
2024/01/29 05:27 25m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2023/12/20 18:05 14m retest repro upstream report log
2023/11/20 15:00 20m retest repro linux-next report log
2023/11/20 00:23 51m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2023/09/06 01:59 14m retest repro linux-next report log
2023/09/06 01:59 18m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
Fix bisection attempts (12)
Created Duration User Patch Repo Result
2024/02/24 04:33 2h06m bisect fix upstream job log (0) log
2024/01/06 04:09 3h26m bisect fix upstream job log (0) log
2023/12/06 11:20 2h09m bisect fix upstream job log (0) log
2023/11/05 20:39 1h52m bisect fix upstream job log (0) log
2023/10/06 03:45 2h18m bisect fix upstream job log (0) log
2023/08/19 12:48 2h02m bisect fix upstream job log (0) log
2023/07/13 09:41 1h39m bisect fix upstream job log (0) log
2023/06/07 02:53 31m bisect fix upstream job log (0) log
2023/05/08 02:08 31m bisect fix upstream job log (0) log
2023/04/08 00:55 21m bisect fix upstream job log (0) log
2023/03/08 21:35 21m bisect fix upstream job log (0) log
2023/02/06 20:41 21m bisect fix upstream job log (0) log

Sample crash report:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3606, name: syz-executor269
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
3 locks held by syz-executor269/3606:
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: __tty_ldisc_lock drivers/tty/tty_ldisc.c:290 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_lock_pair_timeout drivers/tty/tty_ldisc.c:353 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_lock_pair drivers/tty/tty_ldisc.c:367 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_release+0x79/0x2a0 drivers/tty/tty_ldisc.c:775
 #1: ffff888017ac60b0 (&gsm->mutex){+.+.}-{3:3}, at: gsm_cleanup_mux+0xf5/0x800 drivers/tty/n_gsm.c:2446
 #2: ffffc900001f0d70 ((&dlci->t1)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:31 [inline]
 #2: ffffc900001f0d70 ((&dlci->t1)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1464
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 3606 Comm: syz-executor269 Not tainted 6.0.0-rc6-syzkaller-00309-g1a61b828566f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 __might_resched.cold+0x222/0x26b kernel/sched/core.c:9892
 __mutex_lock_common kernel/locking/mutex.c:580 [inline]
 __mutex_lock+0x9f/0x1350 kernel/locking/mutex.c:747
 gsm_send.isra.0+0x3b5/0x7a0 drivers/tty/n_gsm.c:704
 gsm_command drivers/tty/n_gsm.c:768 [inline]
 gsm_dlci_begin_close+0x12e/0x210 drivers/tty/n_gsm.c:1892
 gsm_dlci_t1+0x186/0x450 drivers/tty/n_gsm.c:1816
 call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474
 expire_timers kernel/time/timer.c:1519 [inline]
 __run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790
 __run_timers kernel/time/timer.c:1768 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
 __do_softirq+0x1d3/0x9c6 kernel/softirq.c:571
 invoke_softirq kernel/softirq.c:445 [inline]
 __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194
Code: 74 24 10 e8 fa 1d dc f7 48 89 ef e8 82 9f dc f7 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 33 61 cf f7 65 8b 05 4c 17 7f 76 85 c0 74 0a 5b 5d c3 e8 50 28
RSP: 0018:ffffc90003aef950 EFLAGS: 00000206
RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff21265a6
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: ffff888011bee148 R08: 0000000000000001 R09: ffffffff908e5a0f
R10: 0000000000000001 R11: 0000000000000000 R12: ffff88801bc424c0
R13: ffffc90003aef9e8 R14: ffff888011bee148 R15: 0000000000000000
 spin_unlock_irqrestore include/linux/spinlock.h:404 [inline]
 klist_next+0x288/0x510 lib/klist.c:401
 class_dev_iter_next drivers/base/class.c:311 [inline]
 class_find_device+0x174/0x2a0 drivers/base/class.c:415
 class_find_device_by_devt include/linux/device/class.h:167 [inline]
 device_destroy+0x79/0xd0 drivers/base/core.c:4299
 tty_unregister_device+0x7e/0x1b0 drivers/tty/tty_io.c:3299
 gsm_unregister_devices drivers/tty/n_gsm.c:564 [inline]
 gsm_cleanup_mux+0x5c1/0x800 drivers/tty/n_gsm.c:2465
 gsmld_close+0x41/0x210 drivers/tty/n_gsm.c:2907
 tty_ldisc_close+0x110/0x190 drivers/tty/tty_ldisc.c:456
 tty_ldisc_kill+0x94/0x150 drivers/tty/tty_ldisc.c:608
 tty_ldisc_release+0x1ef/0x2a0 drivers/tty/tty_ldisc.c:776
 tty_release_struct+0x20/0xe0 drivers/tty/tty_io.c:1694
 tty_release+0xc70/0x1200 drivers/tty/tty_io.c:1865
 __fput+0x277/0x9d0 fs/file_table.c:320
 task_work_run+0xdd/0x1a0 kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xad5/0x29b0 kernel/exit.c:795
 do_group_exit+0xd2/0x2f0 kernel/exit.c:925
 __do_sys_exit_group kernel/exit.c:936 [inline]
 __se_sys_exit_group kernel/exit.c:934 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f642cb30f69
Code: Unable to access opcode bytes at RIP 0x7f642cb30f3f.
RSP: 002b:00007ffed5a9f4c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f642cba5330 RCX: 00007f642cb30f69
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000000000000
R10: 000000000000000e R11: 0000000000000246 R12: 00007f642cba5330
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
 </TASK>

=============================
[ BUG: Invalid wait context ]
6.0.0-rc6-syzkaller-00309-g1a61b828566f #0 Tainted: G        W         
-----------------------------
syz-executor269/3606 is trying to lock:
ffff888017ac6430 (&gsm->tx_mutex){+.+.}-{3:3}, at: gsm_send.isra.0+0x3b5/0x7a0 drivers/tty/n_gsm.c:704
other info that might help us debug this:
context-{2:2}
3 locks held by syz-executor269/3606:
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: __tty_ldisc_lock drivers/tty/tty_ldisc.c:290 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_lock_pair_timeout drivers/tty/tty_ldisc.c:353 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_lock_pair drivers/tty/tty_ldisc.c:367 [inline]
 #0: ffff8880250eb098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_release+0x79/0x2a0 drivers/tty/tty_ldisc.c:775
 #1: ffff888017ac60b0 (&gsm->mutex){+.+.}-{3:3}, at: gsm_cleanup_mux+0xf5/0x800 drivers/tty/n_gsm.c:2446
 #2: ffffc900001f0d70 ((&dlci->t1)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:31 [inline]
 #2: ffffc900001f0d70 ((&dlci->t1)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1464
stack backtrace:
CPU: 1 PID: 3606 Comm: syz-executor269 Tainted: G        W          6.0.0-rc6-syzkaller-00309-g1a61b828566f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_lock_invalid_wait_context kernel/locking/lockdep.c:4705 [inline]
 check_wait_context kernel/locking/lockdep.c:4766 [inline]
 __lock_acquire.cold+0x322/0x3a7 kernel/locking/lockdep.c:5003
 lock_acquire kernel/locking/lockdep.c:5666 [inline]
 lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747
 gsm_send.isra.0+0x3b5/0x7a0 drivers/tty/n_gsm.c:704
 gsm_command drivers/tty/n_gsm.c:768 [inline]
 gsm_dlci_begin_close+0x12e/0x210 drivers/tty/n_gsm.c:1892
 gsm_dlci_t1+0x186/0x450 drivers/tty/n_gsm.c:1816
 call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474
 expire_timers kernel/time/timer.c:1519 [inline]
 __run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790
 __run_timers kernel/time/timer.c:1768 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
 __do_softirq+0x1d3/0x9c6 kernel/softirq.c:571
 invoke_softirq kernel/softirq.c:445 [inline]
 __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194
Code: 74 24 10 e8 fa 1d dc f7 48 89 ef e8 82 9f dc f7 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 33 61 cf f7 65 8b 05 4c 17 7f 76 85 c0 74 0a 5b 5d c3 e8 50 28
RSP: 0018:ffffc90003aef950 EFLAGS: 00000206
RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff21265a6
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: ffff888011bee148 R08: 0000000000000001 R09: ffffffff908e5a0f
R10: 0000000000000001 R11: 0000000000000000 R12: ffff88801bc424c0
R13: ffffc90003aef9e8 R14: ffff888011bee148 R15: 0000000000000000
 spin_unlock_irqrestore include/linux/spinlock.h:404 [inline]
 klist_next+0x288/0x510 lib/klist.c:401
 class_dev_iter_next drivers/base/class.c:311 [inline]
 class_find_device+0x174/0x2a0 drivers/base/class.c:415
 class_find_device_by_devt include/linux/device/class.h:167 [inline]
 device_destroy+0x79/0xd0 drivers/base/core.c:4299
 tty_unregister_device+0x7e/0x1b0 drivers/tty/tty_io.c:3299
 gsm_unregister_devices drivers/tty/n_gsm.c:564 [inline]
 gsm_cleanup_mux+0x5c1/0x800 drivers/tty/n_gsm.c:2465
 gsmld_close+0x41/0x210 drivers/tty/n_gsm.c:2907
 tty_ldisc_close+0x110/0x190 drivers/tty/tty_ldisc.c:456
 tty_ldisc_kill+0x94/0x150 drivers/tty/tty_ldisc.c:608
 tty_ldisc_release+0x1ef/0x2a0 drivers/tty/tty_ldisc.c:776
 tty_release_struct+0x20/0xe0 drivers/tty/tty_io.c:1694
 tty_release+0xc70/0x1200 drivers/tty/tty_io.c:1865
 __fput+0x277/0x9d0 fs/file_table.c:320
 task_work_run+0xdd/0x1a0 kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xad5/0x29b0 kernel/exit.c:795
 do_group_exit+0xd2/0x2f0 kernel/exit.c:925
 __do_sys_exit_group kernel/exit.c:936 [inline]
 __se_sys_exit_group kernel/exit.c:934 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f642cb30f69
Code: Unable to access opcode bytes at RIP 0x7f642cb30f3f.
RSP: 002b:00007ffed5a9f4c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f642cba5330 RCX: 00007f642cb30f69
RDX: 000000
----------------
Code disassembly (best guess):
   0:	74 24                	je     0x26
   2:	10 e8                	adc    %ch,%al
   4:	fa                   	cli
   5:	1d dc f7 48 89       	sbb    $0x8948f7dc,%eax
   a:	ef                   	out    %eax,(%dx)
   b:	e8 82 9f dc f7       	callq  0xf7dc9f92
  10:	81 e3 00 02 00 00    	and    $0x200,%ebx
  16:	75 25                	jne    0x3d
  18:	9c                   	pushfq
  19:	58                   	pop    %rax
  1a:	f6 c4 02             	test   $0x2,%ah
  1d:	75 2d                	jne    0x4c
  1f:	48 85 db             	test   %rbx,%rbx
  22:	74 01                	je     0x25
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 33 61 cf f7       	callq  0xf7cf6162 <-- trapping instruction
  2f:	65 8b 05 4c 17 7f 76 	mov    %gs:0x767f174c(%rip),%eax        # 0x767f1782
  36:	85 c0                	test   %eax,%eax
  38:	74 0a                	je     0x44
  3a:	5b                   	pop    %rbx
  3b:	5d                   	pop    %rbp
  3c:	c3                   	retq
  3d:	e8                   	.byte 0xe8
  3e:	50                   	push   %rax
  3f:	28                   	.byte 0x28

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/09/25 09:32 upstream 1a61b828566f 0042f2b4 .config strace log report syz C [disk image] [vmlinux] ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in gsm_send
2022/09/24 18:20 upstream a63f2e7cb110 0042f2b4 .config strace log report syz C [disk image] [vmlinux] ci-upstream-kasan-gce BUG: sleeping function called from invalid context in gsm_send
2022/10/24 08:09 linux-next 4d48f589d294 23bf86af .config strace log report syz C [disk image] [vmlinux] ci-upstream-linux-next-kasan-gce-root BUG: sleeping function called from invalid context in gsm_send
2022/09/24 17:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c194837ebb57 0042f2b4 .config console log report syz C [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/11/15 13:25 upstream e01d50cbd6ee 97de9cfc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in gsm_send
2022/11/10 09:14 upstream f67dd6ce0723 b2488a87 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce BUG: sleeping function called from invalid context in gsm_send
2022/11/02 00:47 upstream b229b6ca5abb edac4fd1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root BUG: sleeping function called from invalid context in gsm_send
2022/10/31 12:46 upstream b229b6ca5abb 2a71366b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in gsm_send
2022/10/22 22:22 upstream 4da34b7d175d c0b80a55 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce BUG: sleeping function called from invalid context in gsm_send
2022/09/25 10:43 upstream 1a61b828566f 0042f2b4 .config console log report info [disk image] [vmlinux] ci-upstream-kasan-gce-smack-root BUG: sleeping function called from invalid context in gsm_send
2023/01/06 09:57 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 247f34f7b803 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/11/20 19:06 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/11/17 05:11 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 3a127a31 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/11/01 05:59 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 a1d8560a .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/10/25 07:43 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 45645420 .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
2022/09/24 17:40 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c194837ebb57 0042f2b4 .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in gsm_send
* Struck through repros no longer work on HEAD.