lowmemorykiller: Killing 'syz-executor.4' (32419) (tgid 32419), adj 1000, to free 53048kB on behalf of 'kswapd0' (33) because cache 62832kB is below limit 65536kB for oom_score_adj 12 Free memory is -6668kB above reserved ================================= [ INFO: inconsistent lock state ] 4.9.194+ #0 Not tainted --------------------------------- inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-R} usage. kswapd0/33 [HC0[0]:SC0[0]:HE1:SE1] takes: (&mm->mmap_sem){+++++?}, at: [<00000000eb9bd797>] get_cmdline+0xa3/0x2d0 mm/util.c:641 mark_held_locks+0xb1/0x100 kernel/locking/lockdep.c:2660 __lockdep_trace_alloc kernel/locking/lockdep.c:2882 [inline] lockdep_trace_alloc+0x18c/0x2b0 kernel/locking/lockdep.c:2897 __alloc_pages_nodemask+0x143/0x1a80 mm/page_alloc.c:3803 __alloc_pages include/linux/gfp.h:433 [inline] __alloc_pages_node include/linux/gfp.h:446 [inline] alloc_pages_node include/linux/gfp.h:460 [inline] pmd_alloc_one arch/x86/include/asm/pgalloc.h:88 [inline] __pmd_alloc+0x4a/0x330 mm/memory.c:3742 pmd_alloc include/linux/mm.h:1625 [inline] alloc_new_pmd mm/mremap.c:64 [inline] move_page_tables+0xadb/0xd60 mm/mremap.c:212 shift_arg_pages+0x1ae/0x470 fs/exec.c:642 setup_arg_pages+0x60d/0x7c0 fs/exec.c:754 load_elf_binary+0xa84/0x4a90 fs/binfmt_elf.c:860 search_binary_handler fs/exec.c:1621 [inline] search_binary_handler+0x14f/0x700 fs/exec.c:1599 exec_binprm fs/exec.c:1663 [inline] do_execveat_common.isra.0+0xf81/0x1db0 fs/exec.c:1785 do_execve+0x3a/0x50 fs/exec.c:1829 run_init_process+0x33/0x37 init/main.c:904 try_to_run_init_process+0x18/0x48 init/main.c:913 kernel_init+0xf2/0x163 init/main.c:984 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375 irq event stamp: 591921 hardirqs last enabled at (591921): [<00000000a3d95b7e>] vprintk_emit+0x25c/0x6f0 kernel/printk/printk.c:1897 hardirqs last disabled at (591920): [<00000000371d3886>] vprintk_emit+0x6d/0x6f0 kernel/printk/printk.c:1801 softirqs last enabled at (591570): [<00000000a22ea71b>] __do_softirq+0x474/0x964 kernel/softirq.c:314 softirqs last disabled at (591423): [<00000000a3e56dd4>] invoke_softirq kernel/softirq.c:368 [inline] softirqs last disabled at (591423): [<00000000a3e56dd4>] irq_exit+0x119/0x160 kernel/softirq.c:409 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&mm->mmap_sem); lock(&mm->mmap_sem); *** DEADLOCK *** 1 lock held by kswapd0/33: #0: (shrinker_rwsem){++++..}, at: [<000000000a866073>] shrink_slab.part.0+0xb2/0xa20 mm/vmscan.c:472 stack backtrace: CPU: 1 PID: 33 Comm: kswapd0 Not tainted 4.9.194+ #0 ffff8801d841f420 ffffffff81b67001 00000000000000f0 ffff8801d992c740 ffffffff83cb0990 ffff8801d992d038 ffffffff84252000 ffff8801d841f498 ffffffff81408710 0000000000000000 ffffffff00000001 0000000000000001 Call Trace: [<000000004d712a64>] __dump_stack lib/dump_stack.c:15 [inline] [<000000004d712a64>] dump_stack+0xc1/0x120 lib/dump_stack.c:51 [<000000001018b566>] print_usage_bug kernel/locking/lockdep.c:2387 [inline] [<000000001018b566>] print_usage_bug.cold+0x452/0x5a2 kernel/locking/lockdep.c:2354 [<000000007436a384>] valid_state kernel/locking/lockdep.c:2400 [inline] [<000000007436a384>] mark_lock_irq kernel/locking/lockdep.c:2602 [inline] [<000000007436a384>] mark_lock+0x6c7/0x12e0 kernel/locking/lockdep.c:3065 [<000000003b745b30>] mark_irqflags kernel/locking/lockdep.c:2958 [inline] [<000000003b745b30>] __lock_acquire+0x5be/0x4390 kernel/locking/lockdep.c:3302 [<00000000d7cc008e>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756 [<0000000070bdf328>] down_read+0x44/0xb0 kernel/locking/rwsem.c:22 [<00000000eb9bd797>] get_cmdline+0xa3/0x2d0 mm/util.c:641 [<00000000698d30c7>] handle_lmk_event+0x169/0x920 drivers/staging/android/lowmemorykiller.c:116 [<000000009d659083>] lowmem_scan+0x6f3/0xb70 drivers/staging/android/lowmemorykiller.c:354 [<00000000f46c8b8e>] do_shrink_slab mm/vmscan.c:399 [inline] [<00000000f46c8b8e>] shrink_slab.part.0+0x3cf/0xa20 mm/vmscan.c:502 [<00000000e1406f71>] shrink_slab mm/vmscan.c:466 [inline] [<00000000e1406f71>] shrink_node+0x1ed/0x750 mm/vmscan.c:2604 [<00000000d2641415>] kswapd_shrink_node mm/vmscan.c:3209 [inline] [<00000000d2641415>] balance_pgdat mm/vmscan.c:3329 [inline] [<00000000d2641415>] kswapd+0x7f8/0x13b0 mm/vmscan.c:3523 [<00000000511ec35a>] kthread+0x278/0x310 kernel/kthread.c:211 [<0000000049b0545c>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375 lowmemorykiller: Killing 'syz-executor.4' (32469) (tgid 32469), adj 1000, to free 53048kB on behalf of 'kswapd0' (33) because cache 61932kB is below limit 65536kB for oom_score_adj 12 Free memory is -6268kB above reserved ================================================================== BUG: KASAN: use-after-free in handle_lmk_event+0x7fa/0x920 drivers/staging/android/lowmemorykiller.c:143 Read of size 4 at addr ffff8801d2444c58 by task kswapd0/33 CPU: 1 PID: 33 Comm: kswapd0 Not tainted 4.9.194+ #0 ffff8801d841f6f8 ffffffff81b67001 0000000000000000 ffffea0007491000 ffff8801d2444c58 0000000000000004 ffffffff82213bca ffff8801d841f730 ffffffff8150c4f1 0000000000000000 ffff8801d2444c58 ffff8801d2444c58 Call Trace: [<000000004d712a64>] __dump_stack lib/dump_stack.c:15 [inline] [<000000004d712a64>] dump_stack+0xc1/0x120 lib/dump_stack.c:51 [<0000000069917058>] print_address_description+0x6f/0x23a mm/kasan/report.c:256 [<000000009d6c67a6>] kasan_report_error mm/kasan/report.c:355 [inline] [<000000009d6c67a6>] kasan_report mm/kasan/report.c:413 [inline] [<000000009d6c67a6>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397 [<000000005992cdac>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:433 [<0000000065374a32>] handle_lmk_event+0x7fa/0x920 drivers/staging/android/lowmemorykiller.c:143 [<000000009d659083>] lowmem_scan+0x6f3/0xb70 drivers/staging/android/lowmemorykiller.c:354 [<00000000f46c8b8e>] do_shrink_slab mm/vmscan.c:399 [inline] [<00000000f46c8b8e>] shrink_slab.part.0+0x3cf/0xa20 mm/vmscan.c:502 [<00000000e1406f71>] shrink_slab mm/vmscan.c:466 [inline] [<00000000e1406f71>] shrink_node+0x1ed/0x750 mm/vmscan.c:2604 [<00000000d2641415>] kswapd_shrink_node mm/vmscan.c:3209 [inline] [<00000000d2641415>] balance_pgdat mm/vmscan.c:3329 [inline] [<00000000d2641415>] kswapd+0x7f8/0x13b0 mm/vmscan.c:3523 [<00000000511ec35a>] kthread+0x278/0x310 kernel/kthread.c:211 [<0000000049b0545c>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375 Allocated by task 32468: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack mm/kasan/kasan.c:512 [inline] set_track mm/kasan/kasan.c:524 [inline] kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616 kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:554 slab_post_alloc_hook mm/slab.h:417 [inline] slab_alloc_node mm/slub.c:2715 [inline] slab_alloc mm/slub.c:2723 [inline] kmem_cache_alloc+0xd5/0x2b0 mm/slub.c:2728 kmem_cache_alloc_node include/linux/slab.h:364 [inline] alloc_task_struct_node kernel/fork.c:146 [inline] dup_task_struct kernel/fork.c:490 [inline] copy_process.part.0+0x1714/0x6690 kernel/fork.c:1640 copy_process kernel/fork.c:1586 [inline] _do_fork+0x1c1/0xd50 kernel/fork.c:2111 SYSC_clone kernel/fork.c:2223 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2217 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288 entry_SYSCALL_64_after_swapgs+0x5d/0xdb Freed by task 2076: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack mm/kasan/kasan.c:512 [inline] set_track mm/kasan/kasan.c:524 [inline] kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589 slab_free_hook mm/slub.c:1355 [inline] slab_free_freelist_hook mm/slub.c:1377 [inline] slab_free mm/slub.c:2958 [inline] kmem_cache_free+0xbe/0x310 mm/slub.c:2980 free_task_struct kernel/fork.c:151 [inline] free_task+0x74/0xb0 kernel/fork.c:367 __put_task_struct+0x27c/0x4a0 kernel/fork.c:404 put_task_struct include/linux/sched.h:2337 [inline] delayed_put_task_struct+0x9a/0x2f0 kernel/exit.c:166 __rcu_reclaim kernel/rcu/rcu.h:118 [inline] rcu_do_batch kernel/rcu/tree.c:2797 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:3061 [inline] __rcu_process_callbacks kernel/rcu/tree.c:3028 [inline] rcu_process_callbacks+0x8c2/0x1300 kernel/rcu/tree.c:3045 __do_softirq+0x22d/0x964 kernel/softirq.c:288 The buggy address belongs to the object at ffff8801d2444740 which belongs to the cache task_struct of size 5824 The buggy address is located 1304 bytes inside of 5824-byte region [ffff8801d2444740, ffff8801d2445e00) The buggy address belongs to the page: page:ffffea0007491000 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000010200(slab|head) page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d2444b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d2444b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801d2444c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d2444c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d2444d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================