bisecting cause commit starting from ac5b84a1ffe93c9fb882c0f2bdfac1c33077b920 building syzkaller on 0dfb045226fe8566ff447342fbf09d832794b6b3 testing commit ac5b84a1ffe93c9fb882c0f2bdfac1c33077b920 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks testing release v5.0 testing commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 with gcc (GCC) 8.1.0 all runs: OK # git bisect start ac5b84a1ffe93c9fb882c0f2bdfac1c33077b920 v5.0 Bisecting: 9462 revisions left to test after this (roughly 13 steps) [2901752c14b8e1b7dd898d2e5245c93e531aa624] Merge tag 'pci-v5.1-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci testing commit 2901752c14b8e1b7dd898d2e5245c93e531aa624 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 2901752c14b8e1b7dd898d2e5245c93e531aa624 Bisecting: 4771 revisions left to test after this (roughly 12 steps) [7650b1dafbfe45070a713219de1e5a2c00ad4182] Merge remote-tracking branch 'pci/next' testing commit 7650b1dafbfe45070a713219de1e5a2c00ad4182 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 7650b1dafbfe45070a713219de1e5a2c00ad4182 Bisecting: 2336 revisions left to test after this (roughly 11 steps) [1d64d46f9c1f588d14e8ebb0392673a0a2c1a5b3] Merge remote-tracking branch 'drm/drm-next' testing commit 1d64d46f9c1f588d14e8ebb0392673a0a2c1a5b3 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 1d64d46f9c1f588d14e8ebb0392673a0a2c1a5b3 Bisecting: 1253 revisions left to test after this (roughly 10 steps) [09e3aea0df702c840e3614d4ea7f97abef2a3fb4] Merge remote-tracking branch 'thunderbolt/next' testing commit 09e3aea0df702c840e3614d4ea7f97abef2a3fb4 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad 09e3aea0df702c840e3614d4ea7f97abef2a3fb4 Bisecting: 523 revisions left to test after this (roughly 9 steps) [6028cfd87826faa59c469eec9db3334eaa43216a] Merge remote-tracking branch 'security/next-testing' testing commit 6028cfd87826faa59c469eec9db3334eaa43216a with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad 6028cfd87826faa59c469eec9db3334eaa43216a Bisecting: 278 revisions left to test after this (roughly 8 steps) [3189146aecfd83ea0b9919c0550e07a6338d8a48] Merge remote-tracking branch 'modules/modules-next' testing commit 3189146aecfd83ea0b9919c0550e07a6338d8a48 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad 3189146aecfd83ea0b9919c0550e07a6338d8a48 Bisecting: 139 revisions left to test after this (roughly 7 steps) [7c02509a8a9981fb2c16b75904423e7ab2f9f43a] ASoC: meson: axg-fifo: add g12a support testing commit 7c02509a8a9981fb2c16b75904423e7ab2f9f43a with gcc (GCC) 8.1.0 all runs: OK # git bisect good 7c02509a8a9981fb2c16b75904423e7ab2f9f43a Bisecting: 64 revisions left to test after this (roughly 6 steps) [005bd7aad864ac22b63a79281e24ea120f509e81] Merge remote-tracking branch 'drm-intel/for-linux-next' testing commit 005bd7aad864ac22b63a79281e24ea120f509e81 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 005bd7aad864ac22b63a79281e24ea120f509e81 Bisecting: 31 revisions left to test after this (roughly 5 steps) [8c8eb729e2ef573fd47018ed624e611ce8517684] Merge remote-tracking branch 'mali-dp/for-upstream/mali-dp' testing commit 8c8eb729e2ef573fd47018ed624e611ce8517684 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 8c8eb729e2ef573fd47018ed624e611ce8517684 Bisecting: 18 revisions left to test after this (roughly 4 steps) [4b81dad109ad7d7b288804fcdc6475b48f242210] ALSA: doc: my_chip has no element ioport testing commit 4b81dad109ad7d7b288804fcdc6475b48f242210 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad 4b81dad109ad7d7b288804fcdc6475b48f242210 Bisecting: 6 revisions left to test after this (roughly 3 steps) [8748b850beccdbc87aa8776d63abd6b5628720c8] ALSA: timer: Unify timer callback process code testing commit 8748b850beccdbc87aa8776d63abd6b5628720c8 with gcc (GCC) 8.1.0 all runs: OK # git bisect good 8748b850beccdbc87aa8776d63abd6b5628720c8 Bisecting: 3 revisions left to test after this (roughly 2 steps) [fe1b26c93d430400ac37d820425e2468218ae8b2] ALSA: timer: Make snd_timer_close() really kill pending actions testing commit fe1b26c93d430400ac37d820425e2468218ae8b2 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad fe1b26c93d430400ac37d820425e2468218ae8b2 Bisecting: 0 revisions left to test after this (roughly 1 step) [a7588c896b05444929ecb3d0115481988720abf6] ALSA: timer: Check ack_list emptiness instead of bit flag testing commit a7588c896b05444929ecb3d0115481988720abf6 with gcc (GCC) 8.1.0 all runs: crashed: KASAN: use-after-free Read in snd_timer_process_callbacks # git bisect bad a7588c896b05444929ecb3d0115481988720abf6 Bisecting: 0 revisions left to test after this (roughly 0 steps) [7bb4a8a2cc9382da720b46988bc976ebccaa49fd] ALSA: timer: Make sure to clear pending ack list testing commit 7bb4a8a2cc9382da720b46988bc976ebccaa49fd with gcc (GCC) 8.1.0 all runs: OK # git bisect good 7bb4a8a2cc9382da720b46988bc976ebccaa49fd a7588c896b05444929ecb3d0115481988720abf6 is the first bad commit commit a7588c896b05444929ecb3d0115481988720abf6 Author: Takashi Iwai Date: Wed Mar 27 16:56:08 2019 +0100 ALSA: timer: Check ack_list emptiness instead of bit flag For checking the pending timer instance that is still left on the timer object that is being closed, we set/clear a bit flag SNDRV_TIMER_IFLG_CALLBACK around the call of callbacks. This can be simplified by replace with the list_empty() call for ti->ack_list. This covers the existence more comprehensively and safely. A gratis bonus is that we can get rid of SNDRV_TIMER_IFLG_CALLBACK bit flag definition as well. Signed-off-by: Takashi Iwai :040000 040000 9db86b4709fce8f65f25ec9f242ac5017843c25e 2f13fa3bb65df9c6ea8097c117e918d791c6f158 M include :040000 040000 a8e1869c58000a2e665c5a90990ad2357c8084f3 6b223e4e57d158358b08691c630f475dc818a81d M sound revisions tested: 16, total time: 3h50m6.155794823s (build: 1h33m34.527266982s, test: 2h11m8.236404933s) first bad commit: a7588c896b05444929ecb3d0115481988720abf6 ALSA: timer: Check ack_list emptiness instead of bit flag cc: ["alsa-devel@alsa-project.org" "ben.hutchings@codethink.co.uk" "linux-kernel@vger.kernel.org" "perex@perex.cz" "srikanth.h@samsung.com" "tiwai@suse.com" "tiwai@suse.de"] crash: KASAN: use-after-free Read in snd_timer_process_callbacks ================================================================== BUG: KASAN: use-after-free in __list_del_entry_valid+0xd0/0xf3 lib/list_debug.c:42 Read of size 8 at addr ffff88808ef3b220 by task swapper/0/0 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.1.0-rc1+ #1 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+0x113/0x167 lib/dump_stack.c:113 print_address_description.cold.5+0x9/0x1ff mm/kasan/report.c:187 kasan_report.cold.6+0x1b/0x39 mm/kasan/report.c:317 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 __list_del_entry_valid+0xd0/0xf3 lib/list_debug.c:42 __list_del_entry include/linux/list.h:117 [inline] list_del_init include/linux/list.h:159 [inline] snd_timer_process_callbacks+0x100/0x2a0 sound/core/timer.c:744 snd_timer_interrupt+0x79d/0xdd0 sound/core/timer.c:862 snd_hrtimer_callback+0x1be/0x380 sound/core/hrtimer.c:64 __run_hrtimer kernel/time/hrtimer.c:1389 [inline] __hrtimer_run_queues+0x2f9/0xab0 kernel/time/hrtimer.c:1451 hrtimer_interrupt+0x2df/0x760 kernel/time/hrtimer.c:1509 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1035 [inline] smp_apic_timer_interrupt+0x120/0x550 arch/x86/kernel/apic/apic.c:1060 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807 RIP: 0010:native_safe_halt+0x6/0x10 arch/x86/include/asm/irqflags.h:58 Code: e9 62 ff ff ff 48 89 c7 48 89 45 d8 e8 a3 05 ff fa 48 8b 45 d8 e9 17 ff ff ff 4c 89 e7 e8 92 05 ff fa eb 93 55 48 89 e5 fb f4 <5d> c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 f4 5d c3 90 90 90 90 90 RSP: 0018:ffffffff88007ce8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: dffffc0000000000 RBX: ffffffff8807dfc0 RCX: 0000000000000000 RDX: 1ffffffff1024839 RSI: 0000000000000006 RDI: ffffffff881241c8 RBP: ffffffff88007ce8 R08: 0000000000000006 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffffffff881241b8 R14: 0000000000000000 R15: ffffffff88d3df20 arch_safe_halt arch/x86/include/asm/paravirt.h:156 [inline] default_idle+0x51/0x320 arch/x86/kernel/process.c:576 arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:567 default_idle_call+0x6d/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x3f1/0x5b0 kernel/sched/idle.c:262 cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:353 rest_init+0x1a4/0x279 init/main.c:450 arch_call_rest_init+0x9/0xc start_kernel+0x6ae/0x6e7 init/main.c:747 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:470 x86_64_start_kernel+0x76/0x79 arch/x86/kernel/head64.c:451 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 Allocated by task 7042: save_stack+0x43/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_kmalloc.constprop.9+0xc7/0xd0 mm/kasan/common.c:497 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511 kmem_cache_alloc_trace+0x154/0x750 mm/slab.c:3621 kmalloc include/linux/slab.h:545 [inline] kzalloc include/linux/slab.h:740 [inline] snd_timer_instance_new+0x4d/0x370 sound/core/timer.c:108 snd_timer_open+0x780/0x1690 sound/core/timer.c:312 snd_seq_timer_open+0x20c/0x550 sound/core/seq/seq_timer.c:290 queue_use+0x6a/0x170 sound/core/seq/seq_queue.c:502 snd_seq_queue_alloc+0x295/0x4d0 sound/core/seq/seq_queue.c:189 snd_seq_ioctl_create_queue+0xaa/0x2e0 sound/core/seq/seq_clientmgr.c:1522 snd_seq_ioctl+0x1cc/0x3c0 sound/core/seq/seq_clientmgr.c:2138 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0x199/0x10d0 fs/ioctl.c:696 ksys_ioctl+0x62/0x90 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:718 do_syscall_64+0xd6/0x4e0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 7042: save_stack+0x43/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] kfree+0xcf/0x230 mm/slab.c:3821 snd_timer_close_locked+0x6ac/0xaa0 sound/core/timer.c:399 snd_timer_close+0x23/0x40 sound/core/timer.c:424 snd_seq_timer_close+0x7d/0xa0 sound/core/seq/seq_timer.c:329 queue_delete+0x49/0xa0 sound/core/seq/seq_queue.c:147 snd_seq_queue_client_leave+0x27/0x110 sound/core/seq/seq_queue.c:584 seq_free_client1.part.9+0xef/0x260 sound/core/seq/seq_clientmgr.c:263 seq_free_client1 sound/core/seq/seq_clientmgr.c:256 [inline] seq_free_client+0x5c/0xd0 sound/core/seq/seq_clientmgr.c:285 snd_seq_release+0x48/0xe0 sound/core/seq/seq_clientmgr.c:366 __fput+0x252/0x800 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x10e/0x190 kernel/task_work.c:113 get_signal+0x1222/0x1840 kernel/signal.c:2390 do_signal+0x87/0x1930 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x114/0x200 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x40d/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88808ef3b180 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 160 bytes inside of 256-byte region [ffff88808ef3b180, ffff88808ef3b280) The buggy address belongs to the page: page:ffffea00023bcec0 count:1 mapcount:0 mapping:ffff88812c3267c0 index:0x0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea000233b288 ffffea000295eec8 ffff88812c3267c0 raw: 0000000000000000 ffff88808ef3b040 000000010000000c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808ef3b100: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88808ef3b180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88808ef3b200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88808ef3b280: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ffff88808ef3b300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================