syzbot


KASAN: use-after-free Read in dump_schedule

Status: upstream: reported syz repro on 2024/03/25 15:23
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+ec83c5ce379ab3116017@syzkaller.appspotmail.com
First crash: 83d, last: 63d
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2024/03/26 upstream (ToT) 928a87efa423 C [report] KASAN: slab-use-after-free Read in advance_sched
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in dump_schedule net C done done 7 1271d 1382d 19/27 fixed on 2021/03/10 01:48
linux-5.15 KASAN: use-after-free Read in dump_schedule origin:upstream C error 2 51d 85d 0/3 upstream: reported C repro on 2024/03/23 08:43
upstream KASAN: use-after-free Read in dump_schedule (2) net C done inconclusive 10 559d 1119d 0/27 auto-obsoleted due to no activity on 2023/10/12 02:40

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1933
Read of size 8 at addr ffff0000d4d2c240 by task syz-executor.2/5071

CPU: 1 PID: 5071 Comm: syz-executor.2 Not tainted 6.1.86-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/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
 dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1933
 taprio_dump+0xa0c/0xd80 net/sched/sch_taprio.c:2030
 tc_fill_qdisc+0x55c/0xf70 net/sched/sch_api.c:949
 qdisc_notify+0x1a0/0x338 net/sched/sch_api.c:1021
 tc_modify_qdisc+0x16d0/0x186c net/sched/sch_api.c:1722
 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_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 5061:
 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]
 taprio_change+0x96c/0x3834 net/sched/sch_taprio.c:1580
 qdisc_change net/sched/sch_api.c:1390 [inline]
 tc_modify_qdisc+0x1470/0x186c net/sched/sch_api.c:1720
 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_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

Freed by task 3844:
 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+0x154/0x174 net/sched/sch_taprio.c:127
 rcu_do_batch kernel/rcu/tree.c:2296 [inline]
 rcu_core+0x878/0x1c24 kernel/rcu/tree.c:2556
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2573
 __do_softirq+0x314/0xe38 kernel/softirq.c:571

Last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2844
 switch_schedules net/sched/sch_taprio.c:138 [inline]
 advance_sched+0x4e4/0x858 net/sched/sch_taprio.c:741
 __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
 kasan_check_range+0x1d4/0x2a4 mm/kasan/generic.c:189
 __nla_put lib/nlattr.c:1013 [inline]
 nla_put+0x130/0x1d0 lib/nlattr.c:1071
 nla_nest_start_noflag include/net/netlink.h:1805 [inline]
 nla_nest_start include/net/netlink.h:1823 [inline]
 taprio_dump_tc_entries net/sched/sch_taprio.c:1968 [inline]
 taprio_dump+0x7d0/0xd80 net/sched/sch_taprio.c:2027
 tc_fill_qdisc+0x55c/0xf70 net/sched/sch_api.c:949
 qdisc_notify+0x1a0/0x338 net/sched/sch_api.c:1021
 tc_modify_qdisc+0x16d0/0x186c net/sched/sch_api.c:1722
 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_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

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

The buggy address belongs to the physical page:
page:00000000db192b43 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x114d2c
flags: 0x5ffe00000000200(slab|node=0|zone=2|lastcpupid=0xfff)
raw: 05ffe00000000200 fffffc000311b400 dead000000000003 ffff0000c0002300
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d4d2c100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d4d2c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d4d2c200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff0000d4d2c280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d4d2c300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

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