syzbot


KASAN: slab-use-after-free Read in advance_sched

Status: upstream: reported C repro on 2023/12/19 00:19
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+b65e0af58423fc8a73aa@syzkaller.appspotmail.com
First crash: 123d, last: 6d20h
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [net?] KASAN: slab-use-after-free Read in advance_sched 1 (4) 2024/02/24 00:15
Re: [syzbot] [net?] KASAN: slab-use-after-free Read in advance_sched 4 (4) 2023/12/26 01:12
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in advance_sched 1 22d 22d 0/3 upstream: reported on 2024/03/25 12:01
linux-5.15 KASAN: use-after-free Read in advance_sched 1 24d 24d 0/3 upstream: reported on 2024/03/23 04:49
upstream KASAN: use-after-free Read in advance_sched net 2 895d 900d 0/26 auto-closed as invalid on 2022/03/03 15:32
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/02/23 23:02 1h11m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci OK log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in advance_sched+0xa70/0xac0 net/sched/sch_taprio.c:953
Read of size 8 at addr ffff0000d2b9e910 by task swapper/0/0

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.8.0-rc6-syzkaller-g9910665503b3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x178/0x518 mm/kasan/report.c:488
 kasan_report+0xd8/0x138 mm/kasan/report.c:601
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 advance_sched+0xa70/0xac0 net/sched/sch_taprio.c:953
 __run_hrtimer kernel/time/hrtimer.c:1689 [inline]
 __hrtimer_run_queues+0x484/0xca0 kernel/time/hrtimer.c:1753
 hrtimer_interrupt+0x2c0/0xb64 kernel/time/hrtimer.c:1815
 timer_handler drivers/clocksource/arm_arch_timer.c:674 [inline]
 arch_timer_handler_virt+0x74/0x88 drivers/clocksource/arm_arch_timer.c:685
 handle_percpu_devid_irq+0x2a4/0x804 kernel/irq/chip.c:942
 generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
 handle_irq_desc kernel/irq/irqdesc.c:672 [inline]
 generic_handle_domain_irq+0x7c/0xc4 kernel/irq/irqdesc.c:728
 __gic_handle_irq drivers/irqchip/irq-gic-v3.c:782 [inline]
 __gic_handle_irq_from_irqson drivers/irqchip/irq-gic-v3.c:833 [inline]
 gic_handle_irq+0x6c/0x190 drivers/irqchip/irq-gic-v3.c:877
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:889
 do_interrupt_handler+0xd4/0x138 arch/arm64/kernel/entry-common.c:310
 __el1_irq arch/arm64/kernel/entry-common.c:536 [inline]
 el1_interrupt+0x34/0x68 arch/arm64/kernel/entry-common.c:551
 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:556
 el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:594
 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:27 [inline]
 arch_local_irq_enable+0x8/0xc arch/arm64/include/asm/irqflags.h:49
 cpuidle_idle_call kernel/sched/idle.c:170 [inline]
 do_idle+0x1f0/0x4e8 kernel/sched/idle.c:312
 cpu_startup_entry+0x5c/0x74 kernel/sched/idle.c:410
 rest_init+0x2dc/0x2f4 init/main.c:730
 start_kernel+0x0/0x4ec init/main.c:827
 start_kernel+0x3ec/0x4ec init/main.c:1072
 __primary_switched+0x84/0x8c arch/arm64/kernel/head.S:243

Allocated by task 20719:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_alloc_info+0x70/0x84 mm/kasan/generic.c:629
 poison_kmalloc_redzone mm/kasan/common.c:372 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:389
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x26c/0x49c mm/slub.c:4012
 kmalloc include/linux/slab.h:590 [inline]
 kzalloc include/linux/slab.h:711 [inline]
 taprio_change+0xd14/0x3bf0 net/sched/sch_taprio.c:1881
 qdisc_change net/sched/sch_api.c:1416 [inline]
 tc_modify_qdisc+0x1474/0x1870 net/sched/sch_api.c:1746
 rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6618
 netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2543
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6636
 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
 netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1367
 netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x56c/0x840 net/socket.c:2584
 ___sys_sendmsg net/socket.c:2638 [inline]
 __sys_sendmsg+0x26c/0x33c net/socket.c:2667
 __do_sys_sendmsg net/socket.c:2676 [inline]
 __se_sys_sendmsg net/socket.c:2674 [inline]
 __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

Freed by task 20718:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_free_info+0x5c/0x74 mm/kasan/generic.c:643
 poison_slab_object+0x124/0x18c mm/kasan/common.c:241
 __kasan_slab_free+0x3c/0x78 mm/kasan/common.c:257
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4299 [inline]
 kfree+0x144/0x3cc mm/slub.c:4409
 taprio_free_sched_cb+0x158/0x178 net/sched/sch_taprio.c:199
 rcu_do_batch kernel/rcu/tree.c:2190 [inline]
 rcu_core+0x890/0x1b34 kernel/rcu/tree.c:2465
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2482
 __do_softirq+0x2d8/0xce4 kernel/softirq.c:553

Last potentially related work creation:
 kasan_save_stack+0x40/0x6c mm/kasan/common.c:47
 __kasan_record_aux_stack+0xc4/0x110 mm/kasan/generic.c:589
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:615
 __call_rcu_common kernel/rcu/tree.c:2715 [inline]
 call_rcu+0x104/0xaf4 kernel/rcu/tree.c:2829
 taprio_change+0x3288/0x3bf0 net/sched/sch_taprio.c:1991
 qdisc_change net/sched/sch_api.c:1416 [inline]
 tc_modify_qdisc+0x1474/0x1870 net/sched/sch_api.c:1746
 rtnetlink_rcv_msg+0x748/0xdbc net/core/rtnetlink.c:6618
 netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2543
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6636
 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
 netlink_unicast+0x65c/0x898 net/netlink/af_netlink.c:1367
 netlink_sendmsg+0x83c/0xb20 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x56c/0x840 net/socket.c:2584
 ___sys_sendmsg net/socket.c:2638 [inline]
 __sys_sendmsg+0x26c/0x33c net/socket.c:2667
 __do_sys_sendmsg net/socket.c:2676 [inline]
 __se_sys_sendmsg net/socket.c:2674 [inline]
 __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2674
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

The buggy address belongs to the object at ffff0000d2b9e800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 272 bytes inside of
 freed 512-byte region [ffff0000d2b9e800, ffff0000d2b9ea00)

The buggy address belongs to the physical page:
page:000000008d76ffc8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112b9c
head:000000008d76ffc8 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x5ffc00000000840(slab|head|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000840 ffff0000c0001c80 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d2b9e800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d2b9e880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000d2b9e900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff0000d2b9e980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d2b9ea00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/04 00:21 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9910665503b3 25905f5d .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in advance_sched
2024/03/03 08:23 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9910665503b3 25905f5d .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in advance_sched
2024/02/28 01:01 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9abbc24128bc 05e69c83 .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in advance_sched
2024/02/23 09:29 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9abbc24128bc 8d446f15 .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in advance_sched
2024/03/22 22:22 upstream 480e035fc4c7 7a239ce7 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/02/29 01:32 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 381f163531d8 352ab904 .config console log report syz [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in advance_sched
2024/04/06 21:06 upstream fe46a7dd189e ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in advance_sched
2024/03/27 21:19 upstream 480e035fc4c7 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/03/14 16:04 upstream 480e035fc4c7 f919f202 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/04/10 01:12 net f99c5f563c17 56086b24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/04/07 04:47 net f99c5f563c17 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/04/01 07:50 net f99c5f563c17 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/04/01 07:34 net f99c5f563c17 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2024/03/27 02:23 net f99c5f563c17 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in advance_sched
2023/12/15 06:10 net-next 1b666016d0ad 3222d10c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in advance_sched
* Struck through repros no longer work on HEAD.