================================================================== BUG: KASAN: use-after-free in fanout_demux_rollover+0x49b/0x4d0 net/packet/af_packet.c:1387 at addr ffff8801c42a0738 Read of size 8 by task swapper/0/0 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.47-g6cd2127 #39 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801db2077e0 ffffffff81d93049 ffff8801da002000 ffff8801c42a0000 ffff8801c42a0800 ffffed00388540e7 ffff8801c42a0738 ffff8801db207808 ffffffff8153cbcc ffffed00388540e7 ffff8801da002000 0000000000000000 Call Trace: [ 30.497607] [] __dump_stack lib/dump_stack.c:15 [inline] [ 30.497607] [] dump_stack+0xc1/0x128 lib/dump_stack.c:51 [] kasan_object_err+0x1c/0x70 mm/kasan/report.c:160 [] print_address_description mm/kasan/report.c:198 [inline] [] kasan_report_error mm/kasan/report.c:287 [inline] [] kasan_report.part.1+0x21c/0x500 mm/kasan/report.c:309 [] kasan_report mm/kasan/report.c:330 [inline] [] __asan_report_load8_noabort+0x29/0x30 mm/kasan/report.c:330 [] fanout_demux_rollover+0x49b/0x4d0 net/packet/af_packet.c:1387 [] packet_rcv_fanout+0x3e6/0x620 net/packet/af_packet.c:1473 [] deliver_skb net/core/dev.c:1834 [inline] [] deliver_ptype_list_skb net/core/dev.c:1849 [inline] [] __netif_receive_skb_core+0x887/0x29e0 net/core/dev.c:4220 [] __netif_receive_skb+0x5b/0x1c0 net/core/dev.c:4275 [] netif_receive_skb_internal+0xff/0x390 net/core/dev.c:4303 [] napi_skb_finish net/core/dev.c:4661 [inline] [] napi_gro_receive+0x1fb/0x400 net/core/dev.c:4691 [] receive_buf drivers/net/virtio_net.c:508 [inline] [] virtnet_receive+0xe1c/0x1cf0 drivers/net/virtio_net.c:723 [] virtnet_poll+0x26/0x140 drivers/net/virtio_net.c:741 [] napi_poll net/core/dev.c:5197 [inline] [] net_rx_action+0x396/0xe00 net/core/dev.c:5262 [] __do_softirq+0x22d/0x964 kernel/softirq.c:284 [] invoke_softirq kernel/softirq.c:364 [inline] [] irq_exit+0x165/0x190 kernel/softirq.c:405 [] exiting_irq arch/x86/include/asm/apic.h:659 [inline] [] do_IRQ+0x107/0x1b0 arch/x86/kernel/irq.c:251 [] common_interrupt+0x8c/0x8c arch/x86/entry/entry_64.S:520 [ 30.721081] [] ? native_safe_halt+0x6/0x10 arch/x86/include/asm/irqflags.h:53 [] arch_safe_halt arch/x86/include/asm/paravirt.h:103 [inline] [] default_idle+0x55/0x360 arch/x86/kernel/process.c:295 [] arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:286 [] default_idle_call+0x36/0x60 kernel/sched/idle.c:97 [] cpuidle_idle_call kernel/sched/idle.c:155 [inline] [] cpu_idle_loop kernel/sched/idle.c:248 [inline] [] cpu_startup_entry+0x30c/0x3d0 kernel/sched/idle.c:303 [] rest_init+0x184/0x190 init/main.c:408 [] start_kernel+0x679/0x6ae init/main.c:662 [] x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:196 [] x86_64_start_kernel+0x140/0x163 arch/x86/kernel/head64.c:177 Object at ffff8801c42a0000, in cache kmalloc-2048 size: 2048 Allocated: PID = 3417 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:495 set_track mm/kasan/kasan.c:507 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:598 __kmalloc+0x11d/0x310 mm/slub.c:3741 kmalloc include/linux/slab.h:495 [inline] sk_prot_alloc+0x101/0x2a0 net/core/sock.c:1338 sk_alloc+0x3a/0x3a0 net/core/sock.c:1394 packet_create+0xf0/0x8e0 net/packet/af_packet.c:3205 __sock_create+0x3ab/0x640 net/socket.c:1182 sock_create net/socket.c:1222 [inline] SYSC_socket net/socket.c:1252 [inline] SyS_socket+0xf0/0x1b0 net/socket.c:1232 entry_SYSCALL_64_fastpath+0x23/0xc6 Freed: PID = 3419 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:495 set_track mm/kasan/kasan.c:507 [inline] kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:571 slab_free_hook mm/slub.c:1355 [inline] slab_free_freelist_hook mm/slub.c:1377 [inline] slab_free mm/slub.c:2958 [inline] kfree+0xf0/0x2f0 mm/slub.c:3878 sk_prot_free net/core/sock.c:1377 [inline] __sk_destruct+0x47f/0x570 net/core/sock.c:1455 sk_destruct+0x47/0x80 net/core/sock.c:1463 __sk_free+0x57/0x230 net/core/sock.c:1471 sk_free+0x23/0x30 net/core/sock.c:1482 sock_put include/net/sock.h:1592 [inline] packet_release+0x732/0xa20 net/packet/af_packet.c:3041 sock_release+0x8d/0x1e0 net/socket.c:599 sock_close+0x16/0x20 net/socket.c:1046 __fput+0x28c/0x6e0 fs/file_table.c:208 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x115/0x190 kernel/task_work.c:116 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0x82e/0x2a50 kernel/exit.c:833 do_group_exit+0x108/0x320 kernel/exit.c:937 get_signal+0x55c/0x1600 kernel/signal.c:2315 do_signal+0x87/0x1960 arch/x86/kernel/signal.c:807 exit_to_usermode_loop+0xe5/0x130 arch/x86/entry/common.c:156 prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259 entry_SYSCALL_64_fastpath+0xc4/0xc6 Memory state around the buggy address: ffff8801c42a0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c42a0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c42a0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801c42a0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c42a0800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ================================================================== BUG: KASAN: use-after-free in fanout_demux_rollover+0x4bc/0x4d0 net/packet/af_packet.c:1387 at addr ffff8801d13b1a80 Read of size 4 by task swapper/0/0 CPU: 0 PID: 0 Comm: swapper/0 Tainted: G B 4.9.47-g6cd2127 #39 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801db2077e0 ffffffff81d93049 ffff8801da001640 ffff8801d13b1a80 ffff8801d13b1b00 ffffed003a276350 ffff8801d13b1a80 ffff8801db207808 ffffffff8153cbcc ffffed003a276350 ffff8801da001640 0000000000000000 Call Trace: [ 31.050863] [] __dump_stack lib/dump_stack.c:15 [inline] [ 31.050863] [] dump_stack+0xc1/0x128 lib/dump_stack.c:51 [] kasan_object_err+0x1c/0x70 mm/kasan/report.c:160 [] print_address_description mm/kasan/report.c:198 [inline] [] kasan_report_error mm/kasan/report.c:287 [inline] [] kasan_report.part.1+0x21c/0x500 mm/kasan/report.c:309 [] kasan_report mm/kasan/report.c:329 [inline] [] __asan_report_load4_noabort+0x29/0x30 mm/kasan/report.c:329 [] fanout_demux_rollover+0x4bc/0x4d0 net/packet/af_packet.c:1387 [] packet_rcv_fanout+0x3e6/0x620 net/packet/af_packet.c:1473 [] deliver_skb net/core/dev.c:1834 [inline] [] deliver_ptype_list_skb net/core/dev.c:1849 [inline] [] __netif_receive_skb_core+0x887/0x29e0 net/core/dev.c:4220 [] __netif_receive_skb+0x5b/0x1c0 net/core/dev.c:4275 [] netif_receive_skb_internal+0xff/0x390 net/core/dev.c:4303 [] napi_skb_finish net/core/dev.c:4661 [inline] [] napi_gro_receive+0x1fb/0x400 net/core/dev.c:4691 [] receive_buf drivers/net/virtio_net.c:508 [inline] [] virtnet_receive+0xe1c/0x1cf0 drivers/net/virtio_net.c:723 [] virtnet_poll+0x26/0x140 drivers/net/virtio_net.c:741 [] napi_poll net/core/dev.c:5197 [inline] [] net_rx_action+0x396/0xe00 net/core/dev.c:5262 [] __do_softirq+0x22d/0x964 kernel/softirq.c:284 [] invoke_softirq kernel/softirq.c:364 [inline] [] irq_exit+0x165/0x190 kernel/softirq.c:405 [] exiting_irq arch/x86/include/asm/apic.h:659 [inline] [] do_IRQ+0x107/0x1b0 arch/x86/kernel/irq.c:251 [] common_interrupt+0x8c/0x8c arch/x86/entry/entry_64.S:520 [ 31.269126] [] ? native_safe_halt+0x6/0x10 arch/x86/include/asm/irqflags.h:53 [] arch_safe_halt arch/x86/include/asm/paravirt.h:103 [inline] [] default_idle+0x55/0x360 arch/x86/kernel/process.c:295 [] arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:286 [] default_idle_call+0x36/0x60 kernel/sched/idle.c:97 [] cpuidle_idle_call kernel/sched/idle.c:155 [inline] [] cpu_idle_loop kernel/sched/idle.c:248 [inline] [] cpu_startup_entry+0x30c/0x3d0 kernel/sched/idle.c:303 [] rest_init+0x184/0x190 init/main.c:408 [] start_kernel+0x679/0x6ae init/main.c:662 [] x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:196 [] x86_64_start_kernel+0x140/0x163 arch/x86/kernel/head64.c:177 Object at ffff8801d13b1a80, in cache kmalloc-128 size: 128 Allocated: PID = 3417 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:495 set_track mm/kasan/kasan.c:507 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:598 kmem_cache_alloc_trace+0xfb/0x2a0 mm/slub.c:2742 kmalloc include/linux/slab.h:490 [inline] kzalloc include/linux/slab.h:636 [inline] fanout_add net/packet/af_packet.c:1662 [inline] packet_setsockopt+0x181c/0x2240 net/packet/af_packet.c:3789 SYSC_setsockopt net/socket.c:1771 [inline] SyS_setsockopt+0x160/0x250 net/socket.c:1750 entry_SYSCALL_64_fastpath+0x23/0xc6 Freed: PID = 0 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:495 set_track mm/kasan/kasan.c:507 [inline] kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:571 slab_free_hook mm/slub.c:1355 [inline] slab_free_freelist_hook mm/slub.c:1377 [inline] slab_free mm/slub.c:2958 [inline] kfree+0xf0/0x2f0 mm/slub.c:3878 __rcu_reclaim kernel/rcu/rcu.h:113 [inline] rcu_do_batch kernel/rcu/tree.c:2779 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:3043 [inline] __rcu_process_callbacks kernel/rcu/tree.c:3010 [inline] rcu_process_callbacks+0x981/0x12d0 kernel/rcu/tree.c:3027 __do_softirq+0x22d/0x964 kernel/softirq.c:284 Memory state around the buggy address: ffff8801d13b1980: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8801d13b1a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc