KASAN: use-after-free Read in finish_wait

11 views
Skip to first unread message

syzbot

unread,
Jun 7, 2018, 5:27:04 PM6/7/18
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 7170e6045a6a strparser: Add __strp_unpause and use it in k..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1123256f800000
kernel config: https://syzkaller.appspot.com/x/.config?x=a601a80fec461d44
dashboard link: https://syzkaller.appspot.com/bug?extid=e80e13fc7c6ecb3cc4df
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+e80e13...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3888/0x5140
kernel/locking/lockdep.c:3310
Read of size 8 at addr ffff8801cd41a858 by task syz-executor0/4610

CPU: 0 PID: 4610 Comm: syz-executor0 Not tainted 4.17.0-rc7+ #82
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+0x1b9/0x294 lib/dump_stack.c:113
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
__lock_acquire+0x3888/0x5140 kernel/locking/lockdep.c:3310
lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
finish_wait+0x116/0x420 kernel/sched/wait.c:364
pipe_wait+0x1b4/0x2a0 fs/pipe.c:117
pipe_read+0x37c/0x940 fs/pipe.c:333
call_read_iter include/linux/fs.h:1778 [inline]
new_sync_read fs/read_write.c:406 [inline]
__vfs_read+0x696/0xa50 fs/read_write.c:418
vfs_read+0x17f/0x3d0 fs/read_write.c:452
kernel_read+0xab/0x120 fs/read_write.c:431
__bpfilter_process_sockopt+0x238/0x35b net/bpfilter/bpfilter_kern.c:74
bpfilter_mbox_request+0x4d/0xb0 net/ipv4/bpfilter/sockopt.c:25
bpfilter_ip_get_sockopt+0x6b/0x90 net/ipv4/bpfilter/sockopt.c:42
ip_getsockopt+0x238/0x2a0 net/ipv4/ip_sockglue.c:1563
tcp_getsockopt+0x93/0xe0 net/ipv4/tcp.c:3543
sock_common_getsockopt+0x9a/0xe0 net/core/sock.c:3018
__sys_getsockopt+0x1a5/0x370 net/socket.c:1940
__do_sys_getsockopt net/socket.c:1951 [inline]
__se_sys_getsockopt net/socket.c:1948 [inline]
__x64_sys_getsockopt+0xbe/0x150 net/socket.c:1948
do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4584ea
RSP: 002b:0000000000a3e328 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 0000000000a3e350 RCX: 00000000004584ea
RDX: 0000000000000040 RSI: 0000000000000000 RDI: 0000000000000013
RBP: 0000000000705f20 R08: 0000000000a3e34c R09: 0000000000004000
R10: 0000000000a3e350 R11: 0000000000000246 R12: 0000000000000013
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000703d60

Allocated by task 2201:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
kmalloc include/linux/slab.h:512 [inline]
kzalloc include/linux/slab.h:701 [inline]
alloc_pipe_info+0x16d/0x580 fs/pipe.c:633
get_pipe_inode fs/pipe.c:712 [inline]
create_pipe_files+0xd0/0x940 fs/pipe.c:745
umh_pipe_setup+0x17b/0x430 kernel/umh.c:442
call_usermodehelper_exec_async+0x3c0/0x9e0 kernel/umh.c:93
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412

Freed by task 2201:
save_stack+0x43/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3498 [inline]
kfree+0xd9/0x260 mm/slab.c:3813
free_pipe_info+0x253/0x300 fs/pipe.c:684
put_pipe_info+0xd0/0xf0 fs/pipe.c:556
pipe_release+0x1de/0x270 fs/pipe.c:577
__fput+0x34d/0x890 fs/file_table.c:209
____fput+0x15/0x20 fs/file_table.c:243
task_work_run+0x1e4/0x290 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x1aee/0x2730 kernel/exit.c:865
do_group_exit+0x16f/0x430 kernel/exit.c:968
get_signal+0x886/0x1960 kernel/signal.c:2482
do_signal+0x98/0x2040 arch/x86/kernel/signal.c:810
exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162
prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
do_syscall_64+0x6ac/0x800 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801cd41a7c0
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 152 bytes inside of
512-byte region [ffff8801cd41a7c0, ffff8801cd41a9c0)
The buggy address belongs to the page:
page:ffffea0007350680 count:1 mapcount:0 mapping:ffff8801cd41a040
index:0xffff8801cd41a2c0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801cd41a040 ffff8801cd41a2c0 0000000100000005
raw: ffffea0006b610e0 ffffea0007105b20 ffff8801da800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801cd41a700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8801cd41a780: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
> ffff8801cd41a800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801cd41a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801cd41a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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.

Dmitry Vyukov

unread,
Jun 8, 2018, 3:49:09 AM6/8/18
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
#syz fix: bpfilter: fix race in pipe access
> ^
> ffff8801cd41a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801cd41a900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
>
>
> ---
> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-upstream-m...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-upstream-moderation/000000000000c38b3e056e13f18f%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages