syzbot


KASAN: use-after-free Read in compute_effective_progs

Status: closed as invalid on 2022/02/05 00:28
Reported-by: syzbot+cfc5bcc3fcb2dd8b4725@syzkaller.appspotmail.com
First crash: 1106d, last: 1106d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in compute_effective_progs (2) C error 11 836d 963d 2/2 upstream: reported C repro on 2022/04/03 08:00

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in prog_list_prog kernel/bpf/cgroup.c:174 [inline]
BUG: KASAN: use-after-free in prog_list_length kernel/bpf/cgroup.c:187 [inline]
BUG: KASAN: use-after-free in compute_effective_progs+0x1d3/0x6e0 kernel/bpf/cgroup.c:240
Read of size 8 at addr ffff8881164dfa98 by task syz-executor.1/25269

CPU: 0 PID: 25269 Comm: syz-executor.1 Tainted: G        W         5.10.77-syzkaller-01258-g76698ea35fd3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233
 __kasan_report+0x142/0x220 mm/kasan/report.c:419
 kasan_report+0x51/0x70 mm/kasan/report.c:436
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 prog_list_prog kernel/bpf/cgroup.c:174 [inline]
 prog_list_length kernel/bpf/cgroup.c:187 [inline]
 compute_effective_progs+0x1d3/0x6e0 kernel/bpf/cgroup.c:240
 update_effective_progs+0x79/0x310 kernel/bpf/cgroup.c:343
 __cgroup_bpf_detach+0x312/0x570 kernel/bpf/cgroup.c:689
 bpf_cgroup_link_release+0x94/0x260 kernel/bpf/cgroup.c:833
 bpf_link_free kernel/bpf/syscall.c:2332 [inline]
 bpf_link_put+0x1e9/0x270 kernel/bpf/syscall.c:2358
 bpf_link_release+0x3b/0x40 kernel/bpf/syscall.c:2366
 __fput+0x348/0x7d0 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x147/0x1b0 kernel/task_work.c:154
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:164 [inline]
 exit_to_user_mode_prepare+0xc3/0xe0 kernel/entry/common.c:191
 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266
 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7faadfb7672b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffcf9b09490 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000008 RCX: 00007faadfb7672b
RDX: 0000000000000000 RSI: ffffffff815441b5 RDI: 0000000000000007
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b333217f4
R10: 0000000000000292 R11: 0000000000000293 R12: 00007faadfcd7b60
R13: 00007faadfcd7b60 R14: 00007faadfcd6f60 R15: 00000000000515f6

Allocated by task 25270:
 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:428 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516
 kasan_kmalloc include/linux/kasan.h:269 [inline]
 kmem_cache_alloc_trace+0x210/0x3a0 mm/slub.c:2975
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 cgroup_bpf_link_attach+0x12e/0x4a0 kernel/bpf/cgroup.c:918
 link_create kernel/bpf/syscall.c:4073 [inline]
 __do_sys_bpf+0xab52/0x116d0 kernel/bpf/syscall.c:4478
 __se_sys_bpf kernel/bpf/syscall.c:4364 [inline]
 __x64_sys_bpf+0x7a/0x90 kernel/bpf/syscall.c:4364
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 25270:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:1596 [inline]
 slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1622
 slab_free mm/slub.c:3204 [inline]
 kfree+0xd5/0x320 mm/slub.c:4192
 bpf_cgroup_link_dealloc+0x15/0x20 kernel/bpf/cgroup.c:849
 bpf_link_free kernel/bpf/syscall.c:2336 [inline]
 bpf_link_put+0x243/0x270 kernel/bpf/syscall.c:2358
 bpf_link_release+0x3b/0x40 kernel/bpf/syscall.c:2366
 __fput+0x348/0x7d0 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x147/0x1b0 kernel/task_work.c:154
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:164 [inline]
 exit_to_user_mode_prepare+0xc3/0xe0 kernel/entry/common.c:191
 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266
 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881164dfa80
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 24 bytes inside of
 96-byte region [ffff8881164dfa80, ffff8881164dfae0)
