syzbot


KASAN: use-after-free Read in dev_map_generic_redirect

Status: premoderation: reported on 2025/01/16 07:29
Reported-by: syzbot+c9b300bf4549cff7bea4@syzkaller.appspotmail.com
First crash: 20d, last: 11d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 general protection fault in dev_map_generic_redirect origin:lts syz 83 1d01h 309d 0/2 premoderation: reported syz repro on 2024/04/02 16:15
linux-5.15 KASAN: use-after-free Read in dev_map_generic_redirect 1 20d 20d 0/3 upstream: reported on 2025/01/16 19:30
linux-6.1 KASAN: use-after-free Read in dev_map_generic_redirect 16 1d22h 170d 0/3 upstream: reported on 2024/08/19 13:49
upstream BUG: unable to handle kernel NULL pointer dereference in dev_map_generic_redirect bpf net 20 204d 303d 0/28 auto-obsoleted due to no activity on 2024/10/01 02:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff888108789f00 by task kworker/0:6/17870

CPU: 0 PID: 17870 Comm: kworker/0:6 Not tainted 5.15.176-syzkaller-00972-g829d9f138569 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
 <IRQ>
 __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
 </IRQ>
 <TASK>
 __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
 </TASK>

Allocated by task 13248:
 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]
 kmem_cache_alloc_trace+0x11a/0x270 mm/slub.c:3269
 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
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 13:
 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
 ip_dst_metrics_put include/net/ip.h:528 [inline]
 ip6_dst_destroy+0x8d/0x450 net/ipv6/route.c:360
 dst_destroy+0xbe/0x280 net/core/dst.c:116
 dst_destroy_rcu+0x19/0x20 net/core/dst.c:137
 rcu_do_batch+0x57a/0xc10 kernel/rcu/tree.c:2523
 rcu_core+0x517/0x1020 kernel/rcu/tree.c:2763
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2776
 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565
 run_ksoftirqd+0x28/0x40 kernel/softirq.c:941
 smpboot_thread_fn+0x466/0x8d0 kernel/smpboot.c:164
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff888108789f00
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff888108789f00, ffff888108789f60)
The buggy address belongs to the page:
page:ffffea000421e240 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108789
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 dead000000000100 dead000000000122 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 1294509674, free_ts 1248599897
 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]
 kzalloc include/linux/slab.h:733 [inline]
 acpi_os_allocate_zeroed include/acpi/platform/aclinuxex.h:57 [inline]
 acpi_ut_evaluate_object+0x104/0x490 drivers/acpi/acpica/uteval.c:50
 acpi_ut_execute_power_methods+0x10e/0x270 drivers/acpi/acpica/uteval.c:288
 acpi_get_object_info+0x658/0x1210 drivers/acpi/acpica/nsxfname.c:366
 acpi_set_pnp_ids drivers/acpi/scan.c:1326 [inline]
 acpi_init_device_object+0x6f4/0x2ff0 drivers/acpi/scan.c:1751
 acpi_add_single_object+0xf0/0x19c0 drivers/acpi/scan.c:1797
 acpi_bus_check_add+0x3ee/0x8c0 drivers/acpi/scan.c:2056
 acpi_bus_check_add_1+0x22/0x30 drivers/acpi/scan.c:2072
 acpi_ns_walk_namespace+0x249/0x4a0
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_slab+0xec/0x1d0 mm/slub.c:2020
 free_slab mm/slub.c:2035 [inline]
 discard_slab mm/slub.c:2041 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2527
 put_cpu_partial+0xc4/0x120 mm/slub.c:2607
 __slab_free+0x1c8/0x290 mm/slub.c:3390
 do_slab_free mm/slub.c:3509 [inline]
 ___cache_free+0x109/0x120 mm/slub.c:3530
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all mm/kasan/quarantine.c:176 [inline]
 kasan_quarantine_remove_cache+0x1cb/0x220 mm/kasan/quarantine.c:356
 kasan_cache_shrink+0x9/0x10 mm/kasan/generic.c:201
 kmem_cache_shrink+0xd/0x20 mm/slab_common.c:538
 acpi_os_purge_cache+0x15/0x20 drivers/acpi/osl.c:1663
 acpi_purge_cached_objects+0x3d/0xc0 drivers/acpi/acpica/utxface.c:237
 acpi_initialize_objects+0x2e/0xa0 drivers/acpi/acpica/utxfinit.c:250
 acpi_bus_init+0xd3/0xb60 drivers/acpi/bus.c:1255

Memory state around the buggy address:
 ffff888108789e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888108789e80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888108789f00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                   ^
 ffff888108789f80: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
 ffff88810878a000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/25 04:00 android13-5.15-lts 829d9f138569 1293872d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in dev_map_generic_redirect
2025/01/16 07:28 android13-5.15-lts 829d9f138569 968edaf4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in dev_map_generic_redirect
2025/01/25 04:27 android13-5.15-lts 829d9f138569 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 general protection fault in dev_map_generic_redirect
2025/01/17 11:58 android13-5.15-lts 829d9f138569 953d1c45 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 general protection fault in dev_map_generic_redirect
* Struck through repros no longer work on HEAD.