[syzbot] KASAN: use-after-free Read in veth_xdp_rcv

51 views
Skip to first unread message

syzbot

unread,
Oct 9, 2021, 8:40:25 AM10/9/21
to 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, syzkall...@googlegroups.com, y...@fb.com
Hello,

syzbot found the following issue on:

HEAD commit: af4bb50d4647 bpf, tests: Add more LD_IMM64 tests
git tree: bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=129a1214b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9290a409049988d4
dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

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+67f895...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __ptr_ring_peek include/linux/ptr_ring.h:172 [inline]
BUG: KASAN: use-after-free in __ptr_ring_consume include/linux/ptr_ring.h:299 [inline]
BUG: KASAN: use-after-free in veth_xdp_rcv+0x70b/0x810 drivers/net/veth.c:856
Read of size 8 at addr ffff88804c47a1d8 by task ksoftirqd/0/13

CPU: 0 PID: 13 Comm: ksoftirqd/0 Not tainted 5.15.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256
__kasan_report mm/kasan/report.c:442 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
__ptr_ring_peek include/linux/ptr_ring.h:172 [inline]
__ptr_ring_consume include/linux/ptr_ring.h:299 [inline]
veth_xdp_rcv+0x70b/0x810 drivers/net/veth.c:856
veth_poll+0x134/0x850 drivers/net/veth.c:913
__napi_poll+0xaf/0x440 net/core/dev.c:6993
napi_poll net/core/dev.c:7060 [inline]
net_rx_action+0x801/0xb40 net/core/dev.c:7147
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
run_ksoftirqd kernel/softirq.c:920 [inline]
run_ksoftirqd+0x2d/0x60 kernel/softirq.c:912
smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164
kthread+0x3e5/0x4d0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 23048:
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:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522
kmalloc_node include/linux/slab.h:614 [inline]
kvmalloc_node+0x61/0x120 mm/util.c:587
kvmalloc include/linux/mm.h:805 [inline]
kvmalloc_array include/linux/mm.h:823 [inline]
__ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline]
ptr_ring_init include/linux/ptr_ring.h:489 [inline]
__veth_napi_enable_range+0xa2/0x780 drivers/net/veth.c:941
__veth_napi_enable drivers/net/veth.c:964 [inline]
veth_enable_xdp+0x30f/0x620 drivers/net/veth.c:1068
veth_xdp_set drivers/net/veth.c:1483 [inline]
veth_xdp+0x4d4/0x780 drivers/net/veth.c:1523
dev_xdp_install+0xd5/0x270 net/core/dev.c:9365
dev_xdp_attach+0x83d/0x1010 net/core/dev.c:9513
dev_xdp_attach_link net/core/dev.c:9532 [inline]
bpf_xdp_link_attach+0x262/0x410 net/core/dev.c:9695
link_create kernel/bpf/syscall.c:4258 [inline]
__sys_bpf+0x549c/0x5df0 kernel/bpf/syscall.c:4657
__do_sys_bpf kernel/bpf/syscall.c:4691 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4689 [inline]
__x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4689
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

