syzbot


KASAN: use-after-free Read in advance_sched

Status: auto-obsoleted due to no activity on 2024/07/03 12:01
Reported-by: syzbot+5af50b1b1bd6a984179d@syzkaller.appspotmail.com
First crash: 255d, last: 255d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in advance_sched 1 257d 257d 0/3 auto-obsoleted due to no activity on 2024/07/01 04:50
upstream KASAN: use-after-free Read in advance_sched net 2 1127d 1133d 0/28 auto-closed as invalid on 2022/03/03 15:32
upstream KASAN: slab-use-after-free Read in advance_sched net C error 15 66d 352d 28/28 fixed on 2024/11/12 23:31

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in advance_sched+0x1b0/0x858 net/sched/sch_taprio.c:717
Read of size 8 at addr ffff0000d838a210 by task udevd/3842

CPU: 0 PID: 3842 Comm: udevd Not tainted 6.1.82-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
 advance_sched+0x1b0/0x858 net/sched/sch_taprio.c:717
 __run_hrtimer kernel/time/hrtimer.c:1686 [inline]
 __hrtimer_run_queues+0x4b0/0xdc0 kernel/time/hrtimer.c:1750
 hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1812
 timer_handler drivers/clocksource/arm_arch_timer.c:655 [inline]
 arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:666
 handle_percpu_devid_irq+0x174/0x354 kernel/irq/chip.c:930
 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline]
 handle_irq_desc kernel/irq/irqdesc.c:651 [inline]
 generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:707
 __gic_handle_irq drivers/irqchip/irq-gic-v3.c:737 [inline]
 __gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:788 [inline]
 gic_handle_irq+0x70/0x1e4 drivers/irqchip/irq-gic-v3.c:832
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:274
 __el1_irq arch/arm64/kernel/entry-common.c:471 [inline]
 el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:486
 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:491
 el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:581
 preempt_schedule_common+0xf4/0x1e8 kernel/sched/core.c:6727
 preempt_schedule+0x64/0x84 kernel/sched/core.c:6751
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
 _raw_spin_unlock_irqrestore+0xa8/0xac kernel/locking/spinlock.c:194
 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
 __wake_up_common_lock kernel/sched/wait.c:140 [inline]
 __wake_up_sync_key+0x124/0x1ac kernel/sched/wait.c:208
 sock_def_readable+0x150/0x278 net/core/sock.c:3304
 __netlink_sendskb net/netlink/af_netlink.c:1273 [inline]
 netlink_sendskb+0x98/0x154 net/netlink/af_netlink.c:1279
 netlink_unicast+0x320/0x898 net/netlink/af_netlink.c:1367
 netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1874
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x55c/0x848 net/socket.c:2514
 ___sys_sendmsg net/socket.c:2568 [inline]
 __sys_sendmsg+0x26c/0x33c net/socket.c:2597
 __do_sys_sendmsg net/socket.c:2606 [inline]
 __se_sys_sendmsg net/socket.c:2604 [inline]
 __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2604
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 4665:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1050
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:692 [inline]
 parse_sched_list net/sched/sch_taprio.c:863 [inline]
 parse_taprio_schedule net/sched/sch_taprio.c:905 [inline]
 taprio_change+0x2034/0x3834 net/sched/sch_taprio.c:1599
 taprio_init+0x4a8/0x530 net/sched/sch_taprio.c:1821
 qdisc_create+0x70c/0xe64 net/sched/sch_api.c:1314
 tc_modify_qdisc+0xa14/0x186c
 rtnetlink_rcv_msg+0x72c/0xd94 net/core/rtnetlink.c:6121
 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2508
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6139
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1874
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x55c/0x848 net/socket.c:2514
 ___sys_sendmsg net/socket.c:2568 [inline]
 __sys_sendmmsg+0x318/0x7d8 net/socket.c:2654
 __do_sys_sendmmsg net/socket.c:2683 [inline]
 __se_sys_sendmmsg net/socket.c:2680 [inline]
 __arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2680
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 15:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:1007
 taprio_free_sched_cb+0x12c/0x174 net/sched/sch_taprio.c:124
 rcu_do_batch kernel/rcu/tree.c:2296 [inline]
 rcu_core+0x878/0x1c10 kernel/rcu/tree.c:2556
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2573
 __do_softirq+0x314/0xe38 kernel/softirq.c:571

The buggy address belongs to the object at ffff0000d838a200
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 16 bytes inside of
 128-byte region [ffff0000d838a200, ffff0000d838a280)

