syzbot


KASAN: use-after-free Read in wake_up_if_idle

Status: auto-closed as invalid on 2019/09/10 10:04
Subsystems: pm
[Documentation on labels]
Reported-by: syzbot+2c1253bc508adef78a7f@syzkaller.appspotmail.com
First crash: 2014d, last: 1870d
Discussions (4)
Title Replies (including bot) Last reply
Reminder: 1 open syzbot bug in sound subsystem 3 (3) 2019/07/24 15:56
Reminder: 4 open syzbot bugs in sound subsystem 1 (1) 2019/07/09 20:18
Reminder: 9 open syzbot bugs in sound subsystem 1 (1) 2019/06/24 05:07
KASAN: use-after-free Read in wake_up_if_idle 0 (1) 2018/10/29 14:47

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in is_idle_task include/linux/sched.h:1558 [inline]
BUG: KASAN: use-after-free in wake_up_if_idle+0x266/0x2c0 kernel/sched/core.c:1852
Read of size 4 at addr ffff888051b1c324 by task syz-executor.0/24358

CPU: 0 PID: 24358 Comm: syz-executor.0 Not tainted 5.0.0+ #21
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131
 is_idle_task include/linux/sched.h:1558 [inline]
 wake_up_if_idle+0x266/0x2c0 kernel/sched/core.c:1852
 wake_up_all_idle_cpus+0x6f/0xc0 kernel/smp.c:751
 cpuidle_latency_notify+0xe/0x20 drivers/cpuidle/cpuidle.c:695
 notifier_call_chain+0xc7/0x240 kernel/notifier.c:93
 __blocking_notifier_call_chain kernel/notifier.c:317 [inline]
 __blocking_notifier_call_chain kernel/notifier.c:304 [inline]
 blocking_notifier_call_chain kernel/notifier.c:328 [inline]
 blocking_notifier_call_chain+0x94/0xb0 kernel/notifier.c:325
 pm_qos_update_target+0x35d/0xa40 kernel/power/qos.c:305
 pm_qos_add_request+0x20b/0x510 kernel/power/qos.c:449
 snd_pcm_hw_params+0x16e9/0x1c20 sound/core/pcm_native.c:730
 snd_pcm_kernel_ioctl+0xc3/0x1f0 sound/core/pcm_native.c:3029
 snd_pcm_oss_change_params_locked+0x1b83/0x3750 sound/core/oss/pcm_oss.c:993
 snd_pcm_oss_change_params+0x7b/0xd0 sound/core/oss/pcm_oss.c:1101
 snd_pcm_oss_make_ready+0xbe/0x170 sound/core/oss/pcm_oss.c:1160
 snd_pcm_oss_sync.isra.0+0x1c4/0x7e0 sound/core/oss/pcm_oss.c:1721
 snd_pcm_oss_release+0x214/0x290 sound/core/oss/pcm_oss.c:2559
 __fput+0x2e5/0x8d0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x14a/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [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
RIP: 0033:0x458079
Code: ad b8 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 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f67e286ac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffea RBX: 0000000000000004 RCX: 0000000000458079
RDX: 0000000000004000 RSI: 0000000020000140 RDI: ffffffffffffff9c
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f67e286b6d4
R13: 00000000004c3fb1 R14: 00000000004d73d8 R15: 00000000ffffffff

Allocated by task 24361:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:505
 slab_post_alloc_hook mm/slab.h:436 [inline]
 slab_alloc_node mm/slab.c:3335 [inline]
 kmem_cache_alloc_node+0x131/0x710 mm/slab.c:3645
 alloc_task_struct_node kernel/fork.c:157 [inline]
 dup_task_struct kernel/fork.c:844 [inline]
 copy_process.part.0+0x1d08/0x7980 kernel/fork.c:1752
 copy_process kernel/fork.c:1709 [inline]
 _do_fork+0x257/0xfd0 kernel/fork.c:2226
 __do_sys_clone kernel/fork.c:2333 [inline]
 __se_sys_clone kernel/fork.c:2327 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2327
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 24364:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3764
 free_task_struct kernel/fork.c:162 [inline]
 free_task+0xdd/0x120 kernel/fork.c:457
 __put_task_struct+0x1fd/0x4e0 kernel/fork.c:730
 put_task_struct include/linux/sched/task.h:98 [inline]
 finish_task_switch+0x52c/0x780 kernel/sched/core.c:2761
 context_switch kernel/sched/core.c:2880 [inline]
 __schedule+0x81f/0x1cc0 kernel/sched/core.c:3518
 preempt_schedule_common+0x4f/0xe0 kernel/sched/core.c:3642
 preempt_schedule+0x4b/0x60 kernel/sched/core.c:3668
 ___preempt_schedule+0x16/0x18
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
 _raw_spin_unlock_irqrestore+0xbd/0xe0 kernel/locking/spinlock.c:184
 spin_unlock_irqrestore include/linux/spinlock.h:384 [inline]
 release_pages+0x107b/0x1940 mm/swap.c:791
 free_pages_and_swap_cache+0x2a0/0x3d0 mm/swap_state.c:295
 tlb_flush_mmu_free+0x4e/0x120 mm/mmu_gather.c:74
 tlb_flush_mmu+0x5a/0x520 mm/mmu_gather.c:83
 arch_tlb_finish_mmu+0x3f/0x370 mm/mmu_gather.c:100
 tlb_finish_mmu+0x9e/0x100 mm/mmu_gather.c:259
 exit_mmap+0x2e2/0x530 mm/mmap.c:3140
 __mmput kernel/fork.c:1046 [inline]
 mmput+0x15f/0x4c0 kernel/fork.c:1067
 exit_mm kernel/exit.c:546 [inline]
 do_exit+0x816/0x2fa0 kernel/exit.c:863
 do_group_exit+0x135/0x370 kernel/exit.c:980
 __do_sys_exit_group kernel/exit.c:991 [inline]
 __se_sys_exit_group kernel/exit.c:989 [inline]
 __x64_sys_exit_group+0x44/0x50 kernel/exit.c:989
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888051b1c300
 which belongs to the cache task_struct of size 6080
The buggy address is located 36 bytes inside of
 6080-byte region [ffff888051b1c300, ffff888051b1dac0)
The buggy address belongs to the page:
page:ffffea000146c700 count:1 mapcount:0 mapping:ffff88821bc407c0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0000db7d88 ffffea00013da588 ffff88821bc407c0
raw: 0000000000000000 ffff888051b1c300 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888051b1c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888051b1c280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888051b1c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888051b1c380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888051b1c400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/03/14 10:03 upstream fa3d493f7a57 d09a902e .config console log report ci-upstream-kasan-gce-root
2018/12/14 12:34 upstream 65e08c5e8631 7624ddd6 .config console log report ci-upstream-kasan-gce
2018/10/22 13:01 upstream 467e050e9760 ecb386fe .config console log report ci-upstream-kasan-gce-smack-root
2018/10/21 17:49 upstream 23469de647c4 ecb386fe .config console log report ci-upstream-kasan-gce-smack-root
2019/01/24 12:35 linux-next 755d01d17697 ce1ccf97 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.