syzbot


KASAN: use-after-free Write in __ip6_del_rt

Status: premoderation: reported on 2025/05/05 14:23
Reported-by: syzbot+55cc079147995aed4b04@syzkaller.appspotmail.com
First crash: 59d, last: 59d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in __ip6_del_rt syz 11 12d 72d 0/2 premoderation: reported syz repro on 2025/04/22 16:51
linux-5.15 KASAN: use-after-free Read in __ip6_del_rt 1 97d 97d 0/3 upstream: reported on 2025/03/28 21:22

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:511 [inline]
BUG: KASAN: use-after-free in queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock include/linux/spinlock.h:187 [inline]
BUG: KASAN: use-after-free in __raw_spin_lock_bh include/linux/spinlock_api_smp.h:136 [inline]
BUG: KASAN: use-after-free in _raw_spin_lock_bh+0x81/0xe0 kernel/locking/spinlock.c:178
Write of size 4 at addr ffff88810b71c914 by task kworker/u4:45/10518

CPU: 1 PID: 10518 Comm: kworker/u4:45 Tainted: G        W         5.15.180-syzkaller-00024-g88c4075c39ed #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0xf1/0x140 mm/kasan/report.c:444
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x280/0x290 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:511 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
 do_raw_spin_lock include/linux/spinlock.h:187 [inline]
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:136 [inline]
 _raw_spin_lock_bh+0x81/0xe0 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:368 [inline]
 __ip6_del_rt+0x8f/0x150 net/ipv6/route.c:3902
 ip6_del_rt+0xb0/0xf0 net/ipv6/route.c:3918
 __remove_nexthop_fib+0x1e9/0x260 net/ipv4/nexthop.c:1860
 __remove_nexthop net/ipv4/nexthop.c:1868 [inline]
 remove_nexthop+0x73/0x500 net/ipv4/nexthop.c:1894
 remove_nh_grp_entry net/ipv4/nexthop.c:1750 [inline]
 remove_nexthop_from_groups+0x231/0x1210 net/ipv4/nexthop.c:1815
 __remove_nexthop net/ipv4/nexthop.c:1879 [inline]
 remove_nexthop+0x3b6/0x500 net/ipv4/nexthop.c:1894
 flush_all_nexthops net/ipv4/nexthop.c:2405 [inline]
 nexthop_net_exit+0x3a/0xa0 net/ipv4/nexthop.c:3728
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x58b/0xad0 net/core/net_namespace.c:599
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 275:
 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 mm/kasan/common.c:512 [inline]
 __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 kmem_cache_alloc_trace+0x119/0x270 mm/slub.c:3269
 kmalloc include/linux/slab.h:616 [inline]
 kzalloc include/linux/slab.h:747 [inline]
 fib6_net_init+0x23d/0x8c0 net/ipv6/ip6_fib.c:2382
 ops_init+0x1ba/0x4a0 net/core/net_namespace.c:138
 setup_net+0x344/0xa90 net/core/net_namespace.c:332
 copy_net_ns+0x355/0x5c0 net/core/net_namespace.c:476
 create_new_namespaces+0x3a2/0x660 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x4ac/0x7b0 kernel/fork.c:3166
 __do_sys_unshare kernel/fork.c:3240 [inline]
 __se_sys_unshare kernel/fork.c:3238 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3238
 x64_sys_call+0x442/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:273
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 10518:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/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+0xc2/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3521 [inline]
 kfree+0xc4/0x270 mm/slub.c:4583
 fib6_free_table net/ipv6/ip6_fib.c:215 [inline]
 fib6_net_exit+0x270/0x300 net/ipv6/ip6_fib.c:2436
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x58b/0xad0 net/core/net_namespace.c:599
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88810b71c900
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 20 bytes inside of
 128-byte region [ffff88810b71c900, ffff88810b71c980)
The buggy address belongs to the page:
page:ffffea00042dc700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b71c
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea00041cf340 0000000b0000000b ffff888100042a80
raw: 0000000000000000 0000000000100010 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 3631385796, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5781
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0xa1/0x4d0 mm/slub.c:1995
 ___slab_alloc+0x381/0x810 mm/slub.c:3028
 __slab_alloc+0x49/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3250 [inline]
 kmem_cache_alloc_trace+0x146/0x270 mm/slub.c:3267
 kmalloc include/linux/slab.h:616 [inline]
 kzalloc include/linux/slab.h:747 [inline]
 call_usermodehelper_setup+0x8e/0x210 kernel/umh.c:365
 kobject_uevent_env+0x639/0x700 lib/kobject_uevent.c:629
 kobject_uevent+0x1d/0x30 lib/kobject_uevent.c:657
 driver_bound+0x453/0x4a0 drivers/base/dd.c:400
 really_probe+0x777/0x970 drivers/base/dd.c:649
 __driver_probe_device+0x198/0x280 drivers/base/dd.c:755
 driver_probe_device+0x54/0x3e0 drivers/base/dd.c:785
 __device_attach_driver+0x2a6/0x460 drivers/base/dd.c:907
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88810b71c800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88810b71c880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88810b71c900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88810b71c980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88810b71ca00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/05 14:22 android13-5.15-lts 88c4075c39ed 6ca47dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in __ip6_del_rt
* Struck through repros no longer work on HEAD.