KASAN: use-after-free Write in __vb2_cleanup_fileio

已查看 9 次
跳至第一个未读帖子

syzbot

未读,
2019年10月5日 21:28:092019/10/5
收件人 syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: db189223 Linux 4.14.147
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15540057600000
kernel config: https://syzkaller.appspot.com/x/.config?x=14d726467704dd7
dashboard link: https://syzkaller.appspot.com/bug?extid=e76a7c3ee3b39853689e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

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+e76a7c...@syzkaller.appspotmail.com

protocol 88fb is buggy, dev hsr_slave_0
protocol 88fb is buggy, dev hsr_slave_1
==================================================================
BUG: KASAN: use-after-free in __vb2_cleanup_fileio+0x134/0x150
drivers/media/v4l2-core/videobuf2-core.c:2315
Write of size 4 at addr ffff8880a6333240 by task syz-executor.4/4474

CPU: 1 PID: 4474 Comm: syz-executor.4 Not tainted 4.14.147 #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+0x138/0x197 lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
__asan_report_store4_noabort+0x17/0x20 mm/kasan/report.c:434
__vb2_cleanup_fileio+0x134/0x150
drivers/media/v4l2-core/videobuf2-core.c:2315
vb2_core_queue_release+0x1d/0x80
drivers/media/v4l2-core/videobuf2-core.c:2040
vb2_queue_release drivers/media/v4l2-core/videobuf2-v4l2.c:669 [inline]
_vb2_fop_release+0x1cf/0x2a0 drivers/media/v4l2-core/videobuf2-v4l2.c:840
vb2_fop_release+0x75/0xc0 drivers/media/v4l2-core/videobuf2-v4l2.c:854
vivid_fop_release+0x180/0x3f0 drivers/media/platform/vivid/vivid-core.c:486
v4l2_release+0xf9/0x190 drivers/media/v4l2-core/v4l2-dev.c:446
__fput+0x275/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x114/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 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+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x413741
RSP: 002b:00007ffcacea5ce0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000413741
RDX: 0000001b2d920000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: 000000006e783fbb R09: 000000006e783fbf
R10: 00007ffcacea5dc0 R11: 0000000000000293 R12: 000000000075bf20
R13: 00000000000c8cc2 R14: 00000000007603e0 R15: 000000000075bf2c

Allocated by task 4477:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
__vb2_init_fileio+0x182/0xa90 drivers/media/v4l2-core/videobuf2-core.c:2224
__vb2_perform_fileio+0x9f0/0xeb0
drivers/media/v4l2-core/videobuf2-core.c:2358
vb2_read+0x3b/0x50 drivers/media/v4l2-core/videobuf2-core.c:2490
vb2_fop_read+0x1f5/0x3e0 drivers/media/v4l2-core/videobuf2-v4l2.c:895
v4l2_read+0x1a9/0x200 drivers/media/v4l2-core/v4l2-dev.c:309
do_loop_readv_writev fs/read_write.c:695 [inline]
do_loop_readv_writev fs/read_write.c:682 [inline]
do_iter_read+0x3e2/0x5b0 fs/read_write.c:919
vfs_readv+0xd3/0x130 fs/read_write.c:981
do_readv+0x10a/0x2d0 fs/read_write.c:1014
SYSC_readv fs/read_write.c:1101 [inline]
SyS_readv+0x28/0x30 fs/read_write.c:1098
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4471:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
__vb2_cleanup_fileio+0xfc/0x150
drivers/media/v4l2-core/videobuf2-core.c:2317
vb2_core_queue_release+0x1d/0x80
drivers/media/v4l2-core/videobuf2-core.c:2040
vb2_queue_release drivers/media/v4l2-core/videobuf2-v4l2.c:669 [inline]
_vb2_fop_release+0x1cf/0x2a0 drivers/media/v4l2-core/videobuf2-v4l2.c:840
vb2_fop_release+0x75/0xc0 drivers/media/v4l2-core/videobuf2-v4l2.c:854
vivid_fop_release+0x180/0x3f0 drivers/media/platform/vivid/vivid-core.c:486
v4l2_release+0xf9/0x190 drivers/media/v4l2-core/v4l2-dev.c:446
__fput+0x275/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x114/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 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+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880a6333240
which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 0 bytes inside of
1024-byte region [ffff8880a6333240, ffff8880a6333640)
The buggy address belongs to the page:
page:ffffea000298cc80 count:1 mapcount:0 mapping:ffff8880a6332040
index:0xffff8880a63336c0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880a6332040 ffff8880a63336c0 0000000100000005
raw: ffffea00026608a0 ffffea00016df720 ffff8880aa800ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a6333100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a6333180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
> ffff8880a6333200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8880a6333280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a6333300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
audit: type=1400 audit(2000000636.950:125): avc: denied { ioctl } for
pid=4473 comm="syz-executor.0" path="socket:[150900]" dev="sockfs"
ino=150900 ioctlcmd=0x8935
scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tclass=netlink_crypto_socket permissive=1


