syzbot


KASAN: use-after-free Read in __vunmap

Status: auto-closed as invalid on 2019/02/22 10:26
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+132f0390e358e8634ad2@syzkaller.appspotmail.com
First crash: 2253d, last: 2212d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __vunmap+0x359/0x3c0 mm/vmalloc.c:1529
Read of size 8 at addr ffff8801d0a7c010 by task kworker/0:2/2077

CPU: 0 PID: 2077 Comm: kworker/0:2 Not tainted 4.16.0+ #2
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events bpf_prog_free_deferred
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b9/0x29f lib/dump_stack.c:53
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __vunmap+0x359/0x3c0 mm/vmalloc.c:1529
 vfree+0x68/0x100 mm/vmalloc.c:1606
 bpf_jit_free+0xf9/0x460
 bpf_prog_free_deferred+0x285/0x3f0 kernel/bpf/core.c:1718
 process_one_work+0xc1e/0x1b50 kernel/workqueue.c:2145
 worker_thread+0x1cc/0x1440 kernel/workqueue.c:2279
 kthread+0x345/0x410 kernel/kthread.c:238
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:411

Allocated by task 5970:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:552
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3608
 kmalloc include/linux/slab.h:512 [inline]
 inotify_handle_event+0x302/0x4c0 fs/notify/inotify/inotify_fsnotify.c:101
 inotify_ignored_and_remove_idr+0x32/0x80 fs/notify/inotify/inotify_user.c:476
 inotify_freeing_mark+0x1d/0x30 fs/notify/inotify/inotify_fsnotify.c:127
 fsnotify_free_mark+0xf6/0x150 fs/notify/mark.c:384
 fsnotify_destroy_mark+0x3e/0x50 fs/notify/mark.c:393
 SYSC_inotify_rm_watch fs/notify/inotify/inotify_user.c:755 [inline]
 SyS_inotify_rm_watch+0xe0/0x13f fs/notify/inotify/inotify_user.c:730
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2360:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3486 [inline]
 kfree+0xd9/0x260 mm/slab.c:3801
 inotify_free_event+0x15/0x20 fs/notify/inotify/inotify_fsnotify.c:176
 fsnotify_destroy_event.part.1+0x1a8/0x270 fs/notify/notification.c:87
 fsnotify_destroy_event+0x69/0x80 fs/notify/notification.c:74
 inotify_read+0x5a8/0x9b0 fs/notify/inotify/inotify_user.c:246
 __vfs_read+0x10f/0x970 fs/read_write.c:416
 vfs_read+0x17f/0x3d0 fs/read_write.c:452
 ksys_read+0xf9/0x250 fs/read_write.c:578
 SYSC_read fs/read_write.c:588 [inline]
 SyS_read+0x24/0x30 fs/read_write.c:586
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d0a7c000
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 16 bytes inside of
 64-byte region [ffff8801d0a7c000, ffff8801d0a7c040)
The buggy address belongs to the page:
page:ffffea0007429f00 count:1 mapcount:0 mapping:ffff8801d0a7c000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d0a7c000 0000000000000000 0000000100000020
raw: ffffea0007613360 ffffea0006ab9020 ffff8801dac00340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d0a7bf00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8801d0a7bf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8801d0a7c000: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                         ^
 ffff8801d0a7c080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801d0a7c100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/05 23:29 upstream e02d37bf55a9 a932eae6 .config console log report ci-upstream-kasan-gce
2018/04/03 21:21 upstream f2d285669aae 676bd07e .config console log report ci-upstream-kasan-gce-386
2018/02/24 13:47 upstream 9cb9c07d6b0c 5c1e0207 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.