KASAN: use-after-free Read in relay_switch_subbuf

9 views
Skip to first unread message

syzbot

unread,
Apr 28, 2019, 11:57:07 PM4/28/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 19bb613a Linux 4.19.37
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=130d7834a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2f4f1677ff80cdff
dashboard link: https://syzkaller.appspot.com/bug?extid=77ab339a849138392812
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+77ab33...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in relay_switch_subbuf+0x8c0/0x930
kernel/relay.c:755
Read of size 8 at addr ffff88805114acf8 by task loop4/17029

CPU: 0 PID: 17029 Comm: loop4 Not tainted 4.19.37 #5
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
syz-executor.5 invoked oom-killer: gfp_mask=0x6000c0(GFP_KERNEL),
nodemask=(null), order=0, oom_score_adj=1000
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
relay_switch_subbuf+0x8c0/0x930 kernel/relay.c:755
relay_reserve include/linux/relay.h:261 [inline]
trace_note.isra.0+0x5b8/0x6e0 kernel/trace/blktrace.c:93
trace_note_tsk kernel/trace/blktrace.c:124 [inline]
__blk_add_trace+0xb70/0xe10 kernel/trace/blktrace.c:264
syz-executor.5 cpuset=
blk_add_trace_rq+0x192/0x210 kernel/trace/blktrace.c:818
blk_add_trace_rq_complete+0x153/0x1b0 kernel/trace/blktrace.c:847
trace_block_rq_complete include/trace/events/block.h:116 [inline]
blk_update_request+0x79f/0xb30 block/blk-core.c:3080
blk_mq_end_request+0x5b/0x360 block/blk-mq.c:544
syz5
lo_complete_rq+0x219/0x2f0 drivers/block/loop.c:484
__blk_mq_complete_request block/blk-mq.c:583 [inline]
blk_mq_complete_request+0x3c2/0x680 block/blk-mq.c:620
loop_handle_cmd drivers/block/loop.c:1896 [inline]
loop_queue_work+0x2ab/0x2388 drivers/block/loop.c:1905
mems_allowed=0-1
kthread_worker_fn+0x2c9/0x7a0 kernel/kthread.c:662
loop_kthread_worker_fn+0x51/0x60 drivers/block/loop.c:890
kthread+0x357/0x430 kernel/kthread.c:246
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

CPU: 1 PID: 17026 Comm: syz-executor.5 Not tainted 4.19.37 #5
Allocated by task 15591:
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
Call Trace:
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
dump_header+0x15e/0x929 mm/oom_kill.c:441
kmem_cache_alloc+0x12e/0x700 mm/slab.c:3559
__d_alloc+0x2e/0x9d0 fs/dcache.c:1610
d_alloc_pseudo+0x1e/0x30 fs/dcache.c:1738
alloc_file_pseudo+0xe2/0x280 fs/file_table.c:224
oom_kill_process.cold+0x10/0x6f5 mm/oom_kill.c:954
sock_alloc_file+0x4d/0x170 net/socket.c:394
sock_map_fd net/socket.c:417 [inline]
__sys_socket+0x150/0x220 net/socket.c:1350
out_of_memory mm/oom_kill.c:1129 [inline]
out_of_memory+0x936/0x12d0 mm/oom_kill.c:1062
__do_sys_socket net/socket.c:1355 [inline]
__se_sys_socket net/socket.c:1353 [inline]
__x64_sys_socket+0x73/0xb0 net/socket.c:1353
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

mem_cgroup_out_of_memory+0x1d2/0x240 mm/memcontrol.c:1397
Freed by task 15591:
save_stack+0x45/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
mem_cgroup_oom mm/memcontrol.c:1723 [inline]
try_charge+0x1028/0x15b0 mm/memcontrol.c:2285
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
__d_free fs/dcache.c:257 [inline]
dentry_free+0xed/0x170 fs/dcache.c:348
__dentry_kill+0x45f/0x610 fs/dcache.c:580
dentry_kill+0xd7/0x5e0 fs/dcache.c:685
dput+0x570/0x6a0 fs/dcache.c:846
mem_cgroup_try_charge+0x24d/0x5e0 mm/memcontrol.c:5953
__fput+0x429/0x8b0 fs/file_table.c:291
____fput+0x16/0x20 fs/file_table.c:309
mem_cgroup_try_charge_delay+0x1f/0xa0 mm/memcontrol.c:5968
task_work_run+0x14a/0x1c0 kernel/task_work.c:113
do_anonymous_page mm/memory.c:3176 [inline]
handle_pte_fault mm/memory.c:4033 [inline]
__handle_mm_fault+0x1e55/0x3f80 mm/memory.c:4159
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166
prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88805114aca0
which belongs to the cache dentry(33:syz2) of size 288
The buggy address is located 88 bytes inside of
288-byte region [ffff88805114aca0, ffff88805114adc0)
handle_mm_fault+0x43f/0xb30 mm/memory.c:4196
The buggy address belongs to the page:
page:ffffea0001445280 count:1 mapcount:0 mapping:ffff8880a00364c0
index:0xffff88805114a720
faultin_page mm/gup.c:518 [inline]
__get_user_pages+0x609/0x1770 mm/gup.c:718
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880826fa638 ffffea00020c8148 ffff8880a00364c0
populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1222
raw: ffff88805114a720 ffff88805114a040 0000000100000005 ffff8880936f85c0
__mm_populate+0x204/0x380 mm/gup.c:1270
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8880936f85c0
mm_populate include/linux/mm.h:2315 [inline]
vm_mmap_pgoff+0x213/0x230 mm/util.c:362

Memory state around the buggy address:
ffff88805114ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805114ac00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ffff88805114ac80: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
ksys_mmap_pgoff+0xf7/0x630 mm/mmap.c:1586
^
ffff88805114ad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805114ad80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


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

unread,
Oct 23, 2020, 9:02:11 PM10/23/20
to syzkaller...@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