syzbot


KASAN: use-after-free Read in try_to_wake_up

Status: upstream: reported C repro on 2022/10/30 09:08
Subsystems: nilfs2
[Documentation on labels]
Reported-by: syzbot+badca4803d13fbbed2bd@syzkaller.appspotmail.com
First crash: 480d, last: 359d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in try_to_wake_up origin:upstream C 10 30d 246d 0/3 upstream: reported C repro on 2023/06/21 23:55
upstream general protection fault in try_to_wake_up (2) io-uring C done done 3495 2d15h 1091d 0/26 upstream: reported C repro on 2021/02/26 14:48
upstream KASAN: use-after-free Read in try_to_wake_up fs C unreliable 82 1092d 1092d 0/26 closed as invalid on 2021/02/25 16:53
linux-6.1 KASAN: use-after-free Read in try_to_wake_up origin:upstream C 12 23d 326d 0/3 upstream: reported C repro on 2023/04/02 17:27
linux-4.14 general protection fault in try_to_wake_up C done 707 1042d 1072d 1/1 fixed on 2021/05/17 08:49
linux-4.19 general protection fault in try_to_wake_up syz done 229 984d 1072d 1/1 fixed on 2021/07/14 00:01
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/01/30 03:59 24m bisect fix linux-4.14.y job log (0) log

Sample crash report:
audit: type=1804 audit(1677611157.148:78): pid=8297 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor331" name="/root/syzkaller.QWh7xB/30/file0/bus" dev="loop2" ino=12 res=1
audit: type=1804 audit(1677611157.148:79): pid=8297 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor331" name="/root/syzkaller.QWh7xB/30/file0/bus" dev="loop2" ino=12 res=1
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
Read of size 8 at addr ffff8880b38fe920 by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.307-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:251
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:350
 kasan_report mm/kasan/report.c:408 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:429
 __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160
 try_to_wake_up+0x6a/0x1100 kernel/sched/core.c:2000
 call_timer_fn+0x14a/0x650 kernel/time/timer.c:1280
 expire_timers+0x232/0x4d0 kernel/time/timer.c:1319
 __run_timers kernel/time/timer.c:1637 [inline]
 run_timer_softirq+0x1d5/0x5a0 kernel/time/timer.c:1650
 __do_softirq+0x24d/0x9ff kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x193/0x240 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:638 [inline]
 smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1106
 apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:796
 </IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
RSP: 0018:ffff8880b5477e68 EFLAGS: 000002c2 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff11e13dc RBX: dffffc0000000000 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880b5464bc4
RBP: ffffffff88f09ed0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffed1016a8c868
R13: ffff8880b5464340 R14: 0000000000000000 R15: 0000000000000000
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
 default_idle+0x47/0x370 arch/x86/kernel/process.c:558
 cpuidle_idle_call kernel/sched/idle.c:156 [inline]
 do_idle+0x250/0x3c0 kernel/sched/idle.c:246
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:351
 start_secondary+0x4db/0x670 arch/x86/kernel/smpboot.c:272
 secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

Allocated by task 2:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_node+0x146/0x410 mm/slab.c:3642
 alloc_task_struct_node kernel/fork.c:156 [inline]
 dup_task_struct kernel/fork.c:515 [inline]
 copy_process.part.0+0x17d3/0x71c0 kernel/fork.c:1631
 copy_process kernel/fork.c:1606 [inline]
 _do_fork+0x17a/0xcb0 kernel/fork.c:2092
 kernel_thread+0x2f/0x40 kernel/fork.c:2154
 create_kthread kernel/kthread.c:255 [inline]
 kthreadd+0x51a/0x770 kernel/kthread.c:592
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

Freed by task 8262:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 __put_task_struct+0x276/0x470 kernel/fork.c:420
 put_task_struct include/linux/sched/task.h:99 [inline]
 delayed_put_task_struct+0x1fb/0x2e0 kernel/exit.c:227
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x780/0x1180 kernel/rcu/tree.c:2946
 __do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff8880b38fe140
 which belongs to the cache task_struct of size 6144
The buggy address is located 2016 bytes inside of
 6144-byte region [ffff8880b38fe140, ffff8880b38ff940)
The buggy address belongs to the page:
page:ffffea0002ce3f80 count:1 mapcount:0 mapping:ffff8880b38fe140 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880b38fe140 0000000000000000 0000000100000001
raw: ffffea0002c60e20 ffffea00024b9120 ffff88823f8307c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b38fe800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b38fe880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b38fe900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880b38fe980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b38fea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/28 19:07 linux-4.14.y 7878a41b6cc1 95aee97a .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2023/02/20 01:28 linux-4.14.y a8ad60f2af58 bcdf85f8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2023/02/11 14:59 linux-4.14.y a8ad60f2af58 93e26d60 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2022/10/30 09:07 linux-4.14.y 41f36d7859a7 2a71366b .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2023/02/14 07:21 linux-4.14.y a8ad60f2af58 93ae7e0a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2023/02/11 14:35 linux-4.14.y a8ad60f2af58 93e26d60 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2023/02/11 14:33 linux-4.14.y a8ad60f2af58 93e26d60 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
2022/12/10 12:33 linux-4.14.y 65afe34ac33d 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in try_to_wake_up
* Struck through repros no longer work on HEAD.