RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 20065 Comm: syz-executor3 Not tainted 4.17.0-rc7+ #103
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__delayacct_blkio_end+0x4f/0xc0 kernel/delayacct.c:82
RSP: 0018:ffff880189ca4d58 EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffc90003caf000
RDX: 0000000000000007 RSI: ffffffff817a4de1 RDI: 0000000000000038
RBP: ffff880189ca4d70 R08: ffffed003b5c46d3 R09: 0000000000000000
R10: ffff880189ca4e00 R11: ffff8801dae23693 R12: ffff8801c5fd4440
R13: ffff88018fc9c5c0 R14: ffff88018fc9c5fc R15: 0000000000000002
FS:  0000000000000000(0000) GS:ffff8801dae00000(0063) knlGS:00000000f5ff6b40
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 0000000020b53000 CR3: 00000001acbc1000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 delayacct_blkio_end include/linux/delayacct.h:128 [inline]
 try_to_wake_up+0xa89/0x1190 kernel/sched/core.c:2037
 default_wake_function+0x30/0x50 kernel/sched/core.c:3739
 autoremove_wake_function+0x7a/0x350 kernel/sched/wait.c:373
 wake_page_function+0x15f/0x1c0 mm/filemap.c:1010
 __wake_up_common+0x189/0x730 kernel/sched/wait.c:90
 __wake_up_locked_key_bookmark+0x16/0x20 kernel/sched/wait.c:165
 wake_up_page_bit+0x297/0x580 mm/filemap.c:1030
 unlock_page+0x214/0x2b0 mm/filemap.c:1207
 __split_huge_page+0xfc7/0x17b0 mm/huge_memory.c:2464
 split_huge_page_to_list+0x15a2/0x1bf0 mm/huge_memory.c:2685
 shrink_page_list+0x4a4b/0x5fe0 mm/vmscan.c:1142
 shrink_inactive_list+0x73a/0x1c60 mm/vmscan.c:1784
 shrink_list mm/vmscan.c:2095 [inline]
 shrink_node_memcg+0x78c/0x1910 mm/vmscan.c:2358
 shrink_node+0x481/0x1740 mm/vmscan.c:2557
 shrink_zones mm/vmscan.c:2794 [inline]
 do_try_to_free_pages+0x3c9/0x1240 mm/vmscan.c:2856
 try_to_free_mem_cgroup_pages+0x475/0xc50 mm/vmscan.c:3146
 reclaim_high.constprop.67+0x12f/0x1d0 mm/memcontrol.c:1862
 mem_cgroup_handle_over_high+0x8d/0x130 mm/memcontrol.c:1887
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x274/0x310 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_32_irqs_on arch/x86/entry/common.c:338 [inline]
 do_fast_syscall_32+0xcc3/0xf9b arch/x86/entry/common.c:394
 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
RIP: 0023:0xf7ffacb9
RSP: 002b:00000000f5ff60ac EFLAGS: 00000282 ORIG_RAX: 0000000000000078
RAX: 0000000000001b7a RBX: 0000000000000000 RCX: 0000000020b53000
RDX: 000000002084effc RSI: 0000000020c35ffc RDI: 0000000020b3bfff
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Code: fa 48 c1 ea 03 80 3c 02 00 0f 85 80 00 00 00 48 8b 9b 30 12 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 38 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 04 3c 03 7e 51 44 8b 63 38 31 ff 41 83 e4 
RIP: __delayacct_blkio_end+0x4f/0xc0 kernel/delayacct.c:82 RSP: ffff880189ca4d58

======================================================
WARNING: possible circular locking dependency detected
4.17.0-rc7+ #103 Not tainted
------------------------------------------------------
syz-executor3/20065 is trying to acquire lock:
0000000025c89135 ((console_sem).lock){-.-.}, at: down_trylock+0x13/0x70 kernel/locking/semaphore.c:136

