KASAN: use-after-free Read in wake_up_if_idle
From: syzbot
Date: Mon Oct 29 2018 - 10:47:07 EST
Hello,
syzbot found the following crash on:
HEAD commit: 23469de647c4 Merge git://git.kernel.org/pub/scm/linux/kern..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1641fa1d400000
kernel config: https://syzkaller.appspot.com/x/.config?x=b3f55cb3dfcc6c33
dashboard link: https://syzkaller.appspot.com/bug?extid=2c1253bc508adef78a7f
compiler: gcc (GCC) 8.0.1 20180413 (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+2c1253bc508adef78a7f@xxxxxxxxxxxxxxxxxxxxxxxxx
could not allocate digest TFM handle poly1305-simd
could not allocate digest TFM handle poly1305-simd
could not allocate digest TFM handle poly1305-simdïïï
==================================================================
BUG: KASAN: use-after-free in is_idle_task include/linux/sched.h:1534
[inline]
BUG: KASAN: use-after-free in wake_up_if_idle+0x482/0x580
kernel/sched/core.c:1804
Read of size 4 at addr ffff8801cc80a5e4 by task syz-executor5/12113
CPU: 0 PID: 12113 Comm: syz-executor5 Not tainted 4.19.0-rc8+ #72
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+0x1c4/0x2b6 lib/dump_stack.c:113
print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
is_idle_task include/linux/sched.h:1534 [inline]
wake_up_if_idle+0x482/0x580 kernel/sched/core.c:1804
wake_up_all_idle_cpus+0x72/0xc0 kernel/smp.c:744
cpuidle_latency_notify+0xe/0x20 drivers/cpuidle/cpuidle.c:666
notifier_call_chain+0x17e/0x380 kernel/notifier.c:93
__blocking_notifier_call_chain kernel/notifier.c:317 [inline]
blocking_notifier_call_chain+0x147/0x190 kernel/notifier.c:328
pm_qos_update_target+0x49a/0xd50 kernel/power/qos.c:316
pm_qos_remove_request+0x1c0/0x640 kernel/power/qos.c:542
snd_pcm_release_substream.part.46+0x261/0x330 sound/core/pcm_native.c:2390
snd_pcm_release_substream+0x61/0x80 sound/core/pcm_native.c:2378
snd_pcm_oss_release_file.part.23+0x71/0xa0 sound/core/oss/pcm_oss.c:2382
snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2377 [inline]
snd_pcm_oss_release+0x114/0x290 sound/core/oss/pcm_oss.c:2562
__fput+0x385/0xa30 fs/file_table.c:278
____fput+0x15/0x20 fs/file_table.c:309
task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x318/0x380 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+0x6be/0x820 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457569
Code: fd b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 0f 83 cb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fbc5e6f3c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffea RBX: 0000000000000004 RCX: 0000000000457569
RDX: 0000000000105000 RSI: 0000000020000140 RDI: ffffffffffffff9c
RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbc5e6f46d4
R13: 00000000004c2b76 R14: 00000000004d41d0 R15: 00000000ffffffff
Allocated by task 2236:
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
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc_node+0x144/0x730 mm/slab.c:3644
alloc_task_struct_node kernel/fork.c:157 [inline]
dup_task_struct kernel/fork.c:802 [inline]
copy_process+0x1ff4/0x8780 kernel/fork.c:1707
_do_fork+0x1cb/0x11d0 kernel/fork.c:2166
could not allocate digest TFM handle poly1305-simdïïï
kernel_thread+0x34/0x40 kernel/fork.c:2225
call_usermodehelper_exec_sync kernel/umh.c:130 [inline]
call_usermodehelper_exec_work+0xc9/0x2f0 kernel/umh.c:182
process_one_work+0xc90/0x1c40 kernel/workqueue.c:2153
worker_thread+0x17f/0x1390 kernel/workqueue.c:2296
kthread+0x35a/0x420 kernel/kthread.c:246
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413
Freed by task 8661:
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
could not allocate digest TFM handle poly1305-simd
__cache_free mm/slab.c:3498 [inline]
kmem_cache_free+0x83/0x290 mm/slab.c:3756
free_task_struct kernel/fork.c:162 [inline]
free_task+0x16e/0x1f0 kernel/fork.c:416
__put_task_struct+0x2e6/0x620 kernel/fork.c:689
put_task_struct include/linux/sched/task.h:96 [inline]
finish_task_switch+0x628/0x910 kernel/sched/core.c:2709
context_switch kernel/sched/core.c:2828 [inline]
__schedule+0x874/0x1ed0 kernel/sched/core.c:3473
schedule+0xfe/0x460 kernel/sched/core.c:3517
freezable_schedule include/linux/freezer.h:172 [inline]
do_nanosleep+0x21e/0x750 kernel/time/hrtimer.c:1688
hrtimer_nanosleep+0x2d4/0x620 kernel/time/hrtimer.c:1742
__do_sys_nanosleep kernel/time/hrtimer.c:1776 [inline]
__se_sys_nanosleep kernel/time/hrtimer.c:1763 [inline]
__x64_sys_nanosleep+0x1e7/0x280 kernel/time/hrtimer.c:1763
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 ffff8801cc80a5c0
which belongs to the cache task_struct of size 6080
The buggy address is located 36 bytes inside of
6080-byte region [ffff8801cc80a5c0, ffff8801cc80bd80)
The buggy address belongs to the page:
page:ffffea0007320280 count:1 mapcount:0 mapping:ffff8801da94c200 index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea0006e89008 ffffea0006f0f588 ffff8801da94c200
raw: 0000000000000000 ffff8801cc80a5c0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801cc80a480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801cc80a500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801cc80a580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8801cc80a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
kobject: 'loop3' (0000000001b839a3): fill_kobj_path: path
= '/devices/virtual/block/loop3'
ffff8801cc80a680: 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 syzkaller@xxxxxxxxxxxxxxxxx
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.