================================================================== 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 ffff88803b3acf00 by task syz-executor.0/10136 CPU: 0 PID: 10136 Comm: syz-executor.0 Not tainted 5.13.0-rc6-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/0x2c6 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:1214 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:2117 __do_sys_setsockopt net/socket.c:2128 [inline] __se_sys_setsockopt net/socket.c:2125 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125 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:00007f2267615188 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: 00007ffcd840cb9f R14: 00007f2267615300 R15: 0000000000022000 Allocated by task 10136: 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+0x98/0xc0 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:1214 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:2117 __do_sys_setsockopt net/socket.c:2128 [inline] __se_sys_setsockopt net/socket.c:2125 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 19397: 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+0xcd/0x100 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x106/0x2c0 mm/slab.c:3803 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+0xa4/0xd0 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:1214 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:2117 __do_sys_setsockopt net/socket.c:2128 [inline] __se_sys_setsockopt net/socket.c:2125 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125 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+0xa4/0xd0 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_unregister_net_hook+0x36f/0x610 net/netfilter/core.c:489 nf_unregister_net_hook net/netfilter/core.c:502 [inline] nf_unregister_net_hooks+0x117/0x160 net/netfilter/core.c:576 nf_synproxy_ipv6_fini net/netfilter/nf_synproxy_core.c:1230 [inline] nf_synproxy_ipv6_fini+0x71/0x90 net/netfilter/nf_synproxy_core.c:1226 synproxy_tg6_destroy+0x1cf/0x360 net/ipv6/netfilter/ip6t_SYNPROXY.c:94 cleanup_entry+0x245/0x340 net/ipv6/netfilter/ip6_tables.c:670 do_replace net/ipv6/netfilter/ip6_tables.c:1164 [inline] do_ip6t_set_ctl+0x984/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:2117 __do_sys_setsockopt net/socket.c:2128 [inline] __se_sys_setsockopt net/socket.c:2125 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2125 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88803b3acf00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes inside of 192-byte region [ffff88803b3acf00, ffff88803b3acfc0) The buggy address belongs to the page: page:ffffea0000eceb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3b3ac flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000919c08 ffffea0001fd5048 ffff888011040000 raw: 0000000000000000 ffff88803b3ac000 0000000100000010 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 19421, ts 1285631461094, free_ts 1285584442623 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_node include/linux/gfp.h:549 [inline] kmem_getpages mm/slab.c:1377 [inline] cache_grow_begin+0x75/0x460 mm/slab.c:2593 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965 ____cache_alloc mm/slab.c:3048 [inline] ____cache_alloc mm/slab.c:3031 [inline] __do_cache_alloc mm/slab.c:3275 [inline] slab_alloc mm/slab.c:3316 [inline] kmem_cache_alloc_trace+0x3a2/0x480 mm/slab.c:3573 kmalloc include/linux/slab.h:556 [inline] netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:642 [inline] netdevice_event+0x1ab/0x830 drivers/infiniband/core/roce_gid_mgmt.c:801 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2121 call_netdevice_notifiers_extack net/core/dev.c:2133 [inline] call_netdevice_notifiers net/core/dev.c:2147 [inline] __dev_notify_flags+0x110/0x2b0 net/core/dev.c:8798 dev_change_flags+0x112/0x170 net/core/dev.c:8836 do_setlink+0x90a/0x3af0 net/core/rtnetlink.c:2717 __rtnl_newlink+0xdcf/0x1710 net/core/rtnetlink.c:3385 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5564 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 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 __vunmap+0x783/0xb60 mm/vmalloc.c:2566 free_work+0x58/0x70 mm/vmalloc.c:80 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 Memory state around the buggy address: ffff88803b3ace00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88803b3ace80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803b3acf00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803b3acf80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88803b3ad000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================