================================================================== BUG: KASAN: use-after-free in nf_hook_entries_get_hook_ops include/linux/netfilter.h:124 [inline] BUG: KASAN: use-after-free in hooks_validate+0x106/0x120 net/netfilter/core.c:171 Read of size 2 at addr ffff888026465e00 by task syz-executor.2/14065 CPU: 1 PID: 14065 Comm: syz-executor.2 Not tainted 5.13.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436 nf_hook_entries_get_hook_ops include/linux/netfilter.h:124 [inline] hooks_validate+0x106/0x120 net/netfilter/core.c:171 __nf_register_net_hook+0x18c/0x610 net/netfilter/core.c:416 nf_register_net_hook+0x114/0x170 net/netfilter/core.c:541 nf_register_net_hooks+0x59/0xc0 net/netfilter/core.c:557 nf_synproxy_ipv6_init+0x85/0xe0 net/netfilter/nf_synproxy_core.c:1219 synproxy_tg6_check+0x35e/0x550 net/ipv6/netfilter/ip6t_SYNPROXY.c:81 xt_check_target+0x26c/0x9e0 net/netfilter/x_tables.c:1024 check_target net/ipv6/netfilter/ip6_tables.c:529 [inline] find_check_entry.constprop.0+0x7f1/0x9e0 net/ipv6/netfilter/ip6_tables.c:572 translate_table+0xc8b/0x1750 net/ipv6/netfilter/ip6_tables.c:734 do_replace net/ipv6/netfilter/ip6_tables.c:1152 [inline] do_ip6t_set_ctl+0x56e/0xb90 net/ipv6/netfilter/ip6_tables.c:1638 nf_setsockopt+0x83/0xe0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x122/0x180 net/ipv6/ipv6_sockglue.c:1008 rawv6_setsockopt+0xd8/0x690 net/ipv6/raw.c:1081 __sys_setsockopt+0x2db/0x610 net/socket.c:2104 __do_sys_setsockopt net/socket.c:2115 [inline] __se_sys_setsockopt net/socket.c:2112 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2112 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f236be4f188 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000004 RBP: 00000000004bfcb9 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000020000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 0000000000a9fb1f R14: 00007f236be4f300 R15: 0000000000022000 Allocated by task 14065: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc mm/kasan/common.c:507 [inline] ____kasan_kmalloc mm/kasan/common.c:466 [inline] __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:587 kvmalloc include/linux/mm.h:804 [inline] kvzalloc include/linux/mm.h:812 [inline] allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x140/0x780 net/netfilter/core.c:128 __nf_register_net_hook+0x135/0x610 net/netfilter/core.c:407 nf_register_net_hook+0x114/0x170 net/netfilter/core.c:541 nf_register_net_hooks+0x59/0xc0 net/netfilter/core.c:557 nf_synproxy_ipv6_init+0x85/0xe0 net/netfilter/nf_synproxy_core.c:1219 synproxy_tg6_check+0x35e/0x550 net/ipv6/netfilter/ip6t_SYNPROXY.c:81 xt_check_target+0x26c/0x9e0 net/netfilter/x_tables.c:1024 check_target net/ipv6/netfilter/ip6_tables.c:529 [inline] find_check_entry.constprop.0+0x7f1/0x9e0 net/ipv6/netfilter/ip6_tables.c:572 translate_table+0xc8b/0x1750 net/ipv6/netfilter/ip6_tables.c:734 do_replace net/ipv6/netfilter/ip6_tables.c:1152 [inline] do_ip6t_set_ctl+0x56e/0xb90 net/ipv6/netfilter/ip6_tables.c:1638 nf_setsockopt+0x83/0xe0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x122/0x180 net/ipv6/ipv6_sockglue.c:1008 rawv6_setsockopt+0xd8/0x690 net/ipv6/raw.c:1081 __sys_setsockopt+0x2db/0x610 net/socket.c:2104 __do_sys_setsockopt net/socket.c:2115 [inline] __se_sys_setsockopt net/socket.c:2112 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2112 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 8470: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] slab_free_hook mm/slub.c:1583 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1608 slab_free mm/slub.c:3168 [inline] kfree+0xe5/0x7f0 mm/slub.c:4212 kvfree+0x42/0x50 mm/util.c:616 rcu_do_batch kernel/rcu/tree.c:2558 [inline] rcu_core+0x7ab/0x13b0 kernel/rcu/tree.c:2793 __do_softirq+0x29b/0x9f6 kernel/softirq.c:559 Last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:3038 [inline] call_rcu+0xb1/0x750 kernel/rcu/tree.c:3113 nf_hook_entries_free net/netfilter/core.c:88 [inline] nf_hook_entries_free net/netfilter/core.c:75 [inline] __nf_register_net_hook+0x2aa/0x610 net/netfilter/core.c:424 nf_register_net_hook+0x114/0x170 net/netfilter/core.c:541 nf_register_net_hooks+0x59/0xc0 net/netfilter/core.c:557 nf_synproxy_ipv6_init+0x85/0xe0 net/netfilter/nf_synproxy_core.c:1219 synproxy_tg6_check+0x35e/0x550 net/ipv6/netfilter/ip6t_SYNPROXY.c:81 xt_check_target+0x26c/0x9e0 net/netfilter/x_tables.c:1024 check_target net/ipv6/netfilter/ip6_tables.c:529 [inline] find_check_entry.constprop.0+0x7f1/0x9e0 net/ipv6/netfilter/ip6_tables.c:572 translate_table+0xc8b/0x1750 net/ipv6/netfilter/ip6_tables.c:734 do_replace net/ipv6/netfilter/ip6_tables.c:1152 [inline] do_ip6t_set_ctl+0x56e/0xb90 net/ipv6/netfilter/ip6_tables.c:1638 nf_setsockopt+0x83/0xe0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x122/0x180 net/ipv6/ipv6_sockglue.c:1008 rawv6_setsockopt+0xd8/0x690 net/ipv6/raw.c:1081 __sys_setsockopt+0x2db/0x610 net/socket.c:2104 __do_sys_setsockopt net/socket.c:2115 [inline] __se_sys_setsockopt net/socket.c:2112 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2112 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345 insert_work+0x48/0x370 kernel/workqueue.c:1332 __queue_work+0x5c1/0xed0 kernel/workqueue.c:1498 queue_work_on+0xee/0x110 kernel/workqueue.c:1525 queue_work include/linux/workqueue.h:507 [inline] call_usermodehelper_exec+0x1f0/0x4c0 kernel/umh.c:435 kobject_uevent_env+0xf95/0x1650 lib/kobject_uevent.c:618 __kobject_del+0x16c/0x200 lib/kobject.c:617 kobject_cleanup lib/kobject.c:696 [inline] kobject_release lib/kobject.c:736 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2b6/0x540 lib/kobject.c:753 netdev_queue_update_kobjects+0x30a/0x450 net/core/net-sysfs.c:1670 remove_queue_kobjects net/core/net-sysfs.c:1767 [inline] netdev_unregister_kobject+0x15b/0x1f0 net/core/net-sysfs.c:1917 unregister_netdevice_many+0xd21/0x1790 net/core/dev.c:11052 unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:10959 unregister_netdevice include/linux/netdevice.h:2969 [inline] _cfg80211_unregister_wdev+0x485/0x740 net/wireless/core.c:1141 ieee80211_if_remove+0x1df/0x380 net/mac80211/iface.c:2022 ieee80211_del_iface+0x12/0x20 net/mac80211/cfg.c:144 rdev_del_virtual_intf net/wireless/rdev-ops.h:57 [inline] cfg80211_destroy_ifaces+0x302/0x840 net/wireless/core.c:354 cfg80211_destroy_iface_wk+0x1a/0x20 net/wireless/core.c:368 process_one_work+0x98d/0x1600 kernel/workqueue.c:2276 worker_thread+0x64c/0x1120 kernel/workqueue.c:2422 kthread+0x3b1/0x4a0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 The buggy address belongs to the object at ffff888026465e00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes inside of 192-byte region [ffff888026465e00, ffff888026465ec0) The buggy address belongs to the page: page:ffffea0000991940 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26465 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00009d1ac0 0000000800000008 ffff888011041a00 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 18302812795, free_ts 17015246604 prep_new_page mm/page_alloc.c:2358 [inline] get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1646 [inline] allocate_slab+0x2c5/0x4c0 mm/slub.c:1786 new_slab mm/slub.c:1849 [inline] new_slab_objects mm/slub.c:2595 [inline] ___slab_alloc+0x4a1/0x810 mm/slub.c:2758 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2798 slab_alloc_node mm/slub.c:2880 [inline] slab_alloc mm/slub.c:2922 [inline] __kmalloc+0x315/0x330 mm/slub.c:4050 kmalloc_array include/linux/slab.h:596 [inline] kcalloc include/linux/slab.h:625 [inline] ima_alloc_init_template+0x199/0x750 security/integrity/ima/ima_api.c:55 ima_store_measurement+0x1d7/0x5a0 security/integrity/ima/ima_api.c:326 process_measurement+0x11fb/0x17e0 security/integrity/ima/ima_main.c:338 ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:499 do_open fs/namei.c:3363 [inline] path_openat+0x15b5/0x27e0 fs/namei.c:3494 do_filp_open+0x190/0x3d0 fs/namei.c:3521 do_sys_openat2+0x16d/0x420 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_open fs/open.c:1211 [inline] __se_sys_open fs/open.c:1207 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1207 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1298 [inline] free_pcp_prepare+0x223/0x300 mm/page_alloc.c:1342 free_unref_page_prepare mm/page_alloc.c:3250 [inline] free_unref_page+0x12/0x1d0 mm/page_alloc.c:3298 kasan_depopulate_vmalloc_pte+0x5c/0x70 mm/kasan/shadow.c:369 apply_to_pte_range mm/memory.c:2436 [inline] apply_to_pmd_range mm/memory.c:2480 [inline] apply_to_pud_range mm/memory.c:2516 [inline] apply_to_p4d_range mm/memory.c:2552 [inline] __apply_to_page_range+0x69a/0x1050 mm/memory.c:2586 kasan_release_vmalloc+0xa7/0xc0 mm/kasan/shadow.c:479 __purge_vmap_area_lazy+0x8f9/0x1c50 mm/vmalloc.c:1652 _vm_unmap_aliases.part.0+0x3dd/0x4f0 mm/vmalloc.c:2055 _vm_unmap_aliases mm/vmalloc.c:2029 [inline] vm_unmap_aliases+0x47/0x50 mm/vmalloc.c:2078 change_page_attr_set_clr+0x241/0x500 arch/x86/mm/pat/set_memory.c:1740 change_page_attr_set arch/x86/mm/pat/set_memory.c:1790 [inline] set_memory_nx+0xb2/0x110 arch/x86/mm/pat/set_memory.c:1938 free_init_pages+0x73/0xc0 arch/x86/mm/init.c:887 kernel_init+0x17/0x1b8 init/main.c:1453 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Memory state around the buggy address: ffff888026465d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888026465d80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888026465e00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888026465e80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888026465f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================