[net?] KASAN: slab-use-after-free Read in page_pool_put_defragged_page

4 views
Skip to first unread message

syzbot

unread,
Jun 4, 2023, 10:39:56 AM6/4/23
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 715abedee4cd Add linux-next specific files for 20230515
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=10ef1221280000
kernel config: https://syzkaller.appspot.com/x/.config?x=6a2745d066dda0ec
dashboard link: https://syzkaller.appspot.com/bug?extid=273d3aeed4bcce3c35c9
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
CC: [a...@kernel.org b...@vger.kernel.org dan...@iogearbox.net da...@davemloft.net edum...@google.com ha...@kernel.org ilias.ap...@linaro.org john.fa...@gmail.com ku...@kernel.org linux-...@vger.kernel.org net...@vger.kernel.org pab...@redhat.com]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d4d1d06b34b8/disk-715abede.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3ef33a86fdc8/vmlinux-715abede.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e0006b413ed1/bzImage-715abede.xz

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

==================================================================
BUG: KASAN: slab-use-after-free in page_pool_recycle_in_ring net/core/page_pool.c:523 [inline]
BUG: KASAN: slab-use-after-free in page_pool_put_defragged_page+0x85e/0x880 net/core/page_pool.c:607
Read of size 8 at addr ffff88807afc8700 by task syz-executor.0/20654

CPU: 1 PID: 20654 Comm: syz-executor.0 Not tainted 6.4.0-rc2-next-20230515-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
print_report mm/kasan/report.c:462 [inline]
kasan_report+0x11c/0x130 mm/kasan/report.c:571
page_pool_recycle_in_ring net/core/page_pool.c:523 [inline]
page_pool_put_defragged_page+0x85e/0x880 net/core/page_pool.c:607
page_pool_put_page include/net/page_pool.h:342 [inline]
page_pool_put_full_page include/net/page_pool.h:350 [inline]
page_pool_return_skb_page+0x1c8/0x3d0 net/core/page_pool.c:928
skb_pp_recycle net/core/skbuff.c:885 [inline]
skb_free_head+0x14b/0x1b0 net/core/skbuff.c:901
skb_release_data+0x598/0x820 net/core/skbuff.c:935
skb_release_all net/core/skbuff.c:1001 [inline]
__kfree_skb net/core/skbuff.c:1015 [inline]
kfree_skb_reason+0x11e/0x210 net/core/skbuff.c:1051
kfree_skb include/linux/skbuff.h:1236 [inline]
skb_queue_purge+0x1d/0x40 net/core/skbuff.c:3663
packet_release+0x7c9/0xd10 net/packet/af_packet.c:3182
__sock_release+0xcd/0x290 net/socket.c:653
sock_close+0x1c/0x20 net/socket.c:1397
__fput+0x27c/0xa90 fs/file_table.c:321
task_work_run+0x16f/0x270 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fcf88e3e01b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007fff1f7e0770 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007fcf88e3e01b
RDX: 00007fcf88a00da0 RSI: ffffffffffffffff RDI: 0000000000000003
RBP: 00007fcf88fad980 R08: 0000000000000000 R09: 00007fcf88a00000
R10: 00007fcf88a00da8 R11: 0000000000000293 R12: 00000000001d240e
R13: 00007fff1f7e0870 R14: 00007fcf88fabf80 R15: 0000000000000032
</TASK>

Allocated by task 20656:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
____kasan_kmalloc mm/kasan/common.c:333 [inline]
__kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
kmalloc_node include/linux/slab.h:575 [inline]
kzalloc_node include/linux/slab.h:691 [inline]
page_pool_create+0x7c/0x6d0 net/core/page_pool.c:209
xdp_test_run_setup net/bpf/test_run.c:179 [inline]
bpf_test_run_xdp_live+0x1be/0x18c0 net/bpf/test_run.c:374
bpf_prog_test_run_xdp+0xa05/0x1540 net/bpf/test_run.c:1438
bpf_prog_test_run kernel/bpf/syscall.c:3681 [inline]
__sys_bpf+0x1602/0x5420 kernel/bpf/syscall.c:5076
__do_sys_bpf kernel/bpf/syscall.c:5162 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5160 [inline]
__x64_sys_bpf+0x79/0xc0 kernel/bpf/syscall.c:5160
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 20309:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:162 [inline]
slab_free_hook mm/slub.c:1781 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
slab_free mm/slub.c:3786 [inline]
__kmem_cache_free+0xaf/0x2d0 mm/slub.c:3799
page_pool_free net/core/page_pool.c:768 [inline]
page_pool_release+0xb31/0xd90 net/core/page_pool.c:806
page_pool_release_retry+0x22/0x1f0 net/core/page_pool.c:817
process_one_work+0x99a/0x15e0 kernel/workqueue.c:2407
worker_thread+0x67d/0x10c0 kernel/workqueue.c:2554
kthread+0x344/0x440 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
insert_work+0x48/0x360 kernel/workqueue.c:1365
__queue_work+0x5c6/0xfb0 kernel/workqueue.c:1526
call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700
expire_timers+0xbb/0x330 kernel/time/timer.c:1746
__run_timers kernel/time/timer.c:2022 [inline]
__run_timers kernel/time/timer.c:1995 [inline]
run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035
__do_softirq+0x1d4/0x905 kernel/softirq.c:553

