==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff88811ccc7380 by task syz.4.13343/29834
CPU: 1 PID: 29834 Comm: syz.4.13343 Tainted: G W 5.15.178-syzkaller-00193-g058abb720bd1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
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
local_bh_enable+0x1f/0x30 include/linux/bottom_half.h:32
rcu_read_unlock_bh include/linux/rcupdate.h:818 [inline]
ip_finish_output2+0xbef/0xf60 net/ipv4/ip_output.c:229
__ip_finish_output+0x162/0x360
ip_finish_output+0x31/0x210 net/ipv4/ip_output.c:316
NF_HOOK_COND include/linux/netfilter.h:294 [inline]
ip_output+0x1d6/0x420 net/ipv4/ip_output.c:430
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
ip_send_skb+0xb0/0x140 net/ipv4/ip_output.c:1581
udp_send_skb+0x9ae/0x12e0 net/ipv4/udp.c:991
udp_sendmsg+0x1d00/0x2aa0 net/ipv4/udp.c:1279
inet_sendmsg+0xa1/0xc0 net/ipv4/af_inet.c:830
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2436
___sys_sendmsg+0x252/0x2e0 net/socket.c:2490
__sys_sendmmsg+0x2bf/0x530 net/socket.c:2576
__do_sys_sendmmsg net/socket.c:2605 [inline]
__se_sys_sendmmsg net/socket.c:2602 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2602
x64_sys_call+0x81d/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:308
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
RIP: 0033:0x7f8c643ad169
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8c62a17038 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f8c645c5fa0 RCX: 00007f8c643ad169
RDX: 0000000000000001 RSI: 0000400000003240 RDI: 0000000000000005
RBP: 00007f8c6442e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000004000800 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8c645c5fa0 R15: 00007ffcd449adf8
Allocated by task 27785:
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_krealloc+0x93/0xd0 mm/kasan/common.c:580
kasan_krealloc include/linux/kasan.h:247 [inline]
__do_krealloc mm/slab_common.c:1234 [inline]
krealloc+0xbe/0x110 mm/slab_common.c:1271
push_jmp_history kernel/bpf/verifier.c:2119 [inline]
is_state_visited kernel/bpf/verifier.c:11039 [inline]
do_check+0x2633/0xf2c0 kernel/bpf/verifier.c:11179
do_check_common+0x909/0x1290 kernel/bpf/verifier.c:13457
do_check_main kernel/bpf/verifier.c:13520 [inline]
bpf_check+0x3851/0x12c60 kernel/bpf/verifier.c:14091
bpf_prog_load+0x12ac/0x1b50 kernel/bpf/syscall.c:2333
__sys_bpf+0x4bc/0x760 kernel/bpf/syscall.c:4638
__do_sys_bpf kernel/bpf/syscall.c:4742 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4740 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4740
x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
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
Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
__call_rcu_common kernel/rcu/tree.c:3007 [inline]
call_rcu+0x123/0x10b0 kernel/rcu/tree.c:3125
release_probes kernel/tracepoint.c:164 [inline]
tracepoint_remove_func kernel/tracepoint.c:458 [inline]
tracepoint_probe_unregister+0x82b/0x900 kernel/tracepoint.c:551
bpf_probe_unregister+0x61/0x70 kernel/trace/bpf_trace.c:1952
bpf_raw_tp_link_release+0x63/0x90 kernel/bpf/syscall.c:2885
bpf_link_free+0x129/0x3f0 kernel/bpf/syscall.c:2451
bpf_link_put kernel/bpf/syscall.c:2477 [inline]
bpf_link_release+0x170/0x180 kernel/bpf/syscall.c:2485
__fput+0x228/0x8c0 fs/file_table.c:280
____fput+0x15/0x20 fs/file_table.c:308
task_work_run+0x129/0x190 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0xc4/0xe0 kernel/entry/common.c:181
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
insert_work+0x56/0x320 kernel/workqueue.c:1373
__queue_work+0x92a/0xcd0 kernel/workqueue.c:1539
queue_work_on+0x105/0x170 kernel/workqueue.c:1566
queue_work include/linux/workqueue.h:510 [inline]
schedule_work include/linux/workqueue.h:571 [inline]
nf_nat_masq_schedule+0x4d6/0x620 net/netfilter/nf_nat_masquerade.c:125
masq_inet6_event+0x124/0x180 net/netfilter/nf_nat_masquerade.c:290
notifier_call_chain kernel/notifier.c:83 [inline]
atomic_notifier_call_chain+0x95/0x100 kernel/notifier.c:198
inet6addr_notifier_call_chain+0x24/0x30 net/ipv6/addrconf_core.c:109
addrconf_ifdown+0xe21/0x1ae0 net/ipv6/addrconf.c:3923
addrconf_notify+0x37d/0xdd0
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:391
call_netdevice_notifiers_info net/core/dev.c:2026 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2038 [inline]
call_netdevice_notifiers net/core/dev.c:2052 [inline]
dev_close_many+0x37c/0x530 net/core/dev.c:1627
unregister_netdevice_many+0x492/0x17c0 net/core/dev.c:11094
unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:11051
unregister_netdevice include/linux/netdevice.h:3052 [inline]
__tun_detach+0xd14/0x1510 drivers/net/tun.c:686
tun_detach drivers/net/tun.c:702 [inline]
tun_chr_close+0x92/0x140 drivers/net/tun.c:3440
__fput+0x228/0x8c0 fs/file_table.c:280
____fput+0x15/0x20 fs/file_table.c:308
task_work_run+0x129/0x190 kernel/task_work.c:188
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0xc48/0x2ca0 kernel/exit.c:880
do_group_exit+0x141/0x310 kernel/exit.c:1002
get_signal+0x7a3/0x1630 kernel/signal.c:2907
arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:178
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff88811ccc7380
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff88811ccc7380, ffff88811ccc73e0)
The buggy address belongs to the page:
page:ffffea00047331c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811ccc7e00 pfn:0x11ccc7
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004c5b0c8 ffffea00045c1d88 ffff888100042900
raw: ffff88811ccc7e00 000000000020000e 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 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 26, ts 21544441390, free_ts 21433423164
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
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
kmalloc include/linux/slab.h:603 [inline]
dst_cow_metrics_generic+0x55/0x1c0 net/core/dst.c:206
dst_metrics_write_ptr include/net/dst.h:118 [inline]
dst_metric_set include/net/dst.h:179 [inline]
icmp6_dst_alloc+0x385/0x560 net/ipv6/route.c:3288
ndisc_send_skb+0x27f/0xc90 net/ipv6/ndisc.c:491
ndisc_send_ns+0x64d/0x830 net/ipv6/ndisc.c:653
addrconf_dad_work+0xb29/0x1710 net/ipv6/addrconf.c:4221
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
kthread+0x421/0x510 kernel/kthread.c:337
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1472 [inline]
free_pcp_prepare mm/page_alloc.c:1544 [inline]
free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534
free_unref_page+0xe8/0x750 mm/page_alloc.c:3616
free_the_page mm/page_alloc.c:805 [inline]
__free_pages+0x61/0xf0 mm/page_alloc.c:5856
free_pages+0x7c/0x90 mm/page_alloc.c:5867
kasan_depopulate_vmalloc_pte+0x6a/0x90 mm/kasan/shadow.c:354
apply_to_pte_range mm/memory.c:2642 [inline]
apply_to_pmd_range mm/memory.c:2686 [inline]
apply_to_pud_range mm/memory.c:2722 [inline]
apply_to_p4d_range mm/memory.c:2758 [inline]
__apply_to_page_range+0x8dd/0xbe0 mm/memory.c:2792
apply_to_existing_page_range+0x38/0x50 mm/memory.c:2825
kasan_release_vmalloc+0x9a/0xb0 mm/kasan/shadow.c:464
__purge_vmap_area_lazy+0x154a/0x1690 mm/vmalloc.c:1715
_vm_unmap_aliases+0x339/0x3b0 mm/vmalloc.c:2118
vm_unmap_aliases+0x19/0x20 mm/vmalloc.c:2141
change_page_attr_set_clr+0x308/0x1050 arch/x86/mm/pat/set_memory.c:1740
change_page_attr_clear arch/x86/mm/pat/set_memory.c:1797 [inline]
set_memory_ro+0xa1/0xe0 arch/x86/mm/pat/set_memory.c:1943
bpf_jit_binary_lock_ro include/linux/filter.h:892 [inline]
bpf_int_jit_compile+0xbf21/0xc6b0 arch/x86/net/bpf_jit_comp.c:2422
bpf_prog_select_runtime+0x724/0xa10 kernel/bpf/core.c:1934
bpf_migrate_filter net/core/filter.c:1299 [inline]
bpf_prepare_filter+0x10d0/0x13d0 net/core/filter.c:1347
Memory state around the buggy address:
ffff88811ccc7280: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88811ccc7300: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff88811ccc7380: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88811ccc7400: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
ffff88811ccc7480: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
ip6_tunnel: ip6gretap0 xmit: Local address not yet configured!