syzbot


KASAN: slab-out-of-bounds Read in ipv4_get_l4proto

Status: auto-closed as invalid on 2022/08/05 01:53
Subsystems: netfilter
[Documentation on labels]
First crash: 692d, last: 692d

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ipv4_get_l4proto+0x302/0x390 net/netfilter/nf_conntrack_core.c:370
Read of size 1 at addr ffff88814c10fffa by task syz-executor.2/4216

CPU: 0 PID: 4216 Comm: syz-executor.2 Not tainted 5.18.0-rc5-syzkaller-00163-g4b97bac0756a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313
 print_report mm/kasan/report.c:429 [inline]
 kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
 ipv4_get_l4proto+0x302/0x390 net/netfilter/nf_conntrack_core.c:370
 get_l4proto net/netfilter/nf_conntrack_core.c:416 [inline]
 nf_conntrack_in+0x1146/0x16f0 net/netfilter/nf_conntrack_core.c:1940
 ipv4_conntrack_local+0x11c/0x260 net/netfilter/nf_conntrack_proto.c:213
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xc5/0x1f0 net/netfilter/core.c:620
 nf_hook+0x1cb/0x5b0 include/linux/netfilter.h:262
 __ip_local_out+0x262/0x520 net/ipv4/ip_output.c:115
 ip_local_out+0x26/0x1a0 net/ipv4/ip_output.c:124
 iptunnel_xmit+0x68c/0xa50 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x10e7/0x2c00 net/ipv4/ip_tunnel.c:811
 ipip_tunnel_xmit+0x40b/0x500 net/ipv4/ipip.c:307
 __netdev_start_xmit include/linux/netdevice.h:4775 [inline]
 netdev_start_xmit include/linux/netdevice.h:4789 [inline]
 xmit_one net/core/dev.c:3532 [inline]
 dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3548
 __dev_queue_xmit+0x2b00/0x3920 net/core/dev.c:4176
 neigh_connected_output+0x3b6/0x510 net/core/neighbour.c:1557
 neigh_output include/net/neighbour.h:549 [inline]
 ip_finish_output2+0x782/0x2170 net/ipv4/ip_output.c:228
 __ip_finish_output net/ipv4/ip_output.c:306 [inline]
 __ip_finish_output+0x396/0x650 net/ipv4/ip_output.c:288
 ip_finish_output+0x32/0x280 net/ipv4/ip_output.c:316
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip_output+0x196/0x310 net/ipv4/ip_output.c:430
 dst_output include/net/dst.h:451 [inline]
 ip_local_out+0xaf/0x1a0 net/ipv4/ip_output.c:126
 iptunnel_xmit+0x68c/0xa50 net/ipv4/ip_tunnel_core.c:82
 ip_tunnel_xmit+0x10e7/0x2c00 net/ipv4/ip_tunnel.c:811
 ipgre_xmit+0x719/0x940 net/ipv4/ip_gre.c:657
 __netdev_start_xmit include/linux/netdevice.h:4775 [inline]
 netdev_start_xmit include/linux/netdevice.h:4789 [inline]
 xmit_one net/core/dev.c:3532 [inline]
 dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3548
 __dev_queue_xmit+0x2b00/0x3920 net/core/dev.c:4176
 __bpf_tx_skb net/core/filter.c:2113 [inline]
 __bpf_redirect_no_mac net/core/filter.c:2138 [inline]
 __bpf_redirect+0x83f/0xe60 net/core/filter.c:2161
 ____bpf_clone_redirect net/core/filter.c:2428 [inline]
 bpf_clone_redirect+0x2ae/0x420 net/core/filter.c:2400
 ___bpf_prog_run+0x3592/0x77d0 kernel/bpf/core.c:1835
 __bpf_prog_run512+0x91/0xd0 kernel/bpf/core.c:2064
 bpf_dispatcher_nop_func include/linux/bpf.h:804 [inline]
 __bpf_prog_run include/linux/filter.h:628 [inline]
 bpf_prog_run include/linux/filter.h:635 [inline]
 bpf_test_run+0x381/0x9c0 net/bpf/test_run.c:402
 bpf_prog_test_run_skb+0xb67/0x1e20 net/bpf/test_run.c:1111
 bpf_prog_test_run kernel/bpf/syscall.c:3369 [inline]
 __sys_bpf+0x183c/0x55d0 kernel/bpf/syscall.c:4681
 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4765 [inline]
 __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4765
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fe987c890e9
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe988da2168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fe987d9c100 RCX: 00007fe987c890e9
RDX: 0000000000000048 RSI: 0000000020000080 RDI: 000000000000000a
RBP: 00007fe987ce308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffb485f54f R14: 00007fe988da2300 R15: 0000000000022000
 </TASK>

