================================================================== BUG: KASAN: use-after-free in cmpxchg_size include/asm-generic/atomic-instrumented.h:355 [inline] BUG: KASAN: use-after-free in bpf_tcp_close+0x469/0xb90 kernel/bpf/sockmap.c:344 Write of size 8 at addr ffff88008d149980 by task syz-executor.1/21595 CPU: 1 PID: 21595 Comm: syz-executor.1 Not tainted 4.18.0-rc1+ #1 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+0x109/0x15a lib/dump_stack.c:113 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x2fe mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278 cmpxchg_size include/asm-generic/atomic-instrumented.h:355 [inline] bpf_tcp_close+0x469/0xb90 kernel/bpf/sockmap.c:344 inet_release+0xd9/0x1c0 net/ipv4/af_inet.c:427 inet6_release+0x46/0x60 net/ipv6/af_inet6.c:459 __sock_release+0xc2/0x230 net/socket.c:603 sock_close+0x10/0x20 net/socket.c:1186 __fput+0x238/0x780 fs/file_table.c:209 ____fput+0x9/0x10 fs/file_table.c:243 task_work_run+0x111/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:192 [inline] exit_to_usermode_loop+0x1a2/0x200 arch/x86/entry/common.c:166 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x407/0x4d0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x413201 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffe660a8a90 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000413201 RDX: 0000000000000000 RSI: 0000000000000081 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000761170 R09: ffffffffffffffff R10: 00007ffe660a8b60 R11: 0000000000000293 R12: 0000000000761178 R13: 0000000000000005 R14: 0000000000000000 R15: ffffffffffffffff kobject: 'loop4' ((____ptrval____)): fill_kobj_path: path = '/devices/virtual/block/loop4' Allocated by task 21598: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 __do_kmalloc_node mm/slab.c:3682 [inline] __kmalloc_node+0x47/0x70 mm/slab.c:3689 kmalloc_node include/linux/slab.h:555 [inline] bpf_map_area_alloc+0x22/0x50 kernel/bpf/syscall.c:147 sock_map_alloc+0x2b4/0x350 kernel/bpf/sockmap.c:1653 find_and_alloc_map kernel/bpf/syscall.c:129 [inline] map_create+0x230/0xc40 kernel/bpf/syscall.c:453 __do_sys_bpf kernel/bpf/syscall.c:2290 [inline] __se_sys_bpf kernel/bpf/syscall.c:2267 [inline] __x64_sys_bpf+0x1d1/0x380 kernel/bpf/syscall.c:2267 do_syscall_64+0xd0/0x4d0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 6834: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kfree+0xcf/0x270 mm/slab.c:3813 kvfree+0x2c/0x30 mm/util.c:442 kobject: 'loop2' ((____ptrval____)): kobject_uevent_env bpf_map_area_free+0x9/0x10 kernel/bpf/syscall.c:158 sock_map_remove_complete kernel/bpf/sockmap.c:1540 [inline] sock_map_free+0x22e/0x300 kernel/bpf/sockmap.c:1729 bpf_map_free_deferred+0xaf/0xe0 kernel/bpf/syscall.c:262 process_one_work+0x830/0x1650 kernel/workqueue.c:2153 worker_thread+0x85/0xb60 kernel/workqueue.c:2296 kthread+0x316/0x3d0 kernel/kthread.c:240 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:412 The buggy address belongs to the object at ffff88008d149980 which belongs to the cache kmalloc-8192 of size 8192 The buggy address is located 0 bytes inside of 8192-byte region [ffff88008d149980, ffff88008d14b980) The buggy address belongs to the page: page:ffffea0002345200 count:1 mapcount:0 mapping:ffff8800aa802080 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000008100(slab|head) kobject: 'loop2' ((____ptrval____)): fill_kobj_path: path = '/devices/virtual/block/loop2' raw: 01fffc0000008100 ffffea0002414708 ffffea0002a57b08 ffff8800aa802080 raw: 0000000000000000 ffff88008d149980 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88008d149880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88008d149900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88008d149980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88008d149a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88008d149a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================