================================================================== BUG: KASAN: use-after-free in nft_commit_release net/netfilter/nf_tables_api.c:8467 [inline] BUG: KASAN: use-after-free in nf_tables_trans_destroy_work+0xeb5/0xf40 net/netfilter/nf_tables_api.c:8513 Read of size 1 at addr ffff88807e1d3554 by task kworker/1:2/145 CPU: 1 PID: 145 Comm: kworker/1:2 Not tainted 6.0.0-syzkaller-07994-ge8bc52cb8df8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Workqueue: events nf_tables_trans_destroy_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x220 mm/kasan/report.c:433 kasan_report+0xfb/0x130 mm/kasan/report.c:495 nft_commit_release net/netfilter/nf_tables_api.c:8467 [inline] nf_tables_trans_destroy_work+0xeb5/0xf40 net/netfilter/nf_tables_api.c:8513 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 25699: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x97/0x310 mm/slub.c:3289 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] nf_tables_addchain net/netfilter/nf_tables_api.c:2257 [inline] nf_tables_newchain+0x1487/0x30b0 net/netfilter/nf_tables_api.c:2595 nfnetlink_rcv_batch net/netfilter/nfnetlink.c:517 [inline] nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:638 [inline] nfnetlink_rcv+0x1231/0x2640 net/netfilter/nfnetlink.c:656 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x7e7/0x9c0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x9b3/0xcd0 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg net/socket.c:734 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2482 ___sys_sendmsg net/socket.c:2536 [inline] __sys_sendmsg+0x28e/0x390 net/socket.c:2565 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 25698: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kfree+0xda/0x210 mm/slub.c:4567 __nft_release_table+0xc88/0xea0 net/netfilter/nf_tables_api.c:9996 nft_rcv_nl_event+0x48b/0x570 net/netfilter/nf_tables_api.c:10047 notifier_call_chain kernel/notifier.c:87 [inline] blocking_notifier_call_chain+0x108/0x1b0 kernel/notifier.c:382 netlink_release+0xf0a/0x1720 net/netlink/af_netlink.c:790 __sock_release net/socket.c:650 [inline] sock_close+0xd7/0x260 net/socket.c:1365 __fput+0x3ba/0x880 fs/file_table.c:320 task_work_run+0x146/0x1c0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:169 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348 kvfree_call_rcu+0x118/0x8c0 kernel/rcu/tree.c:3341 drop_sysctl_table+0x31c/0x460 fs/proc/proc_sysctl.c:1716 unregister_sysctl_table+0x87/0x140 fs/proc/proc_sysctl.c:1754 devinet_exit_net+0x69/0x230 net/ipv4/devinet.c:2751 ops_exit_list net/core/net_namespace.c:162 [inline] cleanup_net+0x758/0xc50 net/core/net_namespace.c:594 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348 kvfree_call_rcu+0x118/0x8c0 kernel/rcu/tree.c:3341 drop_sysctl_table+0x31c/0x460 fs/proc/proc_sysctl.c:1716 unregister_sysctl_table+0x87/0x140 fs/proc/proc_sysctl.c:1754 devinet_exit_net+0x69/0x230 net/ipv4/devinet.c:2751 ops_exit_list net/core/net_namespace.c:162 [inline] cleanup_net+0x758/0xc50 net/core/net_namespace.c:594 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88807e1d3500 which belongs to the cache kmalloc-cg-128 of size 128 The buggy address is located 84 bytes inside of 128-byte region [ffff88807e1d3500, ffff88807e1d3580) The buggy address belongs to the physical page: page:ffffea0001f874c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e1d3 memcg:ffff888079bc0401 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000001 ffff888012042a00 raw: 0000000000000000 0000000080100010 00000001ffffffff ffff888079bc0401 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 3719, tgid 3719 (syz-executor.1), ts 159609599060, free_ts 159601648529 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0x70/0xf0 mm/slub.c:1829 allocate_slab+0x5e/0x520 mm/slub.c:1974 new_slab mm/slub.c:2034 [inline] ___slab_alloc+0x42e/0xce0 mm/slub.c:3036 __slab_alloc mm/slub.c:3123 [inline] slab_alloc_node mm/slub.c:3214 [inline] __kmalloc_node+0x2cd/0x420 mm/slub.c:4473 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:613 kvmalloc include/linux/slab.h:750 [inline] kvzalloc include/linux/slab.h:758 [inline] allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x345/0x790 net/netfilter/core.c:128 __nf_register_net_hook+0x287/0x8f0 net/netfilter/core.c:423 nf_register_net_hook+0xaa/0x180 net/netfilter/core.c:566 nf_register_net_hooks+0x4b/0x1d0 net/netfilter/core.c:582 ebt_register_table+0xe8e/0x11b0 net/bridge/netfilter/ebtables.c:1272 find_inlist_lock_noload+0x19d/0x2f0 net/bridge/netfilter/ebtables.c:343 find_inlist_lock net/bridge/netfilter/ebtables.c:370 [inline] find_table_lock net/bridge/netfilter/ebtables.c:379 [inline] do_ebt_get_ctl+0x3ca/0x2eb0 net/bridge/netfilter/ebtables.c:2463 nf_getsockopt+0x2ab/0x2d0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x22e/0x340 net/ipv4/ip_sockglue.c:1796 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x7d/0x630 mm/page_alloc.c:3476 free_slab mm/slub.c:2073 [inline] discard_slab mm/slub.c:2079 [inline] __unfreeze_partials+0x1ab/0x200 mm/slub.c:2553 put_cpu_partial+0x116/0x180 mm/slub.c:2629 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slub.c:3248 [inline] slab_alloc mm/slub.c:3256 [inline] __kmem_cache_alloc_lru mm/slub.c:3263 [inline] kmem_cache_alloc_lru+0x175/0x2d0 mm/slub.c:3280 alloc_inode_sb include/linux/fs.h:3107 [inline] sock_alloc_inode+0x21/0xc0 net/socket.c:304 alloc_inode fs/inode.c:259 [inline] new_inode_pseudo+0x61/0x1d0 fs/inode.c:1018 sock_alloc net/socket.c:627 [inline] __sock_create+0x12b/0x850 net/socket.c:1479 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket+0x137/0x3a0 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88807e1d3400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc ffff88807e1d3480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807e1d3500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807e1d3580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807e1d3600: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ==================================================================