Allocated by task 1:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc mm/kasan/common.c:515 [inline]
 ____kasan_kmalloc mm/kasan/common.c:474 [inline]
 __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524
 kmalloc_node include/linux/slab.h:604 [inline]
 alloc_arraycache mm/slab.c:539 [inline]
 setup_kmem_cache_node+0x12f/0x3d0 mm/slab.c:900
 setup_kmem_cache_nodes mm/slab.c:3825 [inline]
 do_tune_cpucache+0x158/0x240 mm/slab.c:3895
 enable_cpucache+0x3c/0xa0 mm/slab.c:3952
 __kmem_cache_create+0x1b8/0x250 mm/slab.c:2084
 create_cache mm/slab_common.c:257 [inline]
 kmem_cache_create_usercopy+0x1bf/0x2d0 mm/slab_common.c:359
 kmem_cache_create+0xd/0x10 mm/slab_common.c:414
 ccid_kmem_cache_create+0xd3/0x10a net/dccp/ccid.c:88
 ccid_activate net/dccp/ccid.c:103 [inline]
 ccid_initialize_builtins+0xb3/0x37c net/dccp/ccid.c:199
 dccp_init+0x4a2/0x5aa net/dccp/proto.c:1197
 do_one_initcall+0x103/0x650 init/main.c:1298
 do_initcall_level init/main.c:1371 [inline]
 do_initcalls init/main.c:1387 [inline]
 do_basic_setup init/main.c:1406 [inline]
 kernel_init_freeable+0x6b1/0x73a init/main.c:1613
 kernel_init+0x1a/0x1d0 init/main.c:1502
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88814c10e000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 4090 bytes to the right of
 4096-byte region [ffff88814c10e000, ffff88814c10f000)

The buggy address belongs to the physical page:
page:ffffea0005304380 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14c10e
head:ffffea0005304380 order:1 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 ffffea0005304308 ffffea0005304408 ffff888010c40900
raw: 0000000000000000 ffff88814c10e000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1, tgid 1 (swapper/0), ts 11163046216, free_ts 0
 prep_new_page mm/page_alloc.c:2441 [inline]
 get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408
 __alloc_pages_node include/linux/gfp.h:587 [inline]
 kmem_getpages mm/slab.c:1378 [inline]
 cache_grow_begin+0x75/0x350 mm/slab.c:2584
 ____cache_alloc_node+0x171/0x1d0 mm/slab.c:3193
 slab_alloc_node mm/slab.c:3246 [inline]
 kmem_cache_alloc_node_trace+0x187/0x5b0 mm/slab.c:3625
 __do_kmalloc_node mm/slab.c:3647 [inline]
 __kmalloc_node+0x38/0x60 mm/slab.c:3655
 kmalloc_node include/linux/slab.h:604 [inline]
 alloc_arraycache mm/slab.c:539 [inline]
 setup_kmem_cache_node+0x12f/0x3d0 mm/slab.c:900
 setup_kmem_cache_nodes mm/slab.c:3825 [inline]
 do_tune_cpucache+0x158/0x240 mm/slab.c:3895
 enable_cpucache+0x3c/0xa0 mm/slab.c:3952
 __kmem_cache_create+0x1b8/0x250 mm/slab.c:2084
 create_cache mm/slab_common.c:257 [inline]
 kmem_cache_create_usercopy+0x1bf/0x2d0 mm/slab_common.c:359
 kmem_cache_create+0xd/0x10 mm/slab_common.c:414
 ccid_kmem_cache_create+0xd3/0x10a net/dccp/ccid.c:88
 ccid_activate net/dccp/ccid.c:103 [inline]
 ccid_initialize_builtins+0xb3/0x37c net/dccp/ccid.c:199
 dccp_init+0x4a2/0x5aa net/dccp/proto.c:1197
 do_one_initcall+0x103/0x650 init/main.c:1298
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88814c10fe80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88814c10ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88814c10ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                                ^
 ffff88814c110000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88814c110080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/05/07 01:47 upstream 4b97bac0756a e60b1103 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: slab-out-of-bounds Read in ipv4_get_l4proto
* Struck through repros no longer work on HEAD.