The buggy address belongs to the page:
page:ffffea00045937c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8881164df980 pfn:0x1164df
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0005868a00 0000000500000005 ffff888100043680
raw: ffff8881164df980 000000008020001e 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 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 383, ts 82458397178, free_ts 82320773997
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2385 [inline]
 prep_new_page mm/page_alloc.c:2391 [inline]
 get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063
 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5106
 alloc_slab_page mm/slub.c:1807 [inline]
 allocate_slab+0x6b/0x350 mm/slub.c:1809
 new_slab mm/slub.c:1870 [inline]
 new_slab_objects mm/slub.c:2629 [inline]
 ___slab_alloc+0x143/0x2f0 mm/slub.c:2792
 __slab_alloc mm/slub.c:2832 [inline]
 slab_alloc_node mm/slub.c:2914 [inline]
 slab_alloc mm/slub.c:2956 [inline]
 kmem_cache_alloc_trace+0x278/0x3a0 mm/slub.c:2973
 kmalloc include/linux/slab.h:552 [inline]
 __hw_addr_create_ex net/core/dev_addr_lists.c:30 [inline]
 __hw_addr_add_ex net/core/dev_addr_lists.c:76 [inline]
 __dev_mc_add+0x1ba/0x560 net/core/dev_addr_lists.c:775
 dev_mc_add+0x1f/0x30 net/core/dev_addr_lists.c:792
 igmp6_group_added+0x1b7/0x8b0 net/ipv6/mcast.c:669
 __ipv6_dev_mc_inc+0x7c8/0xaa0 net/ipv6/mcast.c:928
 ipv6_dev_mc_inc+0x1f/0x30 net/ipv6/mcast.c:935
 ipv6_add_dev+0xcaf/0x10d0 net/ipv6/addrconf.c:460
 addrconf_notify+0x6c3/0x3a80 net/ipv6/addrconf.c:3517
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x8e/0xf0 kernel/notifier.c:410
 call_netdevice_notifiers_info net/core/dev.c:2054 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2066 [inline]
 call_netdevice_notifiers net/core/dev.c:2080 [inline]
 register_netdevice+0x1502/0x1ad0 net/core/dev.c:10135
 veth_newlink+0x692/0xba0 drivers/net/veth.c:1358
 __rtnl_newlink net/core/rtnetlink.c:3442 [inline]
 rtnl_newlink+0x1580/0x1db0 net/core/rtnetlink.c:3501
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1331 [inline]
 free_pcp_prepare+0x18f/0x1c0 mm/page_alloc.c:1405
 free_unref_page_prepare mm/page_alloc.c:3291 [inline]
 free_unref_page mm/page_alloc.c:3341 [inline]
 free_the_page mm/page_alloc.c:5165 [inline]
 __free_pages+0x2e3/0x4a0 mm/page_alloc.c:5173
 __free_slab+0xdf/0x1a0 mm/slub.c:1895
 free_slab mm/slub.c:1910 [inline]
 discard_slab mm/slub.c:1916 [inline]
 unfreeze_partials+0x17d/0x1b0 mm/slub.c:2410
 put_cpu_partial+0xc8/0x190 mm/slub.c:2446
 __slab_free+0x2eb/0x4e0 mm/slub.c:3096
 do_slab_free mm/slub.c:3192 [inline]
 ___cache_free+0x131/0x150 mm/slub.c:3211
 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146
 qlist_free_all mm/kasan/quarantine.c:165 [inline]
 kasan_quarantine_reduce+0x178/0x1d0 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438
 kasan_slab_alloc include/linux/kasan.h:259 [inline]
 slab_post_alloc_hook mm/slab.h:583 [inline]
 slab_alloc_node mm/slub.c:2948 [inline]
 slab_alloc mm/slub.c:2956 [inline]
 __kmalloc_track_caller+0x1bf/0x3b0 mm/slub.c:4535
 kvasprintf+0xd6/0x180 lib/kasprintf.c:25
 kvasprintf_const+0x5e/0x180 lib/kasprintf.c:49
 kobject_set_name_vargs+0x61/0x120 lib/kobject.c:289
 kobject_add_varg lib/kobject.c:384 [inline]
 kobject_init_and_add+0xdb/0x190 lib/kobject.c:473
 netdev_queue_add_kobject net/core/net-sysfs.c:1594 [inline]
 netdev_queue_update_kobjects+0x177/0x3c0 net/core/net-sysfs.c:1639

Memory state around the buggy address:
 ffff8881164df980: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8881164dfa00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff8881164dfa80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                            ^
 ffff8881164dfb00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
 ffff8881164dfb80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/11/11 13:17 android12-5.10-lts 76698ea35fd3 75b04091 .config console log report info ci2-android-5-10 KASAN: use-after-free Read in compute_effective_progs
* Struck through repros no longer work on HEAD.