==================================================================
BUG: KASAN: slab-use-after-free in dev_map_generic_redirect+0x554/0x5f0 kernel/bpf/devmap.c:681
Read of size 8 at addr ffff888062f50a00 by task syz.1.1026/9331
CPU: 0 PID: 9331 Comm: syz.1.1026 Not tainted 6.10.0-rc7-syzkaller-00076-g9d9a2f29aefd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report+0xd9/0x110 mm/kasan/report.c:601
dev_map_generic_redirect+0x554/0x5f0 kernel/bpf/devmap.c:681
xdp_do_generic_redirect_map net/core/filter.c:4490 [inline]
xdp_do_generic_redirect+0x309/0x720 net/core/filter.c:4549
do_xdp_generic+0x77f/0xc30 net/core/dev.c:5108
tun_get_user+0x1d36/0x3c30 drivers/net/tun.c:1924
tun_chr_write_iter+0xe8/0x210 drivers/net/tun.c:2048
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6b9/0x1140 fs/read_write.c:590
ksys_write+0x12f/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f72add7475f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 29 8c 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 7c 8c 02 00 48
RSP: 002b:00007f72aeafd010 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f72adf03f60 RCX: 00007f72add7475f
RDX: 000000000000fdef RSI: 0000000020000900 RDI: 00000000000000c8
RBP: 00007f72adde4e60 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000fdef R11: 0000000000000293 R12: 0000000000000000
R13: 000000000000000b R14: 00007f72adf03f60 R15: 00007ffc5246d758
Allocated by task 9245:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3940 [inline]
slab_alloc_node mm/slub.c:4002 [inline]
kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4045
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
alloc_skb include/linux/skbuff.h:1308 [inline]
netlink_alloc_large_skb+0x69/0x130 net/netlink/af_netlink.c:1210
netlink_sendmsg+0x689/0xd70 net/netlink/af_netlink.c:1880
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0xab8/0xc90 net/socket.c:2585
___sys_sendmsg+0x135/0x1e0 net/socket.c:2639
__sys_sendmsg+0x117/0x1f0 net/socket.c:2668
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 9245:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
__kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2196 [inline]
slab_free mm/slub.c:4438 [inline]
kmem_cache_free+0x12f/0x3a0 mm/slub.c:4513
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1131
__kfree_skb net/core/skbuff.c:1188 [inline]
consume_skb net/core/skbuff.c:1409 [inline]
consume_skb+0xdd/0x170 net/core/skbuff.c:1403
netlink_unicast_kernel net/netlink/af_netlink.c:1336 [inline]
netlink_unicast+0x54d/0x820 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1905
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0xab8/0xc90 net/socket.c:2585
___sys_sendmsg+0x135/0x1e0 net/socket.c:2639
__sys_sendmsg+0x117/0x1f0 net/socket.c:2668
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888062f50a00
which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 0 bytes inside of
freed 240-byte region [ffff888062f50a00, ffff888062f50af0)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x62f50
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000000 ffff8880196c9780 dead000000000122 0000000000000000
raw: 0000000000000000 00000000000c000c 00000001ffffefff 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 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 9134, tgid 9134 (syz-executor), ts 653721220648, free_ts 653649688171
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1473
prep_new_page mm/page_alloc.c:1481 [inline]
get_page_from_freelist+0x1353/0x2e50 mm/page_alloc.c:3425
__alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683
__alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
alloc_slab_page+0x56/0x110 mm/slub.c:2265
allocate_slab mm/slub.c:2428 [inline]
new_slab+0x84/0x260 mm/slub.c:2481
___slab_alloc+0xdac/0x1870 mm/slub.c:3667
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
__slab_alloc_node mm/slub.c:3810 [inline]
slab_alloc_node mm/slub.c:3990 [inline]
kmem_cache_alloc_node_noprof+0xed/0x310 mm/slub.c:4045
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
alloc_skb include/linux/skbuff.h:1308 [inline]
nlmsg_new include/net/netlink.h:1015 [inline]
rtmsg_fib+0x13f/0x520 net/ipv4/fib_semantics.c:522
fib_table_insert+0xc44/0x1d70 net/ipv4/fib_trie.c:1405
fib_magic+0x4d6/0x5c0 net/ipv4/fib_frontend.c:1104
fib_add_ifaddr+0x393/0x560 net/ipv4/fib_frontend.c:1141
fib_netdev_event+0x38d/0x710 net/ipv4/fib_frontend.c:1486
notifier_call_chain+0xbc/0x410 kernel/notifier.c:93
call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1992
page last free pid 9084 tgid 9084 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1093 [inline]
free_unref_page+0x64a/0xe40 mm/page_alloc.c:2588
__put_partials+0x14c/0x170 mm/slub.c:2995
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3940 [inline]
slab_alloc_node mm/slub.c:4002 [inline]
kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4045
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
alloc_skb include/linux/skbuff.h:1308 [inline]
netlink_alloc_large_skb+0x69/0x130 net/netlink/af_netlink.c:1210
netlink_sendmsg+0x689/0xd70 net/netlink/af_netlink.c:1880
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
__sys_sendto+0x482/0x4e0 net/socket.c:2192
__do_sys_sendto net/socket.c:2204 [inline]
__se_sys_sendto net/socket.c:2200 [inline]
__x64_sys_sendto+0xe0/0x1c0 net/socket.c:2200
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888062f50900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888062f50980: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
>ffff888062f50a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888062f50a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
ffff888062f50b00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================
==================================================================
BUG: KASAN: slab-use-after-free in xdp_ok_fwd_dev include/linux/filter.h:1049 [inline]
BUG: KASAN: slab-use-after-free in dev_map_generic_redirect+0x508/0x5f0 kernel/bpf/devmap.c:681
Read of size 4 at addr ffff88806b1de6b0 by task syz.1.1026/9331
CPU: 0 PID: 9331 Comm: syz.1.1026 Tainted: G B 6.10.0-rc7-syzkaller-00076-g9d9a2f29aefd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report+0xd9/0x110 mm/kasan/report.c:601
xdp_ok_fwd_dev include/linux/filter.h:1049 [inline]
dev_map_generic_redirect+0x508/0x5f0 kernel/bpf/devmap.c:681
xdp_do_generic_redirect_map net/core/filter.c:4490 [inline]
xdp_do_generic_redirect+0x309/0x720 net/core/filter.c:4549
do_xdp_generic+0x77f/0xc30 net/core/dev.c:5108
tun_get_user+0x1d36/0x3c30 drivers/net/tun.c:1924
tun_chr_write_iter+0xe8/0x210 drivers/net/tun.c:2048
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6b9/0x1140 fs/read_write.c:590
ksys_write+0x12f/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f72add7475f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 29 8c 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 7c 8c 02 00 48
RSP: 002b:00007f72aeafd010 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f72adf03f60 RCX: 00007f72add7475f
RDX: 000000000000fdef RSI: 0000000020000900 RDI: 00000000000000c8
RBP: 00007f72adde4e60 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000fdef R11: 0000000000000293 R12: 0000000000000000
R13: 000000000000000b R14: 00007f72adf03f60 R15: 00007ffc5246d758
Allocated by task 9248:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3940 [inline]
slab_alloc_node mm/slub.c:4002 [inline]
kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4009
getname_flags.part.0+0x50/0x4f0 fs/namei.c:139
getname_flags include/linux/audit.h:322 [inline]
getname fs/namei.c:218 [inline]
__do_sys_unlink fs/namei.c:4461 [inline]
__se_sys_unlink fs/namei.c:4459 [inline]
__x64_sys_unlink+0xb2/0x110 fs/namei.c:4459
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 9248:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
__kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2196 [inline]
slab_free mm/slub.c:4438 [inline]
kmem_cache_free+0x12f/0x3a0 mm/slub.c:4513
putname+0x12e/0x170 fs/namei.c:273
do_unlinkat+0x165/0x750 fs/namei.c:4436
__do_sys_unlink fs/namei.c:4461 [inline]
__se_sys_unlink fs/namei.c:4459 [inline]
__x64_sys_unlink+0xc7/0x110 fs/namei.c:4459
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff88806b1de600
which belongs to the cache names_cache of size 4096
The buggy address is located 176 bytes inside of
freed 4096-byte region [ffff88806b1de600, ffff88806b1df600)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6b1d8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000040 ffff8880166a9780 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000070007 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff8880166a9780 dead000000000122 0000000000000000
head: 0000000000000000 0000000000070007 00000001ffffefff 0000000000000000
head: 00fff00000000003 ffffea0001ac7601 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 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 4541, tgid 4541 (udevd), ts 653710636226, free_ts 634551813786
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1473
prep_new_page mm/page_alloc.c:1481 [inline]
get_page_from_freelist+0x1353/0x2e50 mm/page_alloc.c:3425
__alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683
__alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
alloc_slab_page+0x56/0x110 mm/slub.c:2265
allocate_slab mm/slub.c:2428 [inline]
new_slab+0x84/0x260 mm/slub.c:2481
___slab_alloc+0xdac/0x1870 mm/slub.c:3667
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
__slab_alloc_node mm/slub.c:3810 [inline]
slab_alloc_node mm/slub.c:3990 [inline]
kmem_cache_alloc_noprof+0x2a7/0x2f0 mm/slub.c:4009
getname_flags.part.0+0x50/0x4f0 fs/namei.c:139
getname_flags+0x9b/0xf0 include/linux/audit.h:322
user_path_at_empty+0x2c/0x60 fs/namei.c:2928
do_readlinkat+0xdd/0x310 fs/stat.c:499
__do_sys_readlink fs/stat.c:532 [inline]
__se_sys_readlink fs/stat.c:529 [inline]
__x64_sys_readlink+0x78/0xc0 fs/stat.c:529
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 8954 tgid 8954 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1093 [inline]
free_unref_page+0x64a/0xe40 mm/page_alloc.c:2588
vfree+0x181/0x7a0 mm/vmalloc.c:3363
kcov_put kernel/kcov.c:429 [inline]
kcov_put+0x2a/0x40 kernel/kcov.c:425
kcov_close+0x10/0x20 kernel/kcov.c:525
__fput+0x40b/0xbb0 fs/file_table.c:422
task_work_run+0x151/0x250 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa9b/0x2ba0 kernel/exit.c:876
do_group_exit+0xd3/0x2a0 kernel/exit.c:1025
get_signal+0x2616/0x2710 kernel/signal.c:2909
arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:310
exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x14a/0x2a0 kernel/entry/common.c:218
do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff88806b1de580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88806b1de600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88806b1de680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88806b1de700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806b1de780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================