================================================================== BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline] BUG: KASAN: use-after-free in bpf_fd_array_map_lookup_elem+0x440/0x4c0 kernel/bpf/arraymap.c:374 Read of size 8 at addr ffff8801c3919078 by task syz-executor1/18728 CPU: 1 PID: 18728 Comm: syz-executor1 Not tainted 4.15.0-rc7+ #259 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 __read_once_size include/linux/compiler.h:183 [inline] bpf_fd_array_map_lookup_elem+0x440/0x4c0 kernel/bpf/arraymap.c:374 map_lookup_elem+0x6b5/0xbd0 kernel/bpf/syscall.c:577 SYSC_bpf kernel/bpf/syscall.c:1711 [inline] SyS_bpf+0x922/0x4400 kernel/bpf/syscall.c:1685 entry_SYSCALL_64_fastpath+0x23/0x9a RIP: 0033:0x452ac9 RSP: 002b:00007f9900795c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000452ac9 RDX: 0000000000000018 RSI: 00000000206d1fe8 RDI: 0000000000000001 RBP: 00000000000003f0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f3f20 R13: 00000000ffffffff R14: 00007f99007966d4 R15: 0000000000000000 Allocated by task 17917: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544 ptlock_alloc mm/memory.c:4686 [inline] ptlock_init include/linux/mm.h:1790 [inline] pgtable_pmd_page_ctor include/linux/mm.h:1882 [inline] pmd_alloc_one arch/x86/include/asm/pgalloc.h:105 [inline] __pmd_alloc+0xb6/0x4e0 mm/memory.c:4179 pmd_alloc include/linux/mm.h:1740 [inline] __handle_mm_fault+0xdb8/0x3ce0 mm/memory.c:4028 handle_mm_fault+0x334/0x8d0 mm/memory.c:4098 __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1429 do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1504 page_fault+0x4c/0x60 arch/x86/entry/entry_64.S:1243 Freed by task 17920: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3488 [inline] kmem_cache_free+0x83/0x2a0 mm/slab.c:3746 ptlock_free+0x38/0x42 mm/memory.c:4695 pgtable_pmd_page_dtor include/linux/mm.h:1890 [inline] ___pmd_free_tlb+0xb6/0x130 arch/x86/mm/pgtable.c:75 __pmd_free_tlb arch/x86/include/asm/pgalloc.h:124 [inline] free_pmd_range mm/memory.c:474 [inline] free_pud_range mm/memory.c:492 [inline] free_p4d_range mm/memory.c:526 [inline] free_pgd_range+0x8dd/0xd90 mm/memory.c:606 free_pgtables+0x270/0x330 mm/memory.c:638 exit_mmap+0x291/0x500 mm/mmap.c:3039 __mmput kernel/fork.c:923 [inline] mmput+0x223/0x6d0 kernel/fork.c:944 exit_mm kernel/exit.c:544 [inline] do_exit+0x90a/0x1ad0 kernel/exit.c:852 do_group_exit+0x149/0x400 kernel/exit.c:968 get_signal+0x73f/0x16c0 kernel/signal.c:2335 do_signal+0x90/0x1eb0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264 entry_SYSCALL_64_fastpath+0x98/0x9a The buggy address belongs to the object at ffff8801c3919058 which belongs to the cache page->ptl of size 56 The buggy address is located 32 bytes inside of 56-byte region [ffff8801c3919058, ffff8801c3919090) The buggy address belongs to the page: page:ffffea00070e4640 count:1 mapcount:0 mapping:ffff8801c3919000 index:0xffff8801c3919f78 flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffff8801c3919000 ffff8801c3919f78 000000010000002c raw: ffffea000743d560 ffffea0007366f60 ffff8801dac10040 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c3918f00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8801c3918f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801c3919000: fb fb fb fb fb fb fb fc fc fc fc fb fb fb fb fb ^ ffff8801c3919080: fb fb fc fc fc fc fb fb fb fb fb fb fb fc fc fc ffff8801c3919100: fc fb fb fb fb fb fb fb fc fc fc fc fb fb fb fb ==================================================================