but task is already holding lock:
00000000df2dd476 (&p->pi_lock){-.-.}, at: try_to_wake_up+0xca/0x1190 kernel/sched/core.c:1966

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&p->pi_lock){-.-.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
       try_to_wake_up+0xca/0x1190 kernel/sched/core.c:1966
       wake_up_process+0x10/0x20 kernel/sched/core.c:2129
       __up.isra.1+0x1b8/0x290 kernel/locking/semaphore.c:262
       up+0x12f/0x1b0 kernel/locking/semaphore.c:187
       __up_console_sem+0xbe/0x1b0 kernel/printk/printk.c:242
       console_unlock+0x7d6/0x1100 kernel/printk/printk.c:2417
       do_con_write+0x12b2/0x2280 drivers/tty/vt/vt.c:2437
       con_write+0x25/0xc0 drivers/tty/vt/vt.c:2786
       process_output_block drivers/tty/n_tty.c:579 [inline]
       n_tty_write+0x6b9/0x1180 drivers/tty/n_tty.c:2308
       do_tty_write drivers/tty/tty_io.c:958 [inline]
       tty_write+0x3f1/0x880 drivers/tty/tty_io.c:1042
       __vfs_write+0x10b/0x960 fs/read_write.c:485
       vfs_write+0x1f8/0x560 fs/read_write.c:549
       ksys_write+0xf9/0x250 fs/read_write.c:598
       __do_sys_write fs/read_write.c:610 [inline]
       __se_sys_write fs/read_write.c:607 [inline]
       __x64_sys_write+0x73/0xb0 fs/read_write.c:607
       do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 ((console_sem).lock){-.-.}:
       lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
       down_trylock+0x13/0x70 kernel/locking/semaphore.c:136
       __down_trylock_console_sem+0xae/0x200 kernel/printk/printk.c:225
       console_trylock+0x15/0xa0 kernel/printk/printk.c:2229
       console_trylock_spinning kernel/printk/printk.c:1643 [inline]
       vprintk_emit+0x694/0xdd0 kernel/printk/printk.c:1906
       vprintk_default+0x28/0x30 kernel/printk/printk.c:1947
       vprintk_func+0x7a/0xe7 kernel/printk/printk_safe.c:379
       printk+0x9e/0xba kernel/printk/printk.c:1980
       kasan_die_handler.cold.22+0x11/0x30 arch/x86/mm/kasan_init_64.c:253
       notifier_call_chain+0x178/0x380 kernel/notifier.c:93
       __atomic_notifier_call_chain kernel/notifier.c:183 [inline]
       atomic_notifier_call_chain+0x98/0x190 kernel/notifier.c:193
       notify_die+0x1a3/0x2b0 kernel/notifier.c:549
       do_general_protection+0x248/0x2f0 arch/x86/kernel/traps.c:558
       general_protection+0x1e/0x30 arch/x86/entry/entry_64.S:1159
       __delayacct_blkio_end+0x4f/0xc0 kernel/delayacct.c:82
       delayacct_blkio_end include/linux/delayacct.h:128 [inline]
       try_to_wake_up+0xa89/0x1190 kernel/sched/core.c:2037
       default_wake_function+0x30/0x50 kernel/sched/core.c:3739
       autoremove_wake_function+0x7a/0x350 kernel/sched/wait.c:373
       wake_page_function+0x15f/0x1c0 mm/filemap.c:1010
       __wake_up_common+0x189/0x730 kernel/sched/wait.c:90
       __wake_up_locked_key_bookmark+0x16/0x20 kernel/sched/wait.c:165
       wake_up_page_bit+0x297/0x580 mm/filemap.c:1030
       unlock_page+0x214/0x2b0 mm/filemap.c:1207
       __split_huge_page+0xfc7/0x17b0 mm/huge_memory.c:2464
       split_huge_page_to_list+0x15a2/0x1bf0 mm/huge_memory.c:2685
       shrink_page_list+0x4a4b/0x5fe0 mm/vmscan.c:1142
       shrink_inactive_list+0x73a/0x1c60 mm/vmscan.c:1784
       shrink_list mm/vmscan.c:2095 [inline]
       shrink_node_memcg+0x78c/0x1910 mm/vmscan.c:2358
       shrink_node+0x481/0x1740 mm/vmscan.c:2557
       shrink_zones mm/vmscan.c:2794 [inline]
       do_try_to_free_pages+0x3c9/0x1240 mm/vmscan.c:2856
       try_to_free_mem_cgroup_pages+0x475/0xc50 mm/vmscan.c:3146
       reclaim_high.constprop.67+0x12f/0x1d0 mm/memcontrol.c:1862
       mem_cgroup_handle_over_high+0x8d/0x130 mm/memcontrol.c:1887
       tracehook_notify_resume include/linux/tracehook.h:193 [inline]
       exit_to_usermode_loop+0x274/0x310 arch/x86/entry/common.c:166
       prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
       do_syscall_32_irqs_on arch/x86/entry/common.c:338 [inline]
       do_fast_syscall_32+0xcc3/0xf9b arch/x86/entry/common.c:394
       entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&p->pi_lock);
                               lock((console_sem).lock);
                               lock(&p->pi_lock);
  lock((console_sem).lock);

 *** DEADLOCK ***

