syzbot


KASAN: slab-out-of-bounds Read in put_files_struct

Status: auto-closed as invalid on 2019/04/07 06:12
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+57cd8c7dad6e0401ab49@syzkaller.appspotmail.com
First crash: 2034d, last: 2034d

Sample crash report:
binder: 27217:27218 IncRefs 0 refcount change on invalid ref 1 ret -22
==================================================================
BUG: KASAN: slab-out-of-bounds in close_files fs/file.c:383 [inline]
BUG: KASAN: slab-out-of-bounds in put_files_struct+0x376/0x3c0 fs/file.c:416
Read of size 8 at addr ffff880184a4c448 by task syz-executor2/20917

CPU: 1 PID: 20917 Comm: syz-executor2 Not tainted 4.19.0-rc7-next-20181008+ #89
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+0x244/0x3ab lib/dump_stack.c:113
 print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 close_files fs/file.c:383 [inline]
 put_files_struct+0x376/0x3c0 fs/file.c:416
 exit_files+0x83/0xb0 fs/file.c:445
 do_exit+0xf40/0x2610 kernel/exit.c:862
 do_group_exit+0x177/0x440 kernel/exit.c:970
 get_signal+0x8a8/0x1970 kernel/signal.c:2517
binder: release 27225:27226 transaction 74 out, still active
binder: unexpected work type, 4, not freed
 do_signal+0x9c/0x21c0 arch/x86/kernel/signal.c:816
binder: undelivered TRANSACTION_COMPLETE
binder: invalid inc weak node for 75
 exit_to_usermode_loop+0x2e5/0x380 arch/x86/entry/common.c:162
binder: 27225:27226 IncRefs 0 refcount change on invalid ref 1 ret -22
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
binder: send failed reply for transaction 74, target dead
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457579
Code: Bad RIP value.
RSP: 002b:00007faa98052c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
RAX: fffffffffffffe00 RBX: 0000000000000003 RCX: 0000000000457579
RDX: 0000000020000740 RSI: 0000000020000840 RDI: 0000000000000007
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007faa980536d4
R13: 00000000004bd5a8 R14: 00000000004cbcf8 R15: 00000000ffffffff

Allocated by task 17659:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3684 [inline]
 __kmalloc_node+0x50/0x70 mm/slab.c:3691
 kmalloc_node include/linux/slab.h:589 [inline]
 kvmalloc_node+0x65/0xf0 mm/util.c:423
 kvmalloc include/linux/mm.h:577 [inline]
 alloc_fdtable+0x145/0x280 fs/file.c:120
 dup_fd+0xa71/0xf50 fs/file.c:310
 copy_files kernel/fork.c:1423 [inline]
 copy_process+0x2734/0x8760 kernel/fork.c:1905
 _do_fork+0x1cb/0x11c0 kernel/fork.c:2216
 __do_sys_clone kernel/fork.c:2323 [inline]
 __se_sys_clone kernel/fork.c:2317 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2317
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 19634:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 kvfree+0x61/0x70 mm/util.c:452
 __free_fdtable+0x55/0x70 fs/file.c:32
 put_files_struct+0x31d/0x3c0 fs/file.c:420
 exit_files+0x83/0xb0 fs/file.c:445
 copy_process+0x3c44/0x8760 kernel/fork.c:2126
 _do_fork+0x1cb/0x11c0 kernel/fork.c:2216
 __do_sys_clone kernel/fork.c:2323 [inline]
 __se_sys_clone kernel/fork.c:2317 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2317
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff880184a4c400
 which belongs to the cache kmalloc-96(49:syz2) of size 96
The buggy address is located 72 bytes inside of
 96-byte region [ffff880184a4c400, ffff880184a4c460)
The buggy address belongs to the page:
page:ffffea0006129300 count:1 mapcount:0 mapping:ffff8801bd7c4300 index:0x0
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea000739e9c8 ffff8801cd70b148 ffff8801bd7c4300
raw: 0000000000000000 ffff880184a4c000 0000000100000020 ffff8801d319c280
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801d319c280

Memory state around the buggy address:
 ffff880184a4c300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff880184a4c380: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff880184a4c400: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
                                              ^
 ffff880184a4c480: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff880184a4c500: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
ebt_limit: overflow, try lower: 0/0
ebt_limit: overflow, try lower: 0/0
binder: release 27237:27239 transaction 78 out, still active
binder: unexpected work type, 4, not freed

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/10/09 06:11 linux-next ae16eea39a86 8b311eaf .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.