syzbot


KASAN: use-after-free Read in __nft_trace_packet

Status: upstream: reported C repro on 2024/09/14 00:31
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+2a8850ea36efb12f5aed@syzkaller.appspotmail.com
First crash: 22d, last: 3d20h
Bug presence (1)
Date Name Commit Repro Result
2024/09/24 upstream (ToT) 68e5c7d4cefb C [report] INFO: rcu detected stall in corrupted

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __nft_trace_packet+0x137/0x150 net/netfilter/nf_tables_core.c:30
Read of size 2 at addr ffff88807d8811c0 by task ksoftirqd/1/20

CPU: 1 PID: 20 Comm: ksoftirqd/1 Not tainted 5.15.167-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 __nft_trace_packet+0x137/0x150 net/netfilter/nf_tables_core.c:30
 nft_trace_verdict net/netfilter/nf_tables_core.c:110 [inline]
 nft_do_chain+0x1453/0x16b0 net/netfilter/nf_tables_core.c:256
 nft_do_chain_inet+0x3f8/0x680 net/netfilter/nft_chain_filter.c:161
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x26b/0x410 include/linux/netfilter.h:300
 NF_HOOK+0x364/0x410 include/linux/netfilter.h:302
 __netif_receive_skb_one_core net/core/dev.c:5485 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5599
 process_backlog+0x363/0x7f0 net/core/dev.c:6476
 __napi_poll+0xc7/0x440 net/core/dev.c:7035
 napi_poll net/core/dev.c:7102 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7192
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 20:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 kmem_cache_alloc_node+0x121/0x2c0 mm/slub.c:3256
 __alloc_skb+0xdd/0x590 net/core/skbuff.c:415
 alloc_skb include/linux/skbuff.h:1167 [inline]
 synproxy_send_client_synack+0x1b6/0xf20 net/netfilter/nf_synproxy_core.c:482
 nft_synproxy_eval_v4+0x3c6/0x610 net/netfilter/nft_synproxy.c:59
 nft_synproxy_do_eval+0x359/0xa60 net/netfilter/nft_synproxy.c:141
 expr_call_ops_eval net/netfilter/nf_tables_core.c:198 [inline]
 nft_do_chain+0x467/0x16b0 net/netfilter/nf_tables_core.c:238
 nft_do_chain_inet+0x3f8/0x680 net/netfilter/nft_chain_filter.c:161
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x26b/0x410 include/linux/netfilter.h:300
 NF_HOOK+0x364/0x410 include/linux/netfilter.h:302
 __netif_receive_skb_one_core net/core/dev.c:5485 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5599
 process_backlog+0x363/0x7f0 net/core/dev.c:6476
 __napi_poll+0xc7/0x440 net/core/dev.c:7035
 napi_poll net/core/dev.c:7102 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7192
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 20:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 nft_synproxy_eval_v4+0x3ce/0x610 net/netfilter/nft_synproxy.c:60
 nft_synproxy_do_eval+0x359/0xa60 net/netfilter/nft_synproxy.c:141
 expr_call_ops_eval net/netfilter/nf_tables_core.c:198 [inline]
 nft_do_chain+0x467/0x16b0 net/netfilter/nf_tables_core.c:238
 nft_do_chain_inet+0x3f8/0x680 net/netfilter/nft_chain_filter.c:161
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x26b/0x410 include/linux/netfilter.h:300
 NF_HOOK+0x364/0x410 include/linux/netfilter.h:302
 __netif_receive_skb_one_core net/core/dev.c:5485 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5599
 process_backlog+0x363/0x7f0 net/core/dev.c:6476
 __napi_poll+0xc7/0x440 net/core/dev.c:7035
 napi_poll net/core/dev.c:7102 [inline]
 net_rx_action+0x617/0xda0 net/core/dev.c:7192
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88807d881140
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 128 bytes inside of
 232-byte region [ffff88807d881140, ffff88807d881228)
The buggy address belongs to the page:
page:ffffea0001f62040 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d881
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888144bf2140
raw: 0000000000000000 00000000000c000c 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 3038, ts 21560678733, free_ts 21546722862
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 kmem_cache_alloc_node+0x1ba/0x2c0 mm/slub.c:3256
 __alloc_skb+0xdd/0x590 net/core/skbuff.c:415
 alloc_skb include/linux/skbuff.h:1167 [inline]
 alloc_skb_with_frags+0xa3/0x780 net/core/skbuff.c:6170
 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2530
 unix_dgram_sendmsg+0x6fd/0x2090 net/unix/af_unix.c:1798
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 sock_write_iter+0x39b/0x530 net/socket.c:1079
 call_write_iter include/linux/fs.h:2172 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacd/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 lsm_inode_alloc security/security.c:595 [inline]
 security_inode_alloc+0x24/0x110 security/security.c:1033
 inode_init_always+0x939/0xc70 fs/inode.c:207
 alloc_inode fs/inode.c:243 [inline]
 iget_locked+0x212/0x7f0 fs/inode.c:1279
 kernfs_get_inode+0x4c/0x6b0 fs/kernfs/inode.c:250
 kernfs_iop_lookup+0x1d7/0x2f0 fs/kernfs/dir.c:1143
 __lookup_slow+0x275/0x3d0 fs/namei.c:1663
 lookup_slow+0x53/0x70 fs/namei.c:1680
 walk_component+0x48c/0x610 fs/namei.c:1976

Memory state around the buggy address:
 ffff88807d881080: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff88807d881100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>ffff88807d881180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88807d881200: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff88807d881280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/24 01:43 linux-5.15.y 3a5928702e71 89298aad .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/10/03 03:42 linux-5.15.y 3a5928702e71 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/10/03 03:34 linux-5.15.y 3a5928702e71 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/28 10:31 linux-5.15.y 3a5928702e71 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/28 10:31 linux-5.15.y 3a5928702e71 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/24 14:42 linux-5.15.y 3a5928702e71 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/24 14:41 linux-5.15.y 3a5928702e71 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/23 10:39 linux-5.15.y 3a5928702e71 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/23 10:39 linux-5.15.y 3a5928702e71 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/23 10:39 linux-5.15.y 3a5928702e71 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/14 21:01 linux-5.15.y 3a5928702e71 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/14 20:51 linux-5.15.y 3a5928702e71 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/09/14 00:31 linux-5.15.y 3a5928702e71 b58f933c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __nft_trace_packet
2024/10/01 12:24 linux-5.15.y 3a5928702e71 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in __nft_trace_packet
2024/10/01 12:24 linux-5.15.y 3a5928702e71 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in __nft_trace_packet
* Struck through repros no longer work on HEAD.