Freed by task 23044:
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:360
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free mm/kasan/common.c:328 [inline]
__kasan_slab_free+0xff/0x130 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1700 [inline]
slab_free_freelist_hook+0x81/0x190 mm/slub.c:1725
slab_free mm/slub.c:3483 [inline]
kfree+0xe4/0x530 mm/slub.c:4543
kvfree+0x42/0x50 mm/util.c:620
ptr_ring_cleanup include/linux/ptr_ring.h:671 [inline]
veth_napi_del_range+0x3aa/0x560 drivers/net/veth.c:985
veth_napi_del drivers/net/veth.c:991 [inline]
veth_disable_xdp+0x2b3/0x430 drivers/net/veth.c:1101
veth_xdp_set drivers/net/veth.c:1499 [inline]
veth_xdp+0x698/0x780 drivers/net/veth.c:1523
dev_xdp_install+0x1ed/0x270 net/core/dev.c:9365
dev_xdp_detach_link net/core/dev.c:9549 [inline]
bpf_xdp_link_release+0x242/0x4e0 net/core/dev.c:9564
bpf_link_free+0xe6/0x1b0 kernel/bpf/syscall.c:2419
bpf_link_put+0x161/0x1b0 kernel/bpf/syscall.c:2445
bpf_link_release+0x33/0x40 kernel/bpf/syscall.c:2453
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
__syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
kasan_record_aux_stack+0xe9/0x110 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:2987 [inline]
call_rcu+0xb1/0x750 kernel/rcu/tree.c:3067
netlink_release+0xdd4/0x1dd0 net/netlink/af_netlink.c:812
__sock_release+0xcd/0x280 net/socket.c:649
sock_close+0x18/0x20 net/socket.c:1314
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
__syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
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+0xe9/0x110 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:2987 [inline]
call_rcu+0xb1/0x750 kernel/rcu/tree.c:3067
netlink_release+0xdd4/0x1dd0 net/netlink/af_netlink.c:812
__sock_release+0xcd/0x280 net/socket.c:649
sock_close+0x18/0x20 net/socket.c:1314
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
__syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88804c47a000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 472 bytes inside of
2048-byte region [ffff88804c47a000, ffff88804c47a800)
The buggy address belongs to the page:
page:ffffea0001311e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4c478
head:ffffea0001311e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010c42000
raw: 0000000000000000 0000000000080008 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 19628, ts 447286861857, free_ts 447089779835
prep_new_page mm/page_alloc.c:2424 [inline]
get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4153
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5375
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2197
alloc_slab_page mm/slub.c:1763 [inline]
allocate_slab mm/slub.c:1900 [inline]
new_slab+0x319/0x490 mm/slub.c:1963
___slab_alloc+0x921/0xfe0 mm/slub.c:2994
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3081
slab_alloc_node mm/slub.c:3172 [inline]
__kmalloc_node_track_caller+0x2d2/0x340 mm/slub.c:4936
kmalloc_reserve net/core/skbuff.c:352 [inline]
__alloc_skb+0xda/0x360 net/core/skbuff.c:424
alloc_skb include/linux/skbuff.h:1116 [inline]
nlmsg_new include/net/netlink.h:953 [inline]
rtmsg_ifinfo_build_skb+0x72/0x1a0 net/core/rtnetlink.c:3809
unregister_netdevice_many+0x9e4/0x1790 net/core/dev.c:11054
unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:10984
unregister_netdevice include/linux/netdevice.h:2988 [inline]
__tun_detach+0x10ad/0x13d0 drivers/net/tun.c:670
tun_detach drivers/net/tun.c:687 [inline]
tun_chr_close+0xc4/0x180 drivers/net/tun.c:3397
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
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+0x2c5/0x780 mm/page_alloc.c:1389
free_unref_page_prepare mm/page_alloc.c:3315 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3394
__unfreeze_partials+0x340/0x360 mm/slub.c:2495
qlink_free mm/kasan/quarantine.c:146 [inline]
qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0x95/0xb0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:3206 [inline]
slab_alloc mm/slub.c:3214 [inline]
kmem_cache_alloc+0x209/0x390 mm/slub.c:3219
getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
getname_flags+0x9a/0xe0 include/linux/audit.h:319
user_path_at_empty+0x2b/0x60 fs/namei.c:2800
user_path_at include/linux/namei.h:57 [inline]
vfs_statx+0x142/0x390 fs/stat.c:221
vfs_fstatat fs/stat.c:243 [inline]
vfs_lstat include/linux/fs.h:3356 [inline]
__do_sys_newlstat+0x91/0x110 fs/stat.c:398
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:
ffff88804c47a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804c47a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804c47a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88804c47a200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88804c47a280: fb 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.

Jakub Kicinski

unread,
Oct 11, 2021, 7:47:50 PM10/11/21
to syzbot, 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, linux-...@vger.kernel.org, net...@vger.kernel.org, songliu...@fb.com, syzkall...@googlegroups.com, y...@fb.com, Toke Høiland-Jørgensen, Paolo Abeni
CC: Paolo, Toke

Paolo Abeni

unread,
Oct 12, 2021, 5:20:58 AM10/12/21
to Jakub Kicinski, syzbot, 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, linux-...@vger.kernel.org, net...@vger.kernel.org, songliu...@fb.com, syzkall...@googlegroups.com, y...@fb.com, Toke Høiland-Jørgensen
On Mon, 2021-10-11 at 16:47 -0700, Jakub Kicinski wrote:
> CC: Paolo, Toke

Thanks for the head-up! will look at this soon.

Cheers,

Paolo

syzbot

