syzbot


KASAN: use-after-free Read in ip6_pol_route

Status: auto-obsoleted due to no activity on 2024/07/04 16:14
Reported-by: syzbot+ce4c5d2b83a87bfd538e@syzkaller.appspotmail.com
First crash: 239d, last: 239d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ip6_pol_route 249 2648d 2656d 3/28 fixed on 2017/10/24 06:54
upstream KASAN: use-after-free Read in ip6_pol_route (2) net C done unreliable 9 935d 1371d 0/28 auto-obsoleted due to no activity on 2022/09/19 15:39
upstream general protection fault in ip6_pol_route (2) net 15 148d 155d 0/28 auto-obsoleted due to no activity on 2024/08/28 04:33
upstream Internal error in ip6_pol_route net 2 376d 400d 0/28 auto-obsoleted due to no activity on 2024/02/18 23:43
upstream general protection fault in ip6_pol_route net 73 156d 194d 26/28 fixed on 2024/06/18 11:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in rt6_get_pcpu_route net/ipv6/route.c:1396 [inline]
BUG: KASAN: use-after-free in ip6_pol_route+0x1331/0x15a0 net/ipv6/route.c:2255
Read of size 4 at addr ffff888022b7aa78 by task kworker/0:11/3827

CPU: 0 PID: 3827 Comm: kworker/0:11 Not tainted 5.15.152-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 rt6_get_pcpu_route net/ipv6/route.c:1396 [inline]
 ip6_pol_route+0x1331/0x15a0 net/ipv6/route.c:2255
 pol_lookup_func include/net/ip6_fib.h:582 [inline]
 fib6_rule_lookup+0x265/0x620 net/ipv6/fib6_rules.c:115
 ip6_route_output_flags+0xc1/0x310 net/ipv6/route.c:2642
 ip6_dst_lookup_tail+0x267/0x11a0 net/ipv6/ip6_output.c:1121
 ip6_dst_lookup_flow+0xb5/0x170 net/ipv6/ip6_output.c:1224
 send6+0x5a7/0xad0 drivers/net/wireguard/socket.c:139
 wg_socket_send_skb_to_peer+0x111/0x1d0 drivers/net/wireguard/socket.c:178
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x1a1/0x7a0 drivers/net/wireguard/send.c:276
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 3839:
 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_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 dst_alloc+0x12c/0x190 net/core/dst.c:88
 ip6_dst_alloc net/ipv6/route.c:341 [inline]
 ip6_rt_pcpu_alloc net/ipv6/route.c:1369 [inline]
 rt6_make_pcpu_route net/ipv6/route.c:1417 [inline]
 ip6_pol_route+0xbe2/0x15a0 net/ipv6/route.c:2258
 pol_lookup_func include/net/ip6_fib.h:582 [inline]
 fib6_rule_lookup+0x265/0x620 net/ipv6/fib6_rules.c:115
 ip6_route_output_flags+0xc1/0x310 net/ipv6/route.c:2642
 ip6_route_output include/net/ip6_route.h:98 [inline]
 ip6_dst_lookup_tail+0x19c/0x11a0 net/ipv6/ip6_output.c:1094
 ip6_dst_lookup_flow+0xb5/0x170 net/ipv6/ip6_output.c:1224
 send6+0x5a7/0xad0 drivers/net/wireguard/socket.c:139
 wg_socket_send_skb_to_peer+0x111/0x1d0 drivers/net/wireguard/socket.c:178
 wg_packet_send_handshake_initiation drivers/net/wireguard/send.c:40 [inline]
 wg_packet_handshake_send_worker+0x1d9/0x310 drivers/net/wireguard/send.c:51
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Freed by task 14:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 dst_destroy+0x28e/0x380 net/core/dst.c:123
 rcu_do_batch kernel/rcu/tree.c:2523 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 dst_cache_per_cpu_get+0x2a6/0x340 net/core/dst_cache.c:53
 dst_cache_get_ip6+0x88/0xe0 net/core/dst_cache.c:130
 send6+0x416/0xad0 drivers/net/wireguard/socket.c:129
 wg_socket_send_skb_to_peer+0x111/0x1d0 drivers/net/wireguard/socket.c:178
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x1a1/0x7a0 drivers/net/wireguard/send.c:276
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 refdst_drop include/net/dst.h:255 [inline]
 skb_dst_drop include/net/dst.h:267 [inline]
 __dev_queue_xmit+0x7a2/0x3230 net/core/dev.c:4204
 neigh_output include/net/neighbour.h:509 [inline]
 ip6_finish_output2+0xee8/0x14f0 net/ipv6/ip6_output.c:126
 dst_output include/net/dst.h:443 [inline]
 NF_HOOK include/linux/netfilter.h:302 [inline]
 ndisc_send_skb+0xae0/0x13c0 net/ipv6/ndisc.c:509
 ndisc_send_ns+0x64d/0x830 net/ipv6/ndisc.c:651
 addrconf_dad_work+0xb35/0x1720 net/ipv6/addrconf.c:4199
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff888022b7aa00
 which belongs to the cache ip6_dst_cache of size 232
The buggy address is located 120 bytes inside of
 232-byte region [ffff888022b7aa00, ffff888022b7aae8)
The buggy address belongs to the page:
page:ffffea00008ade80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22b7a
memcg:ffff88805db0c581
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff8880236b0140
raw: 0000000000000000 00000000000c000c 00000001ffffffff ffff88805db0c581
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 3558, ts 65089726373, free_ts 65076930277
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 dst_alloc+0x12c/0x190 net/core/dst.c:88
 ip6_dst_alloc net/ipv6/route.c:341 [inline]
 icmp6_dst_alloc+0x76/0x4f0 net/ipv6/route.c:3271
 mld_sendpack+0x584/0xc10 net/ipv6/mcast.c:1809
 mld_send_cr net/ipv6/mcast.c:2121 [inline]
 mld_ifc_work+0x7d7/0xc90 net/ipv6/mcast.c:2653
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0xfb/0x290 mm/slub.c:3245
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 tomoyo_dump_page+0x115/0x660 security/tomoyo/domain.c:906
 tomoyo_scan_bprm security/tomoyo/condition.c:130 [inline]
 tomoyo_condition+0x1d83/0x2c00 security/tomoyo/condition.c:1120
 tomoyo_check_acl+0x168/0x410 security/tomoyo/domain.c:177
 tomoyo_execute_permission+0x139/0x410 security/tomoyo/file.c:615
 tomoyo_find_next_domain+0x3ff/0x1cf0 security/tomoyo/domain.c:752
 tomoyo_bprm_check_security+0xdb/0x120 security/tomoyo/tomoyo.c:101

Memory state around the buggy address:
 ffff888022b7a900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888022b7a980: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
>ffff888022b7aa00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff888022b7aa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff888022b7ab00: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/26 16:13 linux-5.15.y b95c01af2113 bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ip6_pol_route
* Struck through repros no longer work on HEAD.