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

5 views
Skip to first unread message

syzbot

unread,
Jan 13, 2022, 8:16:22 AM1/13/22
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8134b5063264 Merge branch 'libbpf: rename bpf_prog_attach_..
git tree: bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1011f957b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=322a0a6462d9ff7d
dashboard link: https://syzkaller.appspot.com/bug?extid=9ffdb35e54394ea2ae46
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
CC: [and...@kernel.org a...@kernel.org b...@vger.kernel.org dan...@iogearbox.net da...@davemloft.net ha...@kernel.org john.fa...@gmail.com ka...@fb.com kps...@kernel.org ku...@kernel.org linux-...@vger.kernel.org net...@vger.kernel.org songliu...@fb.com y...@fb.com net...@vger.kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9ffdb3...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in read_pnet include/net/net_namespace.h:361 [inline]
BUG: KASAN: slab-out-of-bounds in dev_net include/linux/netdevice.h:2446 [inline]
BUG: KASAN: slab-out-of-bounds in ____bpf_clone_redirect net/core/filter.c:2409 [inline]
BUG: KASAN: slab-out-of-bounds in bpf_clone_redirect+0x3a5/0x420 net/core/filter.c:2400
Read of size 8 at addr ffff88807e11af5a by task kworker/u4:5/15098

CPU: 1 PID: 15098 Comm: kworker/u4:5 Not tainted 5.16.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: bat_events batadv_bla_periodic_work
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247
__kasan_report mm/kasan/report.c:433 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
read_pnet include/net/net_namespace.h:361 [inline]
dev_net include/linux/netdevice.h:2446 [inline]
____bpf_clone_redirect net/core/filter.c:2409 [inline]
bpf_clone_redirect+0x3a5/0x420 net/core/filter.c:2400
bpf_prog_a481c1313990ee2c+0x56/0x9bc
__bpf_prog_run include/linux/filter.h:626 [inline]
bpf_prog_run_xdp include/linux/filter.h:801 [inline]
bpf_prog_run_generic_xdp+0x522/0x1180 net/core/dev.c:4622
netif_receive_generic_xdp+0x2e5/0x8a0 net/core/dev.c:4708
do_xdp_generic net/core/dev.c:4763 [inline]
do_xdp_generic net/core/dev.c:4756 [inline]
__netif_receive_skb_core+0x11db/0x3850 net/core/dev.c:5171
__netif_receive_skb_one_core+0xae/0x180 net/core/dev.c:5348
__netif_receive_skb+0x24/0x1b0 net/core/dev.c:5464
process_backlog+0x2a5/0x6c0 net/core/dev.c:5796
__napi_poll+0xaf/0x440 net/core/dev.c:6364
napi_poll net/core/dev.c:6431 [inline]
net_rx_action+0x801/0xb40 net/core/dev.c:6518
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
do_softirq.part.0+0xde/0x130 kernel/softirq.c:459
</IRQ>
<TASK>
netif_rx_ni+0x33a/0x590 net/core/dev.c:4858
netif_rx_any_context+0x4e/0x60 net/core/dev.c:4877
batadv_bla_send_claim+0x5b0/0xb70 net/batman-adv/bridge_loop_avoidance.c:446
batadv_bla_send_announce+0x118/0x170 net/batman-adv/bridge_loop_avoidance.c:674
batadv_bla_periodic_work+0x579/0x9f0 net/batman-adv/bridge_loop_avoidance.c:1480
process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 26157:
kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522
kmalloc include/linux/slab.h:590 [inline]
kzalloc include/linux/slab.h:724 [inline]
ieee802_11_parse_elems_crc+0xd5/0x1050 net/mac80211/util.c:1489
ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2228 [inline]
ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1605 [inline]
ieee80211_ibss_rx_queued_mgmt+0xd0e/0x3150 net/mac80211/ibss.c:1639
ieee80211_iface_process_skb net/mac80211/iface.c:1527 [inline]
ieee80211_iface_work+0xa65/0xd00 net/mac80211/iface.c:1581
process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
__kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348
kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550
drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647
unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline]
unregister_sysctl_table+0xc0/0x190 fs/proc/proc_sysctl.c:1660
neigh_sysctl_unregister+0x5b/0x80 net/core/neighbour.c:3806
devinet_sysctl_unregister net/ipv4/devinet.c:2633 [inline]
inetdev_destroy net/ipv4/devinet.c:326 [inline]
inetdev_event+0xd01/0x15d0 net/ipv4/devinet.c:1600
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919
call_netdevice_notifiers_extack net/core/dev.c:1931 [inline]
call_netdevice_notifiers net/core/dev.c:1945 [inline]
unregister_netdevice_many+0x964/0x1850 net/core/dev.c:10408
default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:10938
ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595
process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88807e11a800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 858 bytes to the right of
1024-byte region [ffff88807e11a800, ffff88807e11ac00)
The buggy address belongs to the page:
page:ffffea0001f84600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e118
head:ffffea0001f84600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888010c41dc0
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3605, ts 63661502298, free_ts 63646705959
prep_new_page mm/page_alloc.c:2418 [inline]
get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190
alloc_slab_page mm/slub.c:1793 [inline]
allocate_slab mm/slub.c:1930 [inline]
new_slab+0x32d/0x4a0 mm/slub.c:1993
___slab_alloc+0x918/0xfe0 mm/slub.c:3022
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109
slab_alloc_node mm/slub.c:3200 [inline]
__kmalloc_node_track_caller+0x2cb/0x360 mm/slub.c:4956
kmalloc_reserve net/core/skbuff.c:354 [inline]
__alloc_skb+0xde/0x340 net/core/skbuff.c:426
alloc_skb include/linux/skbuff.h:1130 [inline]
__tcp_send_ack.part.0+0x67/0x760 net/ipv4/tcp_output.c:3930
__tcp_send_ack net/ipv4/tcp_output.c:3962 [inline]
tcp_send_ack+0x7d/0xa0 net/ipv4/tcp_output.c:3962
tcp_cleanup_rbuf+0x46c/0x5b0 net/ipv4/tcp.c:1580
tcp_recvmsg_locked+0x73e/0x1fd0 net/ipv4/tcp.c:2533
tcp_recvmsg+0x137/0x610 net/ipv4/tcp.c:2563
inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:850
sock_recvmsg_nosec net/socket.c:948 [inline]
sock_recvmsg net/socket.c:966 [inline]
sock_recvmsg net/socket.c:962 [inline]
sock_read_iter+0x33c/0x470 net/socket.c:1039
call_read_iter include/linux/fs.h:2156 [inline]
new_sync_read+0x5ba/0x6e0 fs/read_write.c:400
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1338 [inline]
free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389
free_unref_page_prepare mm/page_alloc.c:3309 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3388
skb_free_frag include/linux/skbuff.h:2955 [inline]
skb_free_head net/core/skbuff.c:653 [inline]
skb_release_data+0x61f/0x790 net/core/skbuff.c:677
skb_release_all net/core/skbuff.c:742 [inline]
__kfree_skb+0x46/0x60 net/core/skbuff.c:756
tcp_eat_recv_skb+0x1ed/0x280 net/ipv4/tcp.c:1610
tcp_recvmsg_locked+0x105c/0x1fd0 net/ipv4/tcp.c:2517
tcp_recvmsg+0x137/0x610 net/ipv4/tcp.c:2563
inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:850
sock_recvmsg_nosec net/socket.c:948 [inline]
sock_recvmsg net/socket.c:966 [inline]
sock_recvmsg net/socket.c:962 [inline]
sock_read_iter+0x33c/0x470 net/socket.c:1039
call_read_iter include/linux/fs.h:2156 [inline]
new_sync_read+0x5ba/0x6e0 fs/read_write.c:400
vfs_read+0x35c/0x600 fs/read_write.c:481
ksys_read+0x1ee/0x250 fs/read_write.c:619
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

Memory state around the buggy address:
ffff88807e11ae00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807e11ae80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807e11af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88807e11af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807e11b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 9, 2022, 9:12:19 AM4/9/22
to syzkaller-upst...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages