syzbot


KASAN: use-after-free Read in __ip6_del_rt

Status: upstream: reported on 2025/03/28 21:22
Reported-by: syzbot+5afee0faa2fb77bb8011@syzkaller.appspotmail.com
First crash: 24d, last: 24d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x114/0x7638 kernel/locking/lockdep.c:4882
Read of size 8 at addr ffff0000d5f3c430 by task kworker/u4:9/4282

CPU: 0 PID: 4282 Comm: kworker/u4:9 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: netns cleanup_net
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 __lock_acquire+0x114/0x7638 kernel/locking/lockdep.c:4882
 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x124/0x1c4 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:368 [inline]
 __ip6_del_rt+0x90/0x18c net/ipv6/route.c:3884
 ip6_del_rt+0xdc/0x13c net/ipv6/route.c:3900
 __remove_nexthop_fib net/ipv4/nexthop.c:1860 [inline]
 __remove_nexthop+0x244/0x173c net/ipv4/nexthop.c:1868
 remove_nexthop+0x80/0x1b4 net/ipv4/nexthop.c:1894
 remove_nh_grp_entry net/ipv4/nexthop.c:1750 [inline]
 remove_nexthop_from_groups net/ipv4/nexthop.c:1815 [inline]
 __remove_nexthop+0x8e8/0x173c net/ipv4/nexthop.c:1879
 remove_nexthop+0x80/0x1b4 net/ipv4/nexthop.c:1894
 flush_all_nexthops net/ipv4/nexthop.c:2405 [inline]
 nexthop_net_exit+0x4c/0xc0 net/ipv4/nexthop.c:3728
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x644/0xa9c net/core/net_namespace.c:618
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 4021:
 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_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 fib6_net_init+0x1f8/0x6c8 net/ipv6/ip6_fib.c:2382
 ops_init+0x2e4/0x54c net/core/net_namespace.c:138
 setup_net+0x378/0xa64 net/core/net_namespace.c:333
 copy_net_ns+0x2f8/0x5e0 net/core/net_namespace.c:486
 create_new_namespaces+0x330/0x61c kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x108/0x158 kernel/nsproxy.c:226
 ksys_unshare+0x424/0x7e4 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __arm64_sys_unshare+0x3c/0x50 kernel/fork.c:3171
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4282:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x178/0x410 mm/slub.c:4559
 fib6_free_table net/ipv6/ip6_fib.c:215 [inline]
 fib6_net_exit+0x1f0/0x274 net/ipv6/ip6_fib.c:2436
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x644/0xa9c net/core/net_namespace.c:618
 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310
 worker_thread+0x910/0x1034 kernel/workqueue.c:2457
 kthread+0x37c/0x45c kernel/kthread.c:334
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000d5f3c400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 48 bytes inside of
 512-byte region [ffff0000d5f3c400, ffff0000d5f3c600)
The buggy address belongs to the page:
page:0000000082854e45 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000d5f3e800 pfn:0x115f3c
head:0000000082854e45 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc0003a1cc08 fffffc00032dd608 ffff0000c0002600
raw: ffff0000d5f3e800 000000000010000f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d5f3c300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d5f3c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d5f3c400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff0000d5f3c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d5f3c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/28 21:21 linux-5.15.y 0c935c049b5c 9a1a9e31 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in __ip6_del_rt
* Struck through repros no longer work on HEAD.