---
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#status for how to communicate with syzbot.

syzbot

未读,
2019年11月5日 10:23:092019/11/5
收件人 syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: ddef1e8e Linux 4.14.151
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1078983ae00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2b317f0c5f02ed3
dashboard link: https://syzkaller.appspot.com/bug?extid=e76a7c3ee3b39853689e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17cf152ae00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=152fae68e00000

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

==================================================================
BUG: KASAN: use-after-free in __vb2_cleanup_fileio+0x134/0x150
drivers/media/v4l2-core/videobuf2-core.c:2315
Write of size 4 at addr ffff8880a1f92040 by task syz-executor042/7328

CPU: 0 PID: 7328 Comm: syz-executor042 Not tainted 4.14.151 #0
RIP: 0033:0x44d059
RSP: 002b:00007fd168296ce8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00000000006e5a08 RCX: 000000000044d059
RDX: 000000000044d059 RSI: 0000000000000000 RDI: 0000000000000005
RBP: 00000000006e5a00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006e5a0c
R13: 00007fffe975cc8f R14: 00007fd1682979c0 R15: 20c49ba5e353f7cf

Allocated by task 7329:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
__vb2_init_fileio+0x182/0xa90 drivers/media/v4l2-core/videobuf2-core.c:2224
__vb2_perform_fileio+0x9f0/0xeb0
drivers/media/v4l2-core/videobuf2-core.c:2358
vb2_read+0x3b/0x50 drivers/media/v4l2-core/videobuf2-core.c:2490
vb2_fop_read+0x1f5/0x3e0 drivers/media/v4l2-core/videobuf2-v4l2.c:895
v4l2_read+0x1a9/0x200 drivers/media/v4l2-core/v4l2-dev.c:309
__vfs_read+0x105/0x6a0 fs/read_write.c:411
vfs_read+0x137/0x350 fs/read_write.c:447
SYSC_read fs/read_write.c:574 [inline]
SyS_read+0xfd/0x230 fs/read_write.c:567
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7329:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
__vb2_cleanup_fileio+0xfc/0x150
drivers/media/v4l2-core/videobuf2-core.c:2317
vb2_core_queue_release+0x1d/0x80
drivers/media/v4l2-core/videobuf2-core.c:2040
vb2_queue_release drivers/media/v4l2-core/videobuf2-v4l2.c:669 [inline]
_vb2_fop_release+0x1cf/0x2a0 drivers/media/v4l2-core/videobuf2-v4l2.c:840
vb2_fop_release+0x75/0xc0 drivers/media/v4l2-core/videobuf2-v4l2.c:854
vivid_fop_release+0x180/0x3f0 drivers/media/platform/vivid/vivid-core.c:486
v4l2_release+0xf9/0x190 drivers/media/v4l2-core/v4l2-dev.c:446
__fput+0x275/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x114/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1da/0x220 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+0x4bc/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880a1f92040
which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 0 bytes inside of
1024-byte region [ffff8880a1f92040, ffff8880a1f92440)
The buggy address belongs to the page:
page:ffffea000287e480 count:1 mapcount:0 mapping:ffff8880a1f92040 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880a1f92040 0000000000000000 0000000100000007
raw: ffffea00024b59a0 ffffea000272f420 ffff8880aa800ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a1f91f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a1f91f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8880a1f92000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8880a1f92080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a1f92100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

回复全部
回复作者
转发
0 个新帖子