==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff88810a749c00 by task kworker/1:3/312
CPU: 1 PID: 312 Comm: kworker/1:3 Not tainted 5.15.178-syzkaller-00492-gb4b92d737f96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106
print_address_description+0x87/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:427 [inline]
kasan_report+0x179/0x1c0 mm/kasan/report.c:444
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
xdp_do_generic_redirect_map net/core/filter.c:4177 [inline]
xdp_do_generic_redirect+0x42e/0xb40 net/core/filter.c:4236
do_xdp_generic+0x50b/0x7c0 net/core/dev.c:4919
__netif_receive_skb_core+0x1706/0x3640 net/core/dev.c:5324
__netif_receive_skb_one_core net/core/dev.c:5499 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5615
process_backlog+0x31c/0x650 net/core/dev.c:6492
__napi_poll+0xc4/0x5a0 net/core/dev.c:7051
napi_poll net/core/dev.c:7118 [inline]
net_rx_action+0x47d/0xc50 net/core/dev.c:7208
handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565
__do_softirq+0xb/0xd kernel/softirq.c:603
do_softirq+0xf6/0x150 kernel/softirq.c:452
__local_bh_enable_ip+0x75/0x80 kernel/softirq.c:379
__raw_read_unlock_bh include/linux/rwlock_api_smp.h:251 [inline]
_raw_read_unlock_bh+0x29/0x30 kernel/locking/spinlock.c:284
wg_socket_send_skb_to_peer+0x178/0x1d0 drivers/net/wireguard/socket.c:184
wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
wg_packet_tx_worker+0x1e6/0x530 drivers/net/wireguard/send.c:276
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
kthread+0x421/0x510 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Allocated by task 9523:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:433 [inline]
____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
__kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
kasan_kmalloc include/linux/kasan.h:227 [inline]
__kmalloc+0x13f/0x2c0 mm/slub.c:4431
kmalloc_array include/linux/slab.h:643 [inline]
kcalloc include/linux/slab.h:672 [inline]
ext4_find_extent+0x375/0xe30 fs/ext4/extents.c:907
ext4_ext_map_blocks+0x269/0x7450 fs/ext4/extents.c:4165
ext4_map_blocks+0xa60/0x1c70 fs/ext4/inode.c:673
ext4_getblk+0x19f/0x700 fs/ext4/inode.c:870
ext4_bread+0x2f/0x180 fs/ext4/inode.c:923
ext4_append+0x31f/0x5b0 fs/ext4/namei.c:83
ext4_init_new_dir+0x33a/0xa20 fs/ext4/namei.c:3030
ext4_mkdir+0x4f2/0xce0 fs/ext4/namei.c:3076
vfs_mkdir+0x3f6/0x610 fs/namei.c:4065
do_mkdirat+0x1eb/0x450 fs/namei.c:4090
__do_sys_mkdirat fs/namei.c:4105 [inline]
__se_sys_mkdirat fs/namei.c:4103 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4103
x64_sys_call+0x6c6/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:259
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 9523:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
kasan_slab_free include/linux/kasan.h:193 [inline]
slab_free_hook mm/slub.c:1723 [inline]
slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
slab_free mm/slub.c:3521 [inline]
kfree+0xcc/0x270 mm/slub.c:4583
ext4_ext_map_blocks+0x2834/0x7450 fs/ext4/extents.c:4433
ext4_map_blocks+0xa60/0x1c70 fs/ext4/inode.c:673
ext4_getblk+0x19f/0x700 fs/ext4/inode.c:870
ext4_bread+0x2f/0x180 fs/ext4/inode.c:923
ext4_append+0x31f/0x5b0 fs/ext4/namei.c:83
ext4_init_new_dir+0x33a/0xa20 fs/ext4/namei.c:3030
ext4_mkdir+0x4f2/0xce0 fs/ext4/namei.c:3076
vfs_mkdir+0x3f6/0x610 fs/namei.c:4065
do_mkdirat+0x1eb/0x450 fs/namei.c:4090
__do_sys_mkdirat fs/namei.c:4105 [inline]
__se_sys_mkdirat fs/namei.c:4103 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4103
x64_sys_call+0x6c6/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:259
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff88810a749c00
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff88810a749c00, ffff88810a749c60)
The buggy address belongs to the page:
page:ffffea000429d240 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10a749
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004476940 0000000d0000000d ffff888100042900
raw: 0000000000000000 0000000000200020 00000001ffffffff 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 0x12c00(GFP_NOIO|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 2168099305, free_ts 0
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605
prep_new_page+0x1b/0x110 mm/page_alloc.c:2611
get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485
__alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5780
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1932 [inline]
new_slab+0x9a/0x4e0 mm/slub.c:1995
___slab_alloc+0x39e/0x830 mm/slub.c:3028
__slab_alloc+0x4a/0x90 mm/slub.c:3115
slab_alloc_node mm/slub.c:3206 [inline]
slab_alloc mm/slub.c:3250 [inline]
kmem_cache_alloc_trace+0x147/0x270 mm/slub.c:3267
kmem_cache_alloc_node_trace include/linux/slab.h:491 [inline]
kmalloc_node include/linux/slab.h:621 [inline]
kzalloc_node include/linux/slab.h:744 [inline]
blk_alloc_flush_queue+0x7f/0x260 block/blk-flush.c:470
blk_mq_alloc_hctx block/blk-mq.c:2842 [inline]
blk_mq_alloc_and_init_hctx block/blk-mq.c:3218 [inline]
blk_mq_realloc_hw_ctxs+0xc0a/0x1790 block/blk-mq.c:3270
blk_mq_init_allocated_queue+0x449/0x16f0 block/blk-mq.c:3331
blk_mq_init_queue_data block/blk-mq.c:3166 [inline]
blk_mq_init_queue+0x6b/0xd0 block/blk-mq.c:3176
scsi_alloc_sdev+0x674/0xa10 drivers/scsi/scsi_scan.c:319
scsi_probe_and_add_lun+0x199/0x4320 drivers/scsi/scsi_scan.c:1156
__scsi_scan_target+0x1ed/0xe30 drivers/scsi/scsi_scan.c:1637
scsi_scan_channel drivers/scsi/scsi_scan.c:1725 [inline]
scsi_scan_host_selected+0x334/0x5f0 drivers/scsi/scsi_scan.c:1754
page_owner free stack trace missing
Memory state around the buggy address:
ffff88810a749b00: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
ffff88810a749b80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88810a749c00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88810a749c80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88810a749d00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 126348067 P4D 126348067 PUD 0
Oops: 0010 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 312 Comm: kworker/1:3 Tainted: G B 5.15.178-syzkaller-00492-gb4b92d737f96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
RIP: 0010:0x0
Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
RSP: 0018:ffffc900001d0580 EFLAGS: 00010246
RAX: ffffffff83f51017 RBX: ffffc900001d0780 RCX: ffff88810d0f0000
RDX: 0000000000000100 RSI: ffff88810c846f50 RDI: ffffc900001d0780
RBP: ffffc900001d05a0 R08: ffffffff83e8ffc7 R09: ffffc900001d0780
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc900001d0788
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff88810c846f50
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 000000013887f000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
bpf_dispatcher_xdp_func+0x20/0x30 net/core/filter.c:10934
__bpf_prog_run include/linux/filter.h:628 [inline]
bpf_prog_run_xdp include/linux/filter.h:803 [inline]
bpf_prog_run_generic_xdp+0x4f3/0x1070 net/core/dev.c:4774
dev_map_bpf_prog_run_skb kernel/bpf/devmap.c:503 [inline]
dev_map_generic_redirect+0x2f7/0x6f0 kernel/bpf/devmap.c:675
xdp_do_generic_redirect_map net/core/filter.c:4177 [inline]
xdp_do_generic_redirect+0x42e/0xb40 net/core/filter.c:4236
do_xdp_generic+0x50b/0x7c0 net/core/dev.c:4919
__netif_receive_skb_core+0x1706/0x3640 net/core/dev.c:5324
__netif_receive_skb_one_core net/core/dev.c:5499 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5615
process_backlog+0x31c/0x650 net/core/dev.c:6492
__napi_poll+0xc4/0x5a0 net/core/dev.c:7051
napi_poll net/core/dev.c:7118 [inline]
net_rx_action+0x47d/0xc50 net/core/dev.c:7208
handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565
__do_softirq+0xb/0xd kernel/softirq.c:603
do_softirq+0xf6/0x150 kernel/softirq.c:452
__local_bh_enable_ip+0x75/0x80 kernel/softirq.c:379
__raw_read_unlock_bh include/linux/rwlock_api_smp.h:251 [inline]
_raw_read_unlock_bh+0x29/0x30 kernel/locking/spinlock.c:284
wg_socket_send_skb_to_peer+0x178/0x1d0 drivers/net/wireguard/socket.c:184
wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
wg_packet_tx_worker+0x1e6/0x530 drivers/net/wireguard/send.c:276
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
kthread+0x421/0x510 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Modules linked in:
CR2: 0000000000000000
---[ end trace edd06a9676636a0c ]---
RIP: 0010:0x0
Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
RSP: 0018:ffffc900001d0580 EFLAGS: 00010246
RAX: ffffffff83f51017 RBX: ffffc900001d0780 RCX: ffff88810d0f0000
RDX: 0000000000000100 RSI: ffff88810c846f50 RDI: ffffc900001d0780
RBP: ffffc900001d05a0 R08: ffffffff83e8ffc7 R09: ffffc900001d0780
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc900001d0788
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff88810c846f50
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 000000013887f000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400