unread,
Oct 28, 2021, 5:08:26 PM10/28/21
to and...@kernel.org, a...@kernel.org, b...@vger.kernel.org, dan...@iogearbox.net, da...@davemloft.net, fghee...@gmail.com, ha...@kernel.org, john.fa...@gmail.com, ka...@fb.com, kps...@kernel.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, songliu...@fb.com, syzkall...@googlegroups.com, to...@toke.dk, y...@fb.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 252c765bd764 riscv, bpf: Add BPF exception tables
git tree: bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=165fc0f4b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=f60548b4c38ae4a8
dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1797fcf2b00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e71f9f300000

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

==================================================================
BUG: KASAN: use-after-free in __ptr_ring_peek include/linux/ptr_ring.h:172 [inline]
BUG: KASAN: use-after-free in __ptr_ring_consume include/linux/ptr_ring.h:299 [inline]
BUG: KASAN: use-after-free in veth_xdp_rcv+0x70b/0x810 drivers/net/veth.c:856
Read of size 8 at addr ffff88807af6e008 by task ksoftirqd/0/13

CPU: 0 PID: 13 Comm: ksoftirqd/0 Not tainted 5.15.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256
__kasan_report mm/kasan/report.c:442 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
__ptr_ring_peek include/linux/ptr_ring.h:172 [inline]
__ptr_ring_consume include/linux/ptr_ring.h:299 [inline]
veth_xdp_rcv+0x70b/0x810 drivers/net/veth.c:856
veth_poll+0x134/0x850 drivers/net/veth.c:913
__napi_poll+0xaf/0x440 net/core/dev.c:6993
napi_poll net/core/dev.c:7060 [inline]
net_rx_action+0x801/0xb40 net/core/dev.c:7147
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
run_ksoftirqd kernel/softirq.c:920 [inline]
run_ksoftirqd+0x2d/0x60 kernel/softirq.c:912
smpboot_thread_fn+0x645/0x9c0 kernel/smpboot.c:164
kthread+0x3e5/0x4d0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 7543:
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:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
____kasan_kmalloc mm/kasan/common.c:472 [inline]
__kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522
kmalloc_node include/linux/slab.h:614 [inline]
kvmalloc_node+0x61/0x120 mm/util.c:587
kvmalloc include/linux/mm.h:805 [inline]
kvmalloc_array include/linux/mm.h:823 [inline]
__ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline]
ptr_ring_init include/linux/ptr_ring.h:489 [inline]
__veth_napi_enable_range+0xa2/0x780 drivers/net/veth.c:941
__veth_napi_enable drivers/net/veth.c:964 [inline]
veth_enable_xdp+0x30f/0x620 drivers/net/veth.c:1068
veth_xdp_set drivers/net/veth.c:1483 [inline]
veth_xdp+0x4d4/0x780 drivers/net/veth.c:1523
dev_xdp_install+0xd5/0x270 net/core/dev.c:9365
dev_xdp_attach+0x83d/0x1010 net/core/dev.c:9513
dev_xdp_attach_link net/core/dev.c:9532 [inline]
bpf_xdp_link_attach+0x262/0x410 net/core/dev.c:9695
link_create kernel/bpf/syscall.c:4268 [inline]
__sys_bpf+0x549c/0x5df0 kernel/bpf/syscall.c:4667
__do_sys_bpf kernel/bpf/syscall.c:4701 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4699 [inline]
__x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4699
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

