[v5.15] KASAN: use-after-free Read in dev_map_generic_redirect

3 views
Skip to first unread message

syzbot

unread,
Jan 16, 2025, 2:30:22 PM1/16/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4735586da88e Linux 5.15.176
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=170227c4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=caf0c22a63c5c861
dashboard link: https://syzkaller.appspot.com/bug?extid=1a1d8462cf1e1aadb857
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3e7a2d136136/disk-4735586d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7597375cf469/vmlinux-4735586d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/132474c9ad82/Image-4735586d.gz.xz

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

==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa8/0x7b8 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff0000e5e81400 by task kworker/1:3/4070

CPU: 1 PID: 4070 Comm: kworker/1:3 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
dev_map_generic_redirect+0xa8/0x7b8 kernel/bpf/devmap.c:667
xdp_do_generic_redirect_map net/core/filter.c:4177 [inline]
xdp_do_generic_redirect+0x3f8/0xe2c net/core/filter.c:4236
do_xdp_generic+0x3b8/0x8a8 net/core/dev.c:4911
__netif_receive_skb_core+0x15c4/0x341c net/core/dev.c:5316
__netif_receive_skb_one_core net/core/dev.c:5491 [inline]
__netif_receive_skb+0x114/0x400 net/core/dev.c:5607
process_backlog+0x3ec/0x7e0 net/core/dev.c:6484
__napi_poll+0xb4/0x624 net/core/dev.c:7043
napi_poll net/core/dev.c:7110 [inline]
net_rx_action+0x500/0xc10 net/core/dev.c:7200
handle_softirqs+0x384/0xdbc kernel/softirq.c:558
__do_softirq kernel/softirq.c:592 [inline]
do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
do_softirq+0xfc/0x1b0 kernel/softirq.c:459
__local_bh_enable_ip+0x298/0x470 kernel/softirq.c:383
__raw_read_unlock_bh include/linux/rwlock_api_smp.h:251 [inline]
_raw_read_unlock_bh+0xf8/0x180 kernel/locking/spinlock.c:284
wg_socket_send_skb_to_peer+0x158/0x1a8 drivers/net/wireguard/socket.c:184
wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
wg_packet_tx_worker+0x1a8/0x714 drivers/net/wireguard/send.c:276
process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
worker_thread+0x910/0x1034 kernel/workqueue.c:2457
kthread+0x37c/0x45c kernel/kthread.c:334
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 7198:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc_node+0x2c0/0x5b8 mm/slub.c:4455
kmalloc_node include/linux/slab.h:614 [inline]
bpf_map_kmalloc_node+0x22c/0x5c0 kernel/bpf/syscall.c:430
__dev_map_alloc_node+0x70/0x438 kernel/bpf/devmap.c:850
__dev_map_update_elem kernel/bpf/devmap.c:914 [inline]
dev_map_update_elem+0x190/0x35c kernel/bpf/devmap.c:933
bpf_map_update_value+0x6a8/0x8fc kernel/bpf/syscall.c:221
map_update_elem+0x52c/0x6a0 kernel/bpf/syscall.c:1185
__sys_bpf+0x2a4/0x610 kernel/bpf/syscall.c:4644
__do_sys_bpf kernel/bpf/syscall.c:4760 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4758 [inline]
__arm64_sys_bpf+0x80/0x98 kernel/bpf/syscall.c:4758
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4070:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0x178/0x410 mm/slub.c:4559
dev_map_free+0x4b0/0x608 kernel/bpf/devmap.c:237
bpf_map_free_deferred+0x2cc/0x430 kernel/bpf/syscall.c:479
process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
worker_thread+0x910/0x1034 kernel/workqueue.c:2457
kthread+0x37c/0x45c kernel/kthread.c:334
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000e5e81400
which belongs to the cache kmalloc-cg-128 of size 128
The buggy address is located 0 bytes inside of
128-byte region [ffff0000e5e81400, ffff0000e5e81480)
The buggy address belongs to the page:
page:00000000ddfb73a6 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x125e81
memcg:ffff0000c2e8f101
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc00033ab580 0000000500000004 ffff0000c0002d80
raw: 0000000000000000 0000000000100010 00000001ffffffff ffff0000c2e8f101
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000e5e81300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000e5e81380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000e5e81400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000e5e81480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000e5e81500: 00 00 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 report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

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

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

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

syzbot

unread,
Aug 1, 2025, 1:52:24 AM8/1/25
to syzkaller...@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