bisecting cause commit starting from f2e19fd15bd7cba347ce50be71955f5cd28a6019 building syzkaller on 83f5c9b5f8b0305fc61522640ce31465ec14c81f testing commit f2e19fd15bd7cba347ce50be71955f5cd28a6019 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 58d58a075f2f88165983b1459f84771598aaa79fe4392c2681042a7438562c86 all runs: crashed: BUG: sleeping function called from invalid context in __might_resched testing release v5.15 testing commit 8bb7eca972ad531c9b149c0a51ab43a417385813 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: fda635a039ec7a6b34b70166e431bc918c49571dab4b08bbf4dfbb4a20b5b507 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.14 testing commit 7d2a07b769330c34b4deabeed939325c77a7ec2f compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 45a086b3cd23484ffe5ca580dc699c110b33bc89931f6d41df642323e5e636db all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.13 testing commit 62fb9874f5da54fdb243003b386128037319b219 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 9cf050852ce216a4ec488afa6c90d5b4ddbf2e1e6bacf5bc007e719f2f92409e all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.12 testing commit 9f4ad9e425a1d3b6a34617b8ea226d56a119a717 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: da3beaf629010ca3c7acb25f944e4ed2bd49f8d64d9a5789f83b8619e8e1baaf all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.11 testing commit f40ddce88593482919761f74910f42f4b84c004b compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 1a21d1815a19cb3f14f0e618b09d319e521717a513ad359c9bfcb03e93c97e52 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.10 testing commit 2c85ebc57b3e1817b6ce1a6b703928e113a90442 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 5e8dde6d68c61ec9cc00685911e531a18d6d78b32a9001f56753463e19a36bc4 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.9 testing commit bbf5c979011a099af5dc76498918ed7df445635b compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 59430e1a798d6160c79b2d561c768e3ebda373444804937c8503a5d8a377a18f all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.8 testing commit bcf876870b95592b52519ed4aafcf9d95999bc9c compiler: gcc (GCC) 8.4.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b01c7e8eff9b39961db71d12978de2e1dfbfcc73de1e717cd98ace48e9bfe680 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.7 testing commit 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 compiler: gcc version 8.4.1 20210217 (GCC), GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 138822ce989c2fbe9dac2e8cb09febfcf10c4e732a981e20b3aed95bd0c85854 all runs: crashed: BUG: sleeping function called from invalid context in console_lock testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: a53214267b49df59cf10f4ea21341b7cccbd6b9d5f617acc8bc78ed3f2f9c737 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.5 testing commit d5226fa6dbae0569ee43ecfc08bdcd6770fc4755 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 79c5ffc47c6dee4bcdb499dc095d81d1b606a8d6a425fa335dfcfaefa9816f6f all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.4 testing commit 219d54332a09e8d8741c1e1982f5eae56099de85 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: a131901e006f9514e80bad856b8207e665503e3dcbf6b7b2e356948ea27f8d61 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.3 testing commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 8ba9e404f23c62f8ea41bf5d33c1008642153030c81e933564bf537f53576355 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.2 testing commit 0ecfebd2b52404ae0c54a878c872bb93363ada36 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: ed225a254cd0c0c2eca545239abae2e069db7e1d97a9182fa95fe76e9090cda8 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.1 testing commit e93c9c99a629c61837d5a7fc2120cd2b6c70dbdd compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: ee63c80d24fe2bb69159f448e5a964da644d76b5301ffb1385ccbf61e438d977 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v5.0 testing commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 579d7d2dc843d401e3abf90072bf1ce27eb92239f2ec5bb565c0e47f47a8347c run #0: crashed: BUG: sleeping function called from invalid context in do_con_write run #1: crashed: BUG: sleeping function called from invalid context in do_con_write run #2: crashed: BUG: sleeping function called from invalid context in corrupted run #3: crashed: BUG: sleeping function called from invalid context in do_con_write run #4: crashed: BUG: sleeping function called from invalid context in do_con_write run #5: crashed: BUG: sleeping function called from invalid context in do_con_write run #6: crashed: BUG: sleeping function called from invalid context in do_con_write run #7: crashed: BUG: sleeping function called from invalid context in do_con_write run #8: crashed: BUG: sleeping function called from invalid context in do_con_write run #9: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.20 testing commit 8fe28cb58bcb235034b64cbbb7550a8a43fd88be compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: ed8791c3f0ca346a1944f040c33d302685a6142bfdfb72c4e6c583bedda72bbd all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.19 testing commit 84df9525b0c27f3ebc2ebb1864fa62a97fdedb7d compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: e2ab84b7690570e9f8781905b5e3630efb0f79ec2a6bc5d4b99f6372ec61591e all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.18 testing commit 94710cac0ef4ee177a63b5227664b38c95bbf703 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 16cfee66aa87d2d78fccbaaa0e294dbb1118eef7c5e1aee256d612d85bf570d7 all runs: crashed: BUG: sleeping function called from invalid context in do_con_write testing release v4.17 testing commit 29dcea88779c856c7dc92040a0c01233263101d4 compiler: 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 compiler: 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 compiler: 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] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.14 testing commit bebc6082da0a9f5d47a1ea2edc099bf671058bd4 compiler: 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] pager.c:36:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] elf.c:134:2: error: 'elf_getshnum' is deprecated [-Werror=deprecated-declarations] elf.c:139:2: error: 'elf_getshstrndx' is deprecated [-Werror=deprecated-declarations] testing release v4.13 testing commit 569dbb88e80deb68974ef6fdd6a13edb9d686261 compiler: 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 compiler: 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 compiler: 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 compiler: 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 compiler: 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 compiler: 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:33:12: error: passing argument 2 to 'restrict'-qualified parameter aliases with argument 4 [-Werror=restrict] testing release v4.7 testing commit 523d939ef98fd712632d93a5a2b588e477a7565e compiler: 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 compiler: 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: 20, total time: 3h21m15.46648362s (build: 2h12m31.410367267s, test: 1h3m28.75396418s) 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 wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50 IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 BUG: sleeping function called from invalid context at drivers/tty/vt/vt.c:2205 wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50 in_atomic(): 1, irqs_disabled(): 1, pid: 9969, name: syz-executor.4 3 locks held by syz-executor.4/9969: #0: 00000000321274be (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x2d/0x40 drivers/tty/tty_ldsem.c:365 #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){....}, at: spin_lock_irq include/linux/spinlock.h:335 [inline] #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){....}, at: n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){....}, at: n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 #2: 00000000321274be (&tty->ldisc_sem){++++}, at: tty_ldisc_ref+0x1a/0x70 drivers/tty/tty_ldisc.c:284 irq event stamp: 720 hardirqs last enabled at (719): [] do_syscall_64+0x24/0x540 arch/x86/entry/common.c:277 hardirqs last disabled at (720): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (720): [] _raw_spin_lock_irq+0x3c/0x90 kernel/locking/spinlock.c:160 softirqs last enabled at (320): [] spin_unlock_bh include/linux/spinlock.h:355 [inline] softirqs last enabled at (320): [] peernet2id+0x8b/0xc0 net/core/net_namespace.c:265 softirqs last disabled at (318): [] spin_lock_bh include/linux/spinlock.h:315 [inline] softirqs last disabled at (318): [] 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: 9969 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 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:0x7fa73d3e2ae9 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 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa73cb58188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fa73d4f5f60 RCX: 00007fa73d3e2ae9 RDX: 0000000000000001 RSI: 000000000000540a RDI: 0000000000000005 RBP: 00007fa73d43cf6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff7b9ce74f R14: 00007fa73cb58300 R15: 0000000000022000 BUG: scheduling while atomic: syz-executor.4/9969/0x00000002 3 locks held by syz-executor.4/9969: #0: 00000000321274be (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x2d/0x40 drivers/tty/tty_ldsem.c:365 #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){+.+.}, at: spin_lock_irq include/linux/spinlock.h:335 [inline] #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){+.+.}, at: n_tty_ioctl_helper drivers/tty/tty_ioctl.c:914 [inline] #1: 000000001e953b79 (&(&tty->flow_lock)->rlock){+.+.}, at: n_tty_ioctl_helper+0x18f/0x320 drivers/tty/tty_ioctl.c:894 #2: 00000000321274be (&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