Freed by task 7542:
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:360
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free mm/kasan/common.c:328 [inline]
__kasan_slab_free+0xff/0x130 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1700 [inline]
slab_free_freelist_hook+0x81/0x190 mm/slub.c:1725
slab_free mm/slub.c:3483 [inline]
kfree+0xe4/0x530 mm/slub.c:4543
kvfree+0x42/0x50 mm/util.c:620
ptr_ring_cleanup include/linux/ptr_ring.h:671 [inline]
veth_napi_del_range+0x3aa/0x560 drivers/net/veth.c:985
veth_napi_del drivers/net/veth.c:991 [inline]
veth_disable_xdp+0x2b3/0x430 drivers/net/veth.c:1101
veth_xdp_set drivers/net/veth.c:1499 [inline]
veth_xdp+0x698/0x780 drivers/net/veth.c:1523
dev_xdp_install+0x1ed/0x270 net/core/dev.c:9365
dev_xdp_detach_link net/core/dev.c:9549 [inline]
bpf_xdp_link_release+0x242/0x4e0 net/core/dev.c:9564
bpf_link_free+0xe6/0x1b0 kernel/bpf/syscall.c:2427
bpf_link_put+0x161/0x1b0 kernel/bpf/syscall.c:2453
bpf_link_release+0x33/0x40 kernel/bpf/syscall.c:2461
__fput+0x288/0x9f0 fs/file_table.c:280
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
__syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88807af6e000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 8 bytes inside of
2048-byte region [ffff88807af6e000, ffff88807af6e800)
The buggy address belongs to the page:
page:ffffea0001ebda00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7af68
head:ffffea0001ebda00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888010c42000
raw: 0000000000000000 0000000000080008 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 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 7536, ts 1019839663090, free_ts 1019749588025
prep_new_page mm/page_alloc.c:2424 [inline]
get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4153
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5375
alloc_pages+0x1a7/0x300 mm/mempolicy.c:2197
alloc_slab_page mm/slub.c:1763 [inline]
allocate_slab mm/slub.c:1900 [inline]
new_slab+0x319/0x490 mm/slub.c:1963
___slab_alloc+0x921/0xfe0 mm/slub.c:2994
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3081
slab_alloc_node mm/slub.c:3172 [inline]
__kmalloc_node_track_caller+0x2d2/0x340 mm/slub.c:4936
kmalloc_reserve net/core/skbuff.c:352 [inline]
pskb_expand_head+0x15e/0x1060 net/core/skbuff.c:1699
netlink_trim+0x1ea/0x240 net/netlink/af_netlink.c:1296
netlink_broadcast+0x5b/0xd50 net/netlink/af_netlink.c:1492
nlmsg_multicast include/net/netlink.h:1033 [inline]
nlmsg_notify+0x8f/0x280 net/netlink/af_netlink.c:2528
rtnl_notify net/core/rtnetlink.c:730 [inline]
rtmsg_ifinfo_send net/core/rtnetlink.c:3833 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:3848 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:3836 [inline]
rtnetlink_event+0x193/0x1d0 net/core/rtnetlink.c:5623
notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1996
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
netdev_features_change net/core/dev.c:1368 [inline]
netdev_update_features net/core/dev.c:10035 [inline]
netdev_update_features+0xc4/0xd0 net/core/dev.c:10032
veth_xdp_set drivers/net/veth.c:1510 [inline]
veth_xdp+0x448/0x780 drivers/net/veth.c:1523
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+0x2c5/0x780 mm/page_alloc.c:1389
free_unref_page_prepare mm/page_alloc.c:3315 [inline]
free_unref_page+0x19/0x690 mm/page_alloc.c:3394
__unfreeze_partials+0x340/0x360 mm/slub.c:2495
qlink_free mm/kasan/quarantine.c:146 [inline]
qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
__kasan_slab_alloc+0x95/0xb0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook mm/slab.h:519 [inline]
slab_alloc_node mm/slub.c:3206 [inline]
slab_alloc mm/slub.c:3214 [inline]
kmem_cache_alloc+0x209/0x390 mm/slub.c:3219
vm_area_dup+0x88/0x2b0 kernel/fork.c:357
__split_vma+0xa5/0x550 mm/mmap.c:2714
split_vma+0x95/0xd0 mm/mmap.c:2772
mprotect_fixup+0x678/0x940 mm/mprotect.c:477
do_mprotect_pkey+0x558/0x9a0 mm/mprotect.c:636
__do_sys_mprotect mm/mprotect.c:662 [inline]
__se_sys_mprotect mm/mprotect.c:659 [inline]
__x64_sys_mprotect+0x74/0xb0 mm/mprotect.c:659
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:
ffff88807af6df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807af6df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807af6e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807af6e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807af6e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Paolo Abeni

unread,
Nov 8, 2021, 6:59:00 AM11/8/21
to syzbot, syzkall...@googlegroups.com
On Thu, 2021-10-28 at 14:08 -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 252c765bd764 riscv, bpf: Add BPF exception tables
> git tree: bpf-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=165fc0f4b00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f60548b4c38ae4a8
> dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1797fcf2b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e71f9f300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+67f895...@syzkaller.appspotmail.com

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git master

