syzbot


KASAN: slab-use-after-free Read in fib6_run_gc

Status: auto-obsoleted due to no activity on 2024/04/01 19:53
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+9d5a439d6a945ff981b7@syzkaller.appspotmail.com
First crash: 125d, last: 103d

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in fib6_gc_table net/ipv6/ip6_fib.c:2331 [inline]
BUG: KASAN: slab-use-after-free in fib6_gc_all net/ipv6/ip6_fib.c:2347 [inline]
BUG: KASAN: slab-use-after-free in fib6_run_gc+0x2fc/0x6a4 net/ipv6/ip6_fib.c:2369
Read of size 8 at addr ffff0000d0813838 by task syz-executor.5/11224

CPU: 1 PID: 11224 Comm: syz-executor.5 Not tainted 6.7.0-rc6-syzkaller-gaafe7ad77b91 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0x174/0x514 mm/kasan/report.c:475
 kasan_report+0xd8/0x138 mm/kasan/report.c:588
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 fib6_gc_table net/ipv6/ip6_fib.c:2331 [inline]
 fib6_gc_all net/ipv6/ip6_fib.c:2347 [inline]
 fib6_run_gc+0x2fc/0x6a4 net/ipv6/ip6_fib.c:2369
 ndisc_netdev_event+0x15c/0x4b4 net/ipv6/ndisc.c:1907
 notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93
 raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461
 call_netdevice_notifiers_info net/core/dev.c:1967 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2005 [inline]
 call_netdevice_notifiers net/core/dev.c:2019 [inline]
 dev_close_many+0x308/0x474 net/core/dev.c:1560
 unregister_netdevice_many_notify+0x41c/0x17b4 net/core/dev.c:11013
 unregister_netdevice_many net/core/dev.c:11096 [inline]
 unregister_netdevice_queue+0x2d8/0x324 net/core/dev.c:10976
 unregister_netdevice include/linux/netdevice.h:3158 [inline]
 __tun_detach+0x584/0x129c drivers/net/tun.c:684
 tun_detach drivers/net/tun.c:700 [inline]
 tun_chr_close+0x118/0x1f8 drivers/net/tun.c:3499
 __fput+0x308/0x8e4 fs/file_table.c:394
 __fput_sync+0x60/0x9c fs/file_table.c:475
 __do_sys_close fs/open.c:1587 [inline]
 __se_sys_close fs/open.c:1572 [inline]
 __arm64_sys_close+0x150/0x1e0 fs/open.c:1572
 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

Allocated by task 10528:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x7c mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:511
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:198 [inline]
 __do_kmalloc_node mm/slab_common.c:1007 [inline]
 __kmalloc_node+0xd4/0x1c4 mm/slab_common.c:1014
 kmalloc_array_node include/linux/slab.h:698 [inline]
 kcalloc_node include/linux/slab.h:703 [inline]
 memcg_alloc_slab_cgroups+0x90/0x154 mm/memcontrol.c:2968
 account_slab mm/slab.h:637 [inline]
 allocate_slab mm/slub.c:2035 [inline]
 new_slab+0xd4/0x2f4 mm/slub.c:2070
 ___slab_alloc+0x80c/0xdf4 mm/slub.c:3223
 __slab_alloc mm/slub.c:3322 [inline]
 __slab_alloc_node mm/slub.c:3375 [inline]
 slab_alloc_node mm/slub.c:3468 [inline]
 slab_alloc mm/slub.c:3486 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3493 [inline]
 kmem_cache_alloc+0x2e4/0x410 mm/slub.c:3502
 __sigqueue_alloc+0x3d8/0x4d8 kernel/signal.c:437
 __send_signal_locked+0x200/0xb54 kernel/signal.c:1128
 send_signal_locked+0xb0/0x864 kernel/signal.c:1257
 force_sig_info_to_task+0x298/0x40c kernel/signal.c:1363
 force_sig_fault_to_task kernel/signal.c:1735 [inline]
 force_sig_fault+0x100/0x1a0 kernel/signal.c:1740
 arm64_force_sig_fault+0x6c/0x80 arch/arm64/kernel/traps.c:273
 do_page_fault+0x88c/0xa54
 do_translation_fault+0x94/0xc8 arch/arm64/mm/fault.c:710
 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:846
 el0_da+0x60/0x168 arch/arm64/kernel/entry-common.c:546
 el0t_64_sync_handler+0xcc/0xfc arch/arm64/kernel/entry-common.c:699
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