4 locks held by syz-executor3/20065:
 #0: 00000000178c583e (&anon_vma->rwsem){++++}, at: anon_vma_lock_write include/linux/rmap.h:120 [inline]
 #0: 00000000178c583e (&anon_vma->rwsem){++++}, at: split_huge_page_to_list+0xd54/0x1bf0 mm/huge_memory.c:2624
 #1: 00000000177f98fc (&page_wait_table[i]){-.-.}, at: wake_up_page_bit+0x27d/0x580 mm/filemap.c:1029
 #2: 00000000df2dd476 (&p->pi_lock){-.-.}, at: try_to_wake_up+0xca/0x1190 kernel/sched/core.c:1966
 #3: 0000000002df988a (rcu_read_lock){....}, at: atomic_notifier_call_chain+0x0/0x190 include/linux/compiler.h:188

stack backtrace:
CPU: 0 PID: 20065 Comm: syz-executor3 Not tainted 4.17.0-rc7+ #103
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+0x1b9/0x294 lib/dump_stack.c:113
 print_circular_bug.isra.36.cold.54+0x1bd/0x27d kernel/locking/lockdep.c:1223
 check_prev_add kernel/locking/lockdep.c:1863 [inline]
 check_prevs_add kernel/locking/lockdep.c:1976 [inline]
 validate_chain kernel/locking/lockdep.c:2417 [inline]
 __lock_acquire+0x343e/0x5140 kernel/locking/lockdep.c:3431
 lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
 down_trylock+0x13/0x70 kernel/locking/semaphore.c:136
 __down_trylock_console_sem+0xae/0x200 kernel/printk/printk.c:225
 console_trylock+0x15/0xa0 kernel/printk/printk.c:2229
 console_trylock_spinning kernel/printk/printk.c:1643 [inline]
 vprintk_emit+0x694/0xdd0 kernel/printk/printk.c:1906
 vprintk_default+0x28/0x30 kernel/printk/printk.c:1947
 vprintk_func+0x7a/0xe7 kernel/printk/printk_safe.c:379
 printk+0x9e/0xba kernel/printk/printk.c:1980
 kasan_die_handler.cold.22+0x11/0x30 arch/x86/mm/kasan_init_64.c:253
 notifier_call_chain+0x178/0x380 kernel/notifier.c:93
 __atomic_notifier_call_chain kernel/notifier.c:183 [inline]
 atomic_notifier_call_chain+0x98/0x190 kernel/notifier.c:193
 notify_die+0x1a3/0x2b0 kernel/notifier.c:549
 do_general_protection+0x248/0x2f0 arch/x86/kernel/traps.c:558
 general_protection+0x1e/0x30 arch/x86/entry/entry_64.S:1159
RIP: 0010:__delayacct_blkio_end+0x4f/0xc0 kernel/delayacct.c:82
RSP: 0018:ffff880189ca4d58 EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffc90003caf000
RDX: 0000000000000007 RSI: ffffffff817a4de1 RDI: 0000000000000038
RBP: ffff880189ca4d70 R08: ffffed003b5c46d3 R09: 0000000000000000
R10: ffff880189ca4e00 R11: ffff8801dae23693 R12: ffff8801c5fd4440
R13: ffff88018fc9c5c0 R14: ffff88018fc9c5fc R15: 0000000000000002
 delayacct_blkio_end include/linux/delayacct.h:128 [inline]
 try_to_wake_up+0xa89/0x1190 kernel/sched/core.c:2037
 default_wake_function+0x30/0x50 kernel/sched/core.c:3739
 autoremove_wake_function+0x7a/0x350 kernel/sched/wait.c:373
 wake_page_function+0x15f/0x1c0 mm/filemap.c:1010
 __wake_up_common+0x189/0x730 kernel/sched/wait.c:90
 __wake_up_locked_key_bookmark+0x16/0x20 kernel/sched/wait.c:165
 wake_up_page_bit+0x297/0x580 mm/filemap.c:1030
 unlock_page+0x214/0x2b0 mm/filemap.c:1207
 __split_huge_page+0xfc7/0x17b0 mm/huge_memory.c:2464
 split_huge_page_to_list+0x15a2/0x1bf0 mm/huge_memory.c:2685
 ? rmap
Lost 165 message(s)!
---[ end trace 600d63613dbbf7d0 ]---