The buggy address belongs to the physical page:
page:00000000e1acae3a refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11838a
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc00032a16c0 dead000000000003 ffff0000c0002300
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d838a100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d838a180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d838a200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff0000d838a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d838a300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
BUG: sleeping function called from invalid context at fs/file_table.c:304
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 4250, name: syz-executor.0
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
INFO: lockdep is turned off.
Preemption disabled at:
[<ffff80000803315c>] local_bh_disable+0x28/0x34 include/linux/bottom_half.h:20
CPU: 0 PID: 4250 Comm: syz-executor.0 Tainted: G    B   W          6.1.82-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 dump_stack+0x1c/0x58 lib/dump_stack.c:113
 __might_resched+0x37c/0x4d8 kernel/sched/core.c:9942
 __might_sleep+0x90/0xe4 kernel/sched/core.c:9871
 __fput+0xd4/0x7bc fs/file_table.c:304
 ____fput+0x20/0x30 fs/file_table.c:348
 rcu_do_batch kernel/rcu/tree.c:2296 [inline]
 rcu_core+0x878/0x1c10 kernel/rcu/tree.c:2556
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2573
 __do_softirq+0x314/0xe38 kernel/softirq.c:571
 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
 do_softirq+0xf8/0x1ac kernel/softirq.c:472
 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:396
 local_bh_enable+0x28/0x34 include/linux/bottom_half.h:33
 put_cpu_fpsimd_context arch/arm64/kernel/fpsimd.c:274 [inline]
 fpsimd_restore_current_state+0x110/0x26c arch/arm64/kernel/fpsimd.c:1730
 do_notify_resume+0x1948/0x3474 arch/arm64/kernel/signal.c:1135
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
------------[ cut here ]------------
kernel BUG at include/linux/fs.h:3074!
Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
Modules linked in:

CPU: 0 PID: 4250 Comm: syz-executor.0 Tainted: G    B   W          6.1.82-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : i_readcount_dec include/linux/fs.h:3074 [inline]
pc : put_file_access fs/internal.h:108 [inline]
pc : __fput+0x770/0x7bc fs/file_table.c:327
lr : i_readcount_dec include/linux/fs.h:3074 [inline]
lr : put_file_access fs/internal.h:108 [inline]
lr : __fput+0x770/0x7bc fs/file_table.c:327
sp : ffff800008007cc0
x29: ffff800008007d00
 x28: 1fffe0001a03b5ef
 x27: 1fffe0001a03b5e5

x26: ffff0000c085b520
 x25: 00000000000a801d
 x24: 00000000000a801d

x23: ffff000143131654
 x22: dfff800000000000
 x21: 0000000000000000

x20: ffff0000d01daf7c
 x19: ffff0000d01daf00
 x18: 1fffe00018c6e087

x17: 0000000000000000
 x16: ffff8000084fb154
 x15: 0000000000000000

x14: 0000000000000000
 x13: 205d304320202020
 x12: 0000000000000001

x11: 0000000000ff0100
 x10: 0000000000000000
 x9 : ffff800008a4b0b4

x8 : ffff0000c6370000
 x7 : 205b5d3835343437
 x6 : ffff800008348ef8

x5 : 0000000000000000
 x4 : 0000000000000001
 x3 : ffff800008a4ad80

x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000

Call trace:
 i_readcount_dec include/linux/fs.h:3074 [inline]
 put_file_access fs/internal.h:108 [inline]
 __fput+0x770/0x7bc fs/file_table.c:327
 ____fput+0x20/0x30 fs/file_table.c:348
 rcu_do_batch kernel/rcu/tree.c:2296 [inline]
 rcu_core+0x878/0x1c10 kernel/rcu/tree.c:2556
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2573
 __do_softirq+0x314/0xe38 kernel/softirq.c:571
 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
 do_softirq+0xf8/0x1ac kernel/softirq.c:472
 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:396
 local_bh_enable+0x28/0x34 include/linux/bottom_half.h:33
 put_cpu_fpsimd_context arch/arm64/kernel/fpsimd.c:274 [inline]
 fpsimd_restore_current_state+0x110/0x26c arch/arm64/kernel/fpsimd.c:1730
 do_notify_resume+0x1948/0x3474 arch/arm64/kernel/signal.c:1135
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
Code: aa1c03e0 97fcac50 17fffe98 97eac029 (d4210000) 
---[ end trace 0000000000000000 ]---

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/25 12:00 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in advance_sched
* Struck through repros no longer work on HEAD.