The buggy address belongs to the object at ffff88807afc8000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1792 bytes inside of
freed 2048-byte region [ffff88807afc8000, ffff88807afc8800)

The buggy address belongs to the physical page:
page:ffffea0001ebf200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807afc9000 pfn:0x7afc8
head:ffffea0001ebf200 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888012442000 ffffea0001f7b210 ffffea0000b03a10
raw: ffff88807afc9000 0000000000080007 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 19895, tgid 19878 (syz-executor.2), ts 1837095536949, free_ts 1809321449600
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
prep_new_page mm/page_alloc.c:1738 [inline]
get_page_from_freelist+0xf67/0x2a80 mm/page_alloc.c:3539
__alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4805
alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
alloc_slab_page mm/slub.c:1851 [inline]
allocate_slab+0x28e/0x380 mm/slub.c:1998
new_slab mm/slub.c:2051 [inline]
___slab_alloc+0xa91/0x1400 mm/slub.c:3192
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291
__slab_alloc_node mm/slub.c:3344 [inline]
slab_alloc_node mm/slub.c:3441 [inline]
__kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490
__do_kmalloc_node mm/slab_common.c:965 [inline]
__kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:986
kmalloc_reserve+0xf0/0x270 net/core/skbuff.c:574
__alloc_skb+0x129/0x330 net/core/skbuff.c:643
alloc_skb include/linux/skbuff.h:1288 [inline]
nlmsg_new include/net/netlink.h:1003 [inline]
rtmsg_ifinfo_build_skb+0x7e/0x280 net/core/rtnetlink.c:3986
rtmsg_ifinfo_event net/core/rtnetlink.c:4029 [inline]
rtmsg_ifinfo_event net/core/rtnetlink.c:4019 [inline]
rtmsg_ifinfo+0x9f/0x1a0 net/core/rtnetlink.c:4038
register_netdevice+0x1235/0x1640 net/core/dev.c:10132
__ip_tunnel_create+0x398/0x5b0 net/ipv4/ip_tunnel.c:267
ip_tunnel_init_net+0x1f9/0x5d0 net/ipv4/ip_tunnel.c:1091
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1302 [inline]
free_unref_page_prepare+0x4dd/0xb90 mm/page_alloc.c:2600
free_unref_page+0x33/0x370 mm/page_alloc.c:2695
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2636
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:186 [inline]
slab_post_alloc_hook mm/slab.h:711 [inline]
slab_alloc_node mm/slub.c:3451 [inline]
__kmem_cache_alloc_node+0x17c/0x320 mm/slub.c:3490
__do_kmalloc_node mm/slab_common.c:965 [inline]
__kmalloc+0x4e/0x190 mm/slab_common.c:979
kmalloc include/linux/slab.h:563 [inline]
tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
tomoyo_sb_umount+0x8d/0xd0 security/tomoyo/tomoyo.c:428
security_sb_umount+0x4c/0xa0 security/security.c:1374
do_umount fs/namespace.c:1635 [inline]
path_umount+0x2f8/0x10b0 fs/namespace.c:1804
ksys_umount fs/namespace.c:1827 [inline]
__do_sys_umount fs/namespace.c:1832 [inline]
__se_sys_umount fs/namespace.c:1830 [inline]
__x64_sys_umount+0x15d/0x190 fs/namespace.c:1830
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffff88807afc8600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807afc8680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807afc8700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807afc8780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807afc8800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Sep 23, 2023, 4:09:30 PM9/23/23
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