bisecting cause commit starting from e5220dd16778fe21d234a64e36cf50b54110025f building syzkaller on 500c23397f34dde583da6d31f9d9fd21cae289f8 testing commit e5220dd16778fe21d234a64e36cf50b54110025f with gcc (GCC) 10.2.1 20210217 kernel signature: 8b28291962862615e422b43b8c0d35884f2b47f9838abf68bcf1d121bcd8449b all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.12 testing commit 9f4ad9e425a1d3b6a34617b8ea226d56a119a717 with gcc (GCC) 10.2.1 20210217 kernel signature: 20a3195b0c2adea39c30d2e9f830a6fa425a34f031f28cd84a5fc4bf09ce8f4d all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.11 testing commit f40ddce88593482919761f74910f42f4b84c004b with gcc (GCC) 10.2.1 20210217 kernel signature: 22b26ae1e3be417e2ad324e47433a262e845b6471dfc09f4fa2f647b3330df8e all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.10 testing commit 2c85ebc57b3e1817b6ce1a6b703928e113a90442 with gcc (GCC) 10.2.1 20210217 kernel signature: 8f55ba93fd53951cac9b68b979c728becbef461543abacbe99727324ff41baf6 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.9 testing commit bbf5c979011a099af5dc76498918ed7df445635b with gcc (GCC) 10.2.1 20210217 kernel signature: f654d07eeb7c456b884d4afbd5bc4d393d1b1677ed42327eee0eaef482a1d4de all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.8 testing commit bcf876870b95592b52519ed4aafcf9d95999bc9c with gcc (GCC) 8.4.1 20210217 kernel signature: 1063ebaf54671db7804acf12269942e9a5933d00bfb78bb5cf898a218f3c1d07 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.7 testing commit 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 with gcc (GCC) 8.4.1 20210217 kernel signature: 3856a09b3d94850025e3ae49dd0f33b972955333e09df445983a6a278d85997d all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 with gcc (GCC) 8.4.1 20210217 kernel signature: a3b93acd1315ac27fd28df3f64d6ec371b03ab2c3dca6caf01eeb51039157802 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.5 testing commit d5226fa6dbae0569ee43ecfc08bdcd6770fc4755 with gcc (GCC) 8.4.1 20210217 kernel signature: 56b75590080ebce41771eb20fb3a18a21250479d609f5cd866a9e9cf93705477 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.4 testing commit 219d54332a09e8d8741c1e1982f5eae56099de85 with gcc (GCC) 8.4.1 20210217 kernel signature: c6858008ba2dd87e1e0dfa3f7b77c43b09b0dc43a2a0142524db4f19e9503c6e all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.3 testing commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8 with gcc (GCC) 8.4.1 20210217 kernel signature: aae18b99c108d4b86fb7c39080c3a8373862416e546d19d54d8a47dcb2701455 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.2 testing commit 0ecfebd2b52404ae0c54a878c872bb93363ada36 with gcc (GCC) 8.4.1 20210217 kernel signature: e13f671b39135f0fd02c29412f7240f2d07a062c4a49e605a3f48631956d18cb all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.1 testing commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd with gcc (GCC) 8.4.1 20210217 kernel signature: 1e42e1e588ea7d5fe6accbe13bfa4221a4f9f3d4fb725780ca1567cc27b907dc all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.0 testing commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 with gcc (GCC) 8.4.1 20210217 kernel signature: 456ab9d42a47fc3d91f08b7c50f5c4ec701f7eb218a74b092e90c30f2478d7da all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.20 testing commit 8fe28cb58bcb235034b64cbbb7550a8a43fd88be with gcc (GCC) 8.4.1 20210217 kernel signature: 2c8f0e9cd5e3a941f7c9ddb8f194c295dec89af859d029d50e1f87219cea1966 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.19 testing commit 84df9525b0c27f3ebc2ebb1864fa62a97fdedb7d with gcc (GCC) 8.4.1 20210217 kernel signature: 5bae472a437fad8703386704341c228c7c8260d294966f421f1c19fedfbf76be all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.18 testing commit 94710cac0ef4ee177a63b5227664b38c95bbf703 with gcc (GCC) 8.4.1 20210217 kernel signature: b94a2908c854088fbb4e96b69960fb24fd4b59c479da701e3c579f12dc3f44c4 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.17 testing commit 29dcea88779c856c7dc92040a0c01233263101d4 with gcc (GCC) 8.4.1 20210217 failed to run ["make" "-j" "64" "ARCH=x86_64" "CC=/syzkaller/shared/bisect_bin/gcc-8.1.0/bin/gcc" "bzImage"]: exit status 2 testing release v4.16 testing commit 0adb32858b0bddf4ada5f364a84ed60b196dbcda with gcc (GCC) 8.4.1 20210217 orc_dump.c:106:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:111:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] elf.c:135:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:140:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.15 testing commit d8a5b80568a9cb66810e75b182018e9edb68e8ff with gcc (GCC) 8.4.1 20210217 orc_dump.c:106:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:111:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:135:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:140:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.14 testing commit bebc6082da0a9f5d47a1ea2edc099bf671058bd4 with gcc (GCC) 8.4.1 20210217 orc_dump.c:105:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] orc_dump.c:110:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:139:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.13 testing commit 569dbb88e80deb68974ef6fdd6a13edb9d686261 with gcc (GCC) 8.4.1 20210217 pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:144:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:149:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.12 testing commit 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c with gcc (GCC) 8.4.1 20210217 pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:141:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:146:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.11 testing commit a351e9b9fc24e982ec2f0e76379a49826036da12 with gcc (GCC) 7.5.0 elf.c:141:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:146:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.10 testing commit c470abd4fde40ea6a0846a2beab642a578c0b8cd with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.9 testing commit 69973b830859bc6529a7a0468ba0d80ee5117826 with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:35:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.8 testing commit c8d2bc9bc39ebea8437fd974fdbc21847bb897a3 with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:129:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:134:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.7 testing commit 523d939ef98fd712632d93a5a2b588e477a7565e with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] elf.c:122:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:127:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.6 testing commit 2dcd0af568b0cf583645c8a317dd12e344b1c72a with gcc (GCC) 5.5.0 tools/include/linux/log2.h:19:1: error: ignoring attribute 'noreturn' because it conflicts with attribute 'const' [-Werror=attributes] pager.c:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] revisions tested: 17, total time: 2h59m10.280032387s (build: 2h2m5.485953813s, test: 51m33.83248737s) the crash already happened on the oldest tested release commit msg: Linux 4.18 crash: BUG: sleeping function called from invalid context in do_con_write IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50 BUG: sleeping function called from invalid context at drivers/tty/vt/vt.c:2205 in_atomic(): 1, irqs_disabled(): 1, pid: 9989, name: syz-executor.4 3 locks held by syz-executor.4/9989: #0: 00000000322a403c (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x2d/0x40 drivers/tty/tty_ldsem.c:365 #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){....}, at: spin_lock_irq include/linux/spinlock.h:335 [inline] #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){....}, at: n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){....}, at: n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready #2: 00000000322a403c (&tty->ldisc_sem){++++}, at: tty_ldisc_ref+0x1a/0x70 drivers/tty/tty_ldisc.c:284 irq event stamp: 704 hardirqs last enabled at (703): [] do_syscall_64+0x24/0x540 arch/x86/entry/common.c:277 hardirqs last disabled at (704): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (704): [] _raw_spin_lock_irq+0x3c/0x90 kernel/locking/spinlock.c:160 softirqs last enabled at (404): [] spin_unlock_bh include/linux/spinlock.h:355 [inline] softirqs last enabled at (404): [] peernet2id+0x8b/0xc0 net/core/net_namespace.c:265 IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready softirqs last disabled at (402): [] spin_lock_bh include/linux/spinlock.h:315 [inline] softirqs last disabled at (402): [] peernet2id+0x6d/0xc0 net/core/net_namespace.c:263 Preemption disabled at: [] spin_lock_irq include/linux/spinlock.h:335 [inline] [] n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] [] n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 CPU: 1 PID: 9989 Comm: syz-executor.4 Not tainted 4.18.0-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+0x15a/0x20d lib/dump_stack.c:113 ___might_sleep.cold.16+0x1f1/0x265 kernel/sched/core.c:6187 __might_sleep+0x95/0x190 kernel/sched/core.c:6140 do_con_write.part.14+0xaf/0x19a0 drivers/tty/vt/vt.c:2205 do_con_write drivers/tty/vt/vt.c:2202 [inline] con_write+0x1f/0x80 drivers/tty/vt/vt.c:2784 n_hdlc_send_frames drivers/tty/n_hdlc.c:403 [inline] n_hdlc_send_frames+0x201/0x3d0 drivers/tty/n_hdlc.c:375 n_hdlc_tty_wakeup+0x7d/0x90 drivers/tty/n_hdlc.c:479 tty_wakeup+0xaf/0xe0 drivers/tty/tty_io.c:532 __start_tty.part.15+0xbf/0xe0 drivers/tty/tty_io.c:804 __start_tty+0x48/0x60 drivers/tty/tty_io.c:799 n_tty_ioctl_helper drivers/tty/tty_ioctl.c:917 [inline] n_tty_ioctl_helper+0x22f/0x320 drivers/tty/tty_ioctl.c:894 n_hdlc_tty_ioctl+0xc0/0x2d0 drivers/tty/n_hdlc.c:782 tty_ioctl+0x4d4/0x1280 drivers/tty/tty_io.c:2664 wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x196/0x1050 fs/ioctl.c:684 ksys_ioctl+0x62/0x90 fs/ioctl.c:701 __do_sys_ioctl fs/ioctl.c:708 [inline] __se_sys_ioctl fs/ioctl.c:706 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:706 do_syscall_64+0xda/0x540 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4665d9 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 ieee80211 phy11: Selected rate control algorithm 'minstrel_ht' c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fbf6f826188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000000000001 RSI: 000000000000540a RDI: 0000000000000003 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffedc8be1cf R14: 00007fbf6f826300 R15: 0000000000022000 BUG: scheduling while atomic: syz-executor.4/9989/0x00000002 IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready 3 locks held by syz-executor.4/9989: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready #0: 00000000322a403c (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x2d/0x40 drivers/tty/tty_ldsem.c:365 #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){+.+.}, at: spin_lock_irq include/linux/spinlock.h:335 [inline] #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){+.+.}, at: n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] #1: 000000002f1bb780 (&(&tty->flow_lock)->rlock){+.+.}, at: n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 #2: 00000000322a403c (&tty->ldisc_sem){++++}, at: tty_ldisc_ref+0x1a/0x70 drivers/tty/tty_ldisc.c:284 Modules linked in: Preemption disabled at: [] spin_lock_irq include/linux/spinlock.h:335 [inline] [] n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] [] n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50