Freed by task 5715:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x7c mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:522
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1800 [inline]
 slab_free_freelist_hook mm/slub.c:1826 [inline]
 slab_free mm/slub.c:3809 [inline]
 __kmem_cache_free+0x2ac/0x480 mm/slub.c:3822
 kfree+0xb8/0x19c mm/slab_common.c:1056
 memcg_free_slab_cgroups mm/slab.h:458 [inline]
 unaccount_slab mm/slab.h:647 [inline]
 __free_slab+0xb8/0x1ec mm/slub.c:2086
 free_slab+0x28/0x12c mm/slub.c:2110
 discard_slab mm/slub.c:2116 [inline]
 __unfreeze_partials+0x1a0/0x238 mm/slub.c:2655
 put_cpu_partial+0x164/0x1c0 mm/slub.c:2731
 __slab_free+0x1a0/0x26c mm/slub.c:3679
 do_slab_free mm/slub.c:3757 [inline]
 ___cache_free+0x150/0x180 mm/slub.c:3816
 qlink_free+0x5c/0xac mm/kasan/quarantine.c:168
 qlist_free_all+0x40/0xcc mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x118/0x124 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x2c/0x8c mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x90/0x498 mm/slab.h:763
 slab_alloc_node mm/slub.c:3478 [inline]
 __kmem_cache_alloc_node+0x264/0x368 mm/slub.c:3517
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc+0xb8/0x1b8 mm/slab_common.c:1020
 kmalloc include/linux/slab.h:604 [inline]
 tomoyo_realpath_from_path+0xc8/0x4cc security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x1ec/0x414 security/tomoyo/file.c:771
 tomoyo_file_open+0x130/0x19c security/tomoyo/tomoyo.c:332
 security_file_open+0x6c/0xb0 security/security.c:2836
 do_dentry_open+0x29c/0x12b4 fs/open.c:935
 vfs_open+0x7c/0x90 fs/open.c:1082
 do_open fs/namei.c:3622 [inline]
 path_openat+0x1f6c/0x2888 fs/namei.c:3779
 do_filp_open+0x1bc/0x3cc fs/namei.c:3809
 do_sys_openat2+0x124/0x1b8 fs/open.c:1437
 do_sys_open fs/open.c:1452 [inline]
 __do_sys_openat fs/open.c:1468 [inline]
 __se_sys_openat fs/open.c:1463 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1463
 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155
 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595

Last potentially related work creation:
 kasan_save_stack+0x40/0x6c mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:492
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:502
 __call_rcu_common kernel/rcu/tree.c:2681 [inline]
 call_rcu+0x104/0xaf4 kernel/rcu/tree.c:2795
 fib6_info_release include/net/ip6_fib.h:332 [inline]
 nsim_rt6_release drivers/net/netdevsim/fib.c:515 [inline]
 nsim_fib6_event_fini+0xf0/0x1f4 drivers/net/netdevsim/fib.c:841
 nsim_fib_event drivers/net/netdevsim/fib.c:891 [inline]
 nsim_fib_event_work+0xde0/0x32bc drivers/net/netdevsim/fib.c:1492
 process_one_work+0x694/0x1204 kernel/workqueue.c:2627
 process_scheduled_works kernel/workqueue.c:2700 [inline]
 worker_thread+0x938/0xef4 kernel/workqueue.c:2781
 kthread+0x288/0x310 kernel/kthread.c:388
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:857

Second to last potentially related work creation:
 kasan_save_stack+0x40/0x6c mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:492
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:502
 insert_work+0x54/0x2d4 kernel/workqueue.c:1647
 __queue_work+0xcb0/0x12bc kernel/workqueue.c:1796
 delayed_work_timer_fn+0x74/0x90 kernel/workqueue.c:1925
 call_timer_fn+0x19c/0x8cc kernel/time/timer.c:1700
 expire_timers kernel/time/timer.c:1746 [inline]
 __run_timers+0x5b4/0x734 kernel/time/timer.c:2022
 run_timer_softirq+0x7c/0x114 kernel/time/timer.c:2035
 __do_softirq+0x2d8/0xce4 kernel/softirq.c:553

The buggy address belongs to the object at ffff0000d0813800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 56 bytes inside of
 freed 512-byte region [ffff0000d0813800, ffff0000d0813a00)

The buggy address belongs to the physical page:
page:000000001800cba0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x110810
head:000000001800cba0 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x5ffc00000000840(slab|head|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000840 ffff0000c0001c80 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d0813700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d0813780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d0813800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff0000d0813880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d0813900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/02 19:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci aafe7ad77b91 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in fib6_run_gc
2023/12/12 12:25 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 0128e0962959 28b24332 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in fib6_run_gc
* Struck through repros no longer work on HEAD.