syzbot


KASAN: use-after-free Read in anon_vma_interval_tree_insert (2)

Status: auto-obsoleted due to no activity on 2022/11/03 13:19
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+43ce57526396bf8a8cc0@syzkaller.appspotmail.com
First crash: 814d, last: 762d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in anon_vma_interval_tree_insert mm 1 877d 876d 0/28 auto-closed as invalid on 2022/07/11 21:59
linux-4.14 general protection fault in anon_vma_interval_tree_insert 1 1266d 1266d 0/1 auto-closed as invalid on 2021/08/16 07:22
linux-4.19 general protection fault in anon_vma_interval_tree_insert 1 1242d 1242d 0/1 auto-closed as invalid on 2021/09/09 17:59
upstream general protection fault in anon_vma_interval_tree_insert (2) mm 4 1044d 1128d 0/28 auto-closed as invalid on 2022/02/24 00:52
linux-4.19 KASAN: slab-out-of-bounds Read in anon_vma_interval_tree_insert 1 1014d 1014d 0/1 auto-closed as invalid on 2022/04/24 23:41

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in vma_start_pgoff mm/interval_tree.c:15 [inline]
BUG: KASAN: use-after-free in avc_start_pgoff mm/interval_tree.c:63 [inline]
BUG: KASAN: use-after-free in __anon_vma_interval_tree_insert mm/interval_tree.c:71 [inline]
BUG: KASAN: use-after-free in anon_vma_interval_tree_insert+0x3e8/0x4b0 mm/interval_tree.c:82
Read of size 8 at addr ffff88801fcc3650 by task syz-executor.3/24099

CPU: 0 PID: 24099 Comm: syz-executor.3 Not tainted 6.0.0-rc3-next-20220901-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:317 [inline]
 print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
 vma_start_pgoff mm/interval_tree.c:15 [inline]
 avc_start_pgoff mm/interval_tree.c:63 [inline]
 __anon_vma_interval_tree_insert mm/interval_tree.c:71 [inline]
 anon_vma_interval_tree_insert+0x3e8/0x4b0 mm/interval_tree.c:82
 anon_vma_interval_tree_post_update_vma mm/mmap.c:390 [inline]
 __vma_adjust+0x81a/0x1a70 mm/mmap.c:815
 vma_merge+0x6a8/0x870 mm/mmap.c:1063
 userfaultfd_release+0x4b6/0x680 fs/userfaultfd.c:886
 __fput+0x27c/0xa90 fs/file_table.c:320
 task_work_run+0x16b/0x270 kernel/task_work.c:179
 get_signal+0x1c3/0x2610 kernel/signal.c:2635
 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869
 exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
 exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f25eec89279
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f25ee3ff168 EFLAGS: 00000246 ORIG_RAX: 0000000000000013
RAX: fffffffffffffe00 RBX: 00007f25eed9bf80 RCX: 00007f25eec89279
RDX: 0000000000000001 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007f25eece32e9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd8d414adf R14: 00007f25ee3ff300 R15: 0000000000022000
 </TASK>

Allocated by task 24099:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:437 [inline]
 __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:470
 kasan_slab_alloc include/linux/kasan.h:224 [inline]
 slab_post_alloc_hook mm/slab.h:737 [inline]
 slab_alloc_node mm/slub.c:3317 [inline]
 slab_alloc mm/slub.c:3325 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3332 [inline]
 kmem_cache_alloc+0x2b7/0x3d0 mm/slub.c:3341
 vm_area_dup+0x81/0x380 kernel/fork.c:466
 copy_vma+0x376/0x880 mm/mmap.c:3220
 move_vma+0x449/0xf60 mm/mremap.c:626
 __do_sys_mremap+0x487/0x16b0 mm/mremap.c:1075
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 24099:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:45
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:367 [inline]
 ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329
 kasan_slab_free include/linux/kasan.h:200 [inline]
 slab_free_hook mm/slub.c:1651 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1677
 slab_free mm/slub.c:3580 [inline]
 kmem_cache_free+0xe7/0x5b0 mm/slub.c:3602
 copy_vma+0x6bc/0x880 mm/mmap.c:3247
 move_vma+0x449/0xf60 mm/mremap.c:626
 __do_sys_mremap+0x487/0x16b0 mm/mremap.c:1075
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88801fcc35e8
 which belongs to the cache vm_area_struct of size 152
The buggy address is located 104 bytes inside of
 152-byte region [ffff88801fcc35e8, ffff88801fcc3680)

The buggy address belongs to the physical page:
page:ffffea00007f30c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1fcc3
memcg:ffff888022d4b301
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00007f67c0 dead000000000004 ffff888140006b40
raw: 0000000000000000 0000000000120012 00000001ffffffff ffff888022d4b301
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 6609, tgid 6609 (dhcpcd-run-hook), ts 283330608692, free_ts 279586140334
 prep_new_page mm/page_alloc.c:2534 [inline]
 get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4284
 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5542
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2280
 alloc_slab_page mm/slub.c:1721 [inline]
 allocate_slab+0x228/0x370 mm/slub.c:1866
 new_slab mm/slub.c:1919 [inline]
 ___slab_alloc+0xad0/0x1440 mm/slub.c:3100
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3198
 slab_alloc_node mm/slub.c:3283 [inline]
 slab_alloc mm/slub.c:3325 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3332 [inline]
 kmem_cache_alloc+0x31c/0x3d0 mm/slub.c:3341
 vm_area_dup+0x81/0x380 kernel/fork.c:466
 dup_mmap+0x655/0x10b0 kernel/fork.c:643
 dup_mm+0x91/0x370 kernel/fork.c:1528
 copy_mm kernel/fork.c:1577 [inline]
 copy_process+0x3be1/0x7120 kernel/fork.c:2258
 kernel_clone+0xe7/0xab0 kernel/fork.c:2678
 __do_sys_clone+0xba/0x100 kernel/fork.c:2819
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1451 [inline]
 free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1501
 free_unref_page_prepare mm/page_alloc.c:3382 [inline]
 free_unref_page+0x19/0x4d0 mm/page_alloc.c:3478
 __vunmap+0x85d/0xd30 mm/vmalloc.c:2697
 __vfree+0x3c/0xd0 mm/vmalloc.c:2745
 vfree+0x5a/0x90 mm/vmalloc.c:2776
 kvfree+0x2e/0x50 mm/util.c:621
 kvm_arch_free_memslot+0x111/0x1c0 arch/x86/kvm/x86.c:12257
 kvm_free_memslot arch/x86/kvm/../../../virt/kvm/kvm_main.c:971 [inline]
 kvm_free_memslots.part.0+0x101/0x1a0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:992
 kvm_free_memslots arch/x86/kvm/../../../virt/kvm/kvm_main.c:988 [inline]
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1324 [inline]
 kvm_put_kvm+0x83e/0xb70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1354
 kvm_vcpu_release+0x4d/0x70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3818
 __fput+0x27c/0xa90 fs/file_table.c:320
 task_work_run+0x16b/0x270 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:169 [inline]
 exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88801fcc3500: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801fcc3580: 00 00 00 00 00 fc fc fc fc fc fc fc fc fa fb fb
>ffff88801fcc3600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88801fcc3680: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
 ffff88801fcc3700: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/09/04 13:18 linux-next e47eb90a0a9a 28811d0a .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in anon_vma_interval_tree_insert
2022/07/14 05:23 linux-next cb71b93c2dc3 5d921b08 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in anon_vma_interval_tree_insert
* Struck through repros no longer work on HEAD.