---
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 50eb43e5bf45..b78894c38933 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1025,6 +1025,8 @@ static int veth_enable_xdp_range(struct net_device *dev, int start, int end,
err_reg_mem:
xdp_rxq_info_unreg(&priv->rq[i].xdp_rxq);
err_rxq_reg:
+ if (!napi_already_on)
+ netif_napi_del(&priv->rq[i].xdp_napi);
for (i--; i >= start; i--) {
struct veth_rq *rq = &priv->rq[i];


syzbot

unread,
Nov 8, 2021, 7:10:11 AM11/8/21
to pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in bpf_warn_invalid_xdp_action

------------[ cut here ]------------
Illegal XDP return value 16128, expect packet loss!
WARNING: CPU: 1 PID: 136 at net/core/filter.c:8186 bpf_warn_invalid_xdp_action net/core/filter.c:8186 [inline]
WARNING: CPU: 1 PID: 136 at net/core/filter.c:8186 bpf_warn_invalid_xdp_action+0x6f/0x80 net/core/filter.c:8182
Modules linked in:
CPU: 1 PID: 136 Comm: kworker/1:2 Not tainted 5.15.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: mld mld_dad_work
RIP: 0010:bpf_warn_invalid_xdp_action net/core/filter.c:8186 [inline]
RIP: 0010:bpf_warn_invalid_xdp_action+0x6f/0x80 net/core/filter.c:8182
Code: 00 17 8d 8a 41 83 fc 04 48 c7 c6 40 17 8d 8a 48 0f 46 ee e8 c3 2e 4f fa 44 89 e2 48 c7 c7 80 17 8d 8a 48 89 ee e8 21 ac cb 01 <0f> 0b 5b 5d 41 5c e9 a6 2e 4f fa 66 0f 1f 44 00 00 41 57 41 56 49
RSP: 0018:ffffc90000dc09b0 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff88801851ba00 RSI: ffffffff815ef908 RDI: fffff520001b8128
RBP: ffffffff8a8d1700 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815e96ee R11: 0000000000000000 R12: 0000000000003f00
R13: 0000000000003f00 R14: ffff8880683bb100 R15: ffffc90001b08000
FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000280 CR3: 000000006f34c000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
veth_xdp_rcv_skb+0x68e/0x1b20 drivers/net/veth.c:804
veth_xdp_rcv+0x3ac/0x810 drivers/net/veth.c:881
veth_poll+0x134/0x850 drivers/net/veth.c:913
__napi_poll+0xaf/0x440 net/core/dev.c:7017
napi_poll net/core/dev.c:7084 [inline]
net_rx_action+0x801/0xb40 net/core/dev.c:7171
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
do_softirq.part.0+0xde/0x130 kernel/softirq.c:459
</IRQ>
<TASK>
do_softirq kernel/softirq.c:451 [inline]
__local_bh_enable_ip+0x102/0x120 kernel/softirq.c:383
local_bh_enable include/linux/bottom_half.h:32 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:758 [inline]
ip6_finish_output2+0x5bf/0x14e0 net/ipv6/ip6_output.c:127
__ip6_finish_output net/ipv6/ip6_output.c:191 [inline]
__ip6_finish_output+0x4c1/0x1050 net/ipv6/ip6_output.c:170
ip6_finish_output+0x32/0x200 net/ipv6/ip6_output.c:201
NF_HOOK_COND include/linux/netfilter.h:296 [inline]
ip6_output+0x1e4/0x530 net/ipv6/ip6_output.c:224
dst_output include/net/dst.h:450 [inline]
NF_HOOK include/linux/netfilter.h:307 [inline]
NF_HOOK include/linux/netfilter.h:301 [inline]
mld_sendpack+0x9a1/0xe40 net/ipv6/mcast.c:1826
mld_send_initial_cr.part.0+0x194/0x230 net/ipv6/mcast.c:2245
mld_send_initial_cr net/ipv6/mcast.c:1232 [inline]
mld_dad_work+0x1d3/0x690 net/ipv6/mcast.c:2268
process_one_work+0x9b2/0x1690 kernel/workqueue.c:2297
worker_thread+0x658/0x11f0 kernel/workqueue.c:2444
kthread+0x405/0x4f0 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>


Tested on:

commit: c45231a7 litex_liteeth: Fix a double free in the remov..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=10b1b0dcb00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2554266f3ca5bf4b
dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=16c7fdb6b00000

Paolo Abeni

unread,
Nov 11, 2021, 4:48:43 AM11/11/21
to syzbot, syzkall...@googlegroups.com
On Thu, 2021-10-28 at 14:08 -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 252c765bd764 riscv, bpf: Add BPF exception tables
> git tree: bpf-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=165fc0f4b00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f60548b4c38ae4a8
> dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1797fcf2b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e71f9f300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+67f895...@syzkaller.appspotmail.com

Recent fix 0315a075f1343966ea2d9a085666a88a69ea6a3d could also apply
here.

syzbot

unread,
Nov 11, 2021, 4:59:07 AM11/11/21
to pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in bpf_warn_invalid_xdp_action

------------[ cut here ]------------
Illegal XDP return value 16128, expect packet loss!
WARNING: CPU: 1 PID: 25 at net/core/filter.c:8186 bpf_warn_invalid_xdp_action net/core/filter.c:8186 [inline]
WARNING: CPU: 1 PID: 25 at net/core/filter.c:8186 bpf_warn_invalid_xdp_action+0x6f/0x80 net/core/filter.c:8182
Modules linked in:
CPU: 1 PID: 25 Comm: kworker/1:1 Not tainted 5.15.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: mld mld_dad_work
RIP: 0010:bpf_warn_invalid_xdp_action net/core/filter.c:8186 [inline]
RIP: 0010:bpf_warn_invalid_xdp_action+0x6f/0x80 net/core/filter.c:8182
Code: 00 17 8d 8a 41 83 fc 04 48 c7 c6 40 17 8d 8a 48 0f 46 ee e8 b3 1e 4f fa 44 89 e2 48 c7 c7 80 17 8d 8a 48 89 ee e8 11 9c cb 01 <0f> 0b 5b 5d 41 5c e9 96 1e 4f fa 66 0f 1f 44 00 00 41 57 41 56 49
RSP: 0018:ffffc90000dc09b0 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff8880153aba00 RSI: ffffffff815ef908 RDI: fffff520001b8128
RBP: ffffffff8a8d1700 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815e96ee R11: 0000000000000000 R12: 0000000000003f00
R13: 0000000000003f00 R14: ffff888069269100 R15: ffffc90001afa000
FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd7638493c3 CR3: 000000005ed14000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
veth_xdp_rcv_skb+0x68e/0x1b20 drivers/net/veth.c:804
veth_xdp_rcv+0x3ac/0x810 drivers/net/veth.c:881
veth_poll+0x134/0x850 drivers/net/veth.c:913
__napi_poll+0xaf/0x440 net/core/dev.c:7020
napi_poll net/core/dev.c:7087 [inline]
net_rx_action+0x801/0xb40 net/core/dev.c:7174
commit: 0315a075 net: fix premature exit from NAPI state polli..
console output: https://syzkaller.appspot.com/x/log.txt?x=15ebe532b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2554266f3ca5bf4b

Paolo Abeni

unread,
Nov 18, 2021, 10:18:52 AM11/18/21
to syzbot, syzkall...@googlegroups.com
On Thu, 2021-10-28 at 14:08 -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 252c765bd764 riscv, bpf: Add BPF exception tables
> git tree: bpf-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=165fc0f4b00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f60548b4c38ae4a8
> dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1797fcf2b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e71f9f300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+67f895...@syzkaller.appspotmail.com

let's try 0315a075f1343966ea2d9a085666a88a69ea6a3d plus too-easy-to-
trigger ebpf warn removal

#syz test: https://github.com/pabeni/mptcp.git napi_bpf_fixup

syzbot

unread,
Nov 18, 2021, 10:51:08 AM11/18/21
to pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+67f895...@syzkaller.appspotmail.com

Tested on:

commit: c48e1392 bpf: let bpf_warn_invalid_xdp_action() report..
git tree: https://github.com/pabeni/mptcp.git napi_bpf_fixup
kernel config: https://syzkaller.appspot.com/x/.config?x=b12f41e13f511172
dashboard link: https://syzkaller.appspot.com/bug?extid=67f89551088ea1a6850e
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Jan 12, 2022, 1:07:08 PM1/12/22
to and...@kernel.org, a...@kernel.org, b...@vger.kernel.org, dan...@iogearbox.net, da...@davemloft.net, fghee...@gmail.com, ha...@kernel.org, john.fa...@gmail.com, ka...@fb.com, kps...@kernel.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, songliu...@fb.com, syzkall...@googlegroups.com, to...@redhat.com, to...@toke.dk, y...@fb.com
syzbot suspects this issue was fixed by commit:

commit 2cbad989033bff0256675c38f96f5faab852af4b
Author: Paolo Abeni <pab...@redhat.com>
Date: Tue Nov 30 10:08:06 2021 +0000

bpf: Do not WARN in bpf_warn_invalid_xdp_action()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14e9e1ddb00000
start commit: 252c765bd764 riscv, bpf: Add BPF exception tables
git tree: bpf-next
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: bpf: Do not WARN in bpf_warn_invalid_xdp_action()

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Sep 5, 2022, 2:24:25 PM9/5/22
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages