syzbot


KASAN: use-after-free Read in __free_vmap_area

Status: auto-closed as invalid on 2021/06/25 08:49
Reported-by: syzbot+fa3ed26b9c024833250a@syzkaller.appspotmail.com
First crash: 484d, last: 484d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 general protection fault in __free_vmap_area 2 386d 387d 0/1 auto-closed as invalid on 2021/10/01 12:38

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ____rb_erase_color lib/rbtree.c:384 [inline]
BUG: KASAN: use-after-free in rb_erase+0xf1f/0x1290 lib/rbtree.c:462
Read of size 8 at addr ffff88800010c018 by task syz-executor.3/7991

CPU: 1 PID: 7991 Comm: syz-executor.3 Not tainted 4.14.222-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 ____rb_erase_color lib/rbtree.c:384 [inline]
 rb_erase+0xf1f/0x1290 lib/rbtree.c:462
 __free_vmap_area+0xe7/0x310 mm/vmalloc.c:577
 __purge_vmap_area_lazy+0x162/0x250 mm/vmalloc.c:707
 try_purge_vmap_area_lazy mm/vmalloc.c:722 [inline]
 free_vmap_area_noflush+0xa9/0xd0 mm/vmalloc.c:754
 free_unmap_vmap_area mm/vmalloc.c:764 [inline]
 remove_vm_area+0x22b/0x2c0 mm/vmalloc.c:1509
 __vunmap+0x114/0x300 mm/vmalloc.c:1537
 vfree+0x4b/0xd0 mm/vmalloc.c:1612
 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:885 [inline]
 get_entries net/ipv6/netfilter/ip6_tables.c:1044 [inline]
 do_ip6t_get_ctl+0x5fc/0x7d0 net/ipv6/netfilter/ip6_tables.c:1713
 nf_sockopt net/netfilter/nf_sockopt.c:104 [inline]
 nf_getsockopt+0x62/0xc0 net/netfilter/nf_sockopt.c:122
 ipv6_getsockopt+0x146/0x1e0 net/ipv6/ipv6_sockglue.c:1376
 tcp_getsockopt+0x7b/0xc0 net/ipv4/tcp.c:3257
 SYSC_getsockopt net/socket.c:1896 [inline]
 SyS_getsockopt+0x102/0x1c0 net/socket.c:1878
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x46750a
RSP: 002b:00007ffc912872e8 EFLAGS: 00000212 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 0000000000000029 RCX: 000000000046750a
RDX: 0000000000000041 RSI: 0000000000000029 RDI: 0000000000000003
RBP: 00007ffc91287310 R08: 00007ffc9128730c R09: 0079746972756365
R10: 00007ffc91287370 R11: 0000000000000212 R12: 00007ffc91287370
R13: 0000000000000003 R14: 00007ffc9128730c R15: 000000000053df80

Allocated by task 4630:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 aa_alloc_file_ctx security/apparmor/include/file.h:60 [inline]
 apparmor_file_alloc_security+0x129/0x800 security/apparmor/lsm.c:431
 security_file_alloc+0x66/0xa0 security/security.c:874
 get_empty_filp+0x15c/0x3e0 fs/file_table.c:129
 path_openat+0x84/0x2970 fs/namei.c:3545
 do_filp_open+0x179/0x3c0 fs/namei.c:3603
 do_sys_open+0x296/0x410 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 4630:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 aa_free_file_ctx security/apparmor/include/file.h:76 [inline]
 apparmor_file_free_security+0x7e/0xb0 security/apparmor/lsm.c:441
 security_file_free+0x42/0x80 security/security.c:879
 __fput+0x26c/0x7a0 fs/file_table.c:211
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff88800010c000
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 24 bytes inside of
 96-byte region [ffff88800010c000, ffff88800010c060)
The buggy address belongs to the page:
page:ffffea0000004300 count:1 mapcount:0 mapping:ffff88800010c000 index:0x0
flags: 0x7ff00000000100(slab)
raw: 007ff00000000100 ffff88800010c000 0000000000000000 0000000100000020
raw: ffffea0002d84a20 ffffea00026b1ba0 ffff88813fe804c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88800010bf00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff88800010bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88800010c000: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                            ^
 ffff88800010c080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88800010c100: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/02/25 08:48 linux-4.14.y 3242aa3a635c fcc6d71b .config log report info KASAN: use-after-free Read in __free_vmap_area