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

4 views
Skip to first unread message

syzbot

unread,
Oct 13, 2018, 3:15:04 AM10/13/18
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: ae16eea39a86 Add linux-next specific files for 20181008
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11524c06400000
kernel config: https://syzkaller.appspot.com/x/.config?x=42525ce985d1a955
dashboard link: https://syzkaller.appspot.com/bug?extid=57cd8c7dad6e0401ab49
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
CC: [linux-...@vger.kernel.org linux-...@vger.kernel.org
vi...@zeniv.linux.org.uk]

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+57cd8c...@syzkaller.appspotmail.com

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


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.

syzbot

unread,
Apr 7, 2019, 2:12:05 AM4/7/19
to syzkaller-upst...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages