syzbot


KASAN: use-after-free Read in dump_schedule (2)
Status: upstream: reported C repro on 2021/05/24 09:12
Reported-by: syzbot+a6e609c672ce997c14a8@syzkaller.appspotmail.com
First crash: 370d, last: 5d16h

Cause bisection: introduced by (bisect log) :
commit 7b9eba7ba0c1b24df42b70b62d154b284befbccf
Author: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Date: Mon Apr 8 17:12:17 2019 +0000

  net/sched: taprio: fix picos_per_byte miscalculation

Crash: WARNING in taprio_dequeue (log)
Repro: syz .config
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in dump_schedule C done done 7 521d 632d 21/22 fixed on 2021/03/10 01:48
Patch testing requests:
Created Duration User Patch Repo Result
2021/12/11 06:25 18m phind.uet@gmail.com linux-next report log
2021/12/02 14:32 10m phind.uet@gmail.com linux-next error
2021/12/01 14:26 18m phind.uet@gmail.com upstream report log
2021/06/14 17:32 16m chouhan.shreyansh630@gmail.com upstream OK

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dump_schedule+0x79c/0x830 net/sched/sch_taprio.c:1841
Read of size 8 at addr ffff88801e52ab40 by task syz-executor062/15158

CPU: 0 PID: 15158 Comm: syz-executor062 Not tainted 5.15.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 dump_schedule+0x79c/0x830 net/sched/sch_taprio.c:1841
 taprio_dump+0x53d/0xdf0 net/sched/sch_taprio.c:1910
 tc_fill_qdisc+0x60e/0x12e0 net/sched/sch_api.c:923
 qdisc_notify.isra.0+0x2b1/0x310 net/sched/sch_api.c:990
 tc_modify_qdisc+0xf85/0x1a60 net/sched/sch_api.c:1642
 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5572
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2510
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1935
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:724
 sock_no_sendpage+0xf3/0x130 net/core/sock.c:2998
 kernel_sendpage.part.0+0x1a0/0x340 net/socket.c:3504
 kernel_sendpage net/socket.c:3501 [inline]
 sock_sendpage+0xe5/0x140 net/socket.c:1003
 pipe_to_sendpage+0x2ad/0x380 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x43e/0x8a0 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0xd4/0x140 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 do_splice+0xb7e/0x1960 fs/splice.c:1079
 __do_splice+0x134/0x250 fs/splice.c:1144
 __do_sys_splice fs/splice.c:1350 [inline]
 __se_sys_splice fs/splice.c:1332 [inline]
 __x64_sys_splice+0x198/0x250 fs/splice.c:1332
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f1122a5acb9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1122bfec88 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1122a5acb9
RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000010976 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1122bfecc8
R13: 00007f1122bfece0 R14: 00007f1122bfed20 R15: 000000000000203f

Allocated by task 15153:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0xa4/0xd0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 taprio_change+0x5fb/0x4160 net/sched/sch_taprio.c:1477
 qdisc_change net/sched/sch_api.c:1338 [inline]
 tc_modify_qdisc+0xd9a/0x1a60 net/sched/sch_api.c:1640
 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5572
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2510
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1935
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:724
 sock_no_sendpage+0xf3/0x130 net/core/sock.c:2998
 kernel_sendpage.part.0+0x1a0/0x340 net/socket.c:3504
 kernel_sendpage net/socket.c:3501 [inline]
 sock_sendpage+0xe5/0x140 net/socket.c:1003
 pipe_to_sendpage+0x2ad/0x380 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x43e/0x8a0 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0xd4/0x140 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 do_splice+0xb7e/0x1960 fs/splice.c:1079
 __do_splice+0x134/0x250 fs/splice.c:1144
 __do_sys_splice fs/splice.c:1350 [inline]
 __se_sys_splice fs/splice.c:1332 [inline]
 __x64_sys_splice+0x198/0x250 fs/splice.c:1332
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 15158:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1700 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1726
 slab_free mm/slub.c:3492 [inline]
 kfree+0xf3/0x550 mm/slub.c:4552
 rcu_do_batch kernel/rcu/tree.c:2508 [inline]
 rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2743
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558

Last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe9/0x110 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2987 [inline]
 call_rcu+0xb1/0x750 kernel/rcu/tree.c:3067
 taprio_change+0x2fe5/0x4160 net/sched/sch_taprio.c:1597
 qdisc_change net/sched/sch_api.c:1338 [inline]
 tc_modify_qdisc+0xd9a/0x1a60 net/sched/sch_api.c:1640
 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5572
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2510
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1935
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:724
 sock_no_sendpage+0xf3/0x130 net/core/sock.c:2998
 kernel_sendpage.part.0+0x1a0/0x340 net/socket.c:3504
 kernel_sendpage net/socket.c:3501 [inline]
 sock_sendpage+0xe5/0x140 net/socket.c:1003
 pipe_to_sendpage+0x2ad/0x380 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x43e/0x8a0 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0xd4/0x140 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 do_splice+0xb7e/0x1960 fs/splice.c:1079
 __do_splice+0x134/0x250 fs/splice.c:1144
 __do_sys_splice fs/splice.c:1350 [inline]
 __se_sys_splice fs/splice.c:1332 [inline]
 __x64_sys_splice+0x198/0x250 fs/splice.c:1332
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Second to last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe9/0x110 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2987 [inline]
 call_rcu+0xb1/0x750 kernel/rcu/tree.c:3067
 taprio_change+0x2fe5/0x4160 net/sched/sch_taprio.c:1597
 qdisc_change net/sched/sch_api.c:1338 [inline]
 tc_modify_qdisc+0xd9a/0x1a60 net/sched/sch_api.c:1640
 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5572
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2510
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1935
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:724
 sock_no_sendpage+0xf3/0x130 net/core/sock.c:2998
 kernel_sendpage.part.0+0x1a0/0x340 net/socket.c:3504
 kernel_sendpage net/socket.c:3501 [inline]
 sock_sendpage+0xe5/0x140 net/socket.c:1003
 pipe_to_sendpage+0x2ad/0x380 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x43e/0x8a0 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0xd4/0x140 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 do_splice+0xb7e/0x1960 fs/splice.c:1079
 __do_splice+0x134/0x250 fs/splice.c:1144
 __do_sys_splice fs/splice.c:1350 [inline]
 __se_sys_splice fs/splice.c:1332 [inline]
 __x64_sys_splice+0x198/0x250 fs/splice.c:1332
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88801e52ab00
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 64 bytes inside of
 96-byte region [ffff88801e52ab00, ffff88801e52ab60)
The buggy address belongs to the page:
page:ffffea0000794a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e52a
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea000073f200 0000001300000013 ffff888010c41780
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 148, ts 8257061187, free_ts 0
 prep_new_page mm/page_alloc.c:2424 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4153
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5375
 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191
 alloc_slab_page mm/slub.c:1770 [inline]
 allocate_slab mm/slub.c:1907 [inline]
 new_slab+0x319/0x490 mm/slub.c:1970
 ___slab_alloc+0x950/0x1050 mm/slub.c:3001
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3088
 slab_alloc_node mm/slub.c:3179 [inline]
 slab_alloc mm/slub.c:3221 [inline]
 kmem_cache_alloc_trace+0x302/0x3c0 mm/slub.c:3238
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 blk_mq_alloc_ctxs block/blk-mq.c:3062 [inline]
 blk_mq_init_allocated_queue+0xfd/0x12c0 block/blk-mq.c:3279
 blk_mq_init_queue_data block/blk-mq.c:3123 [inline]
 blk_mq_init_queue+0x75/0xd0 block/blk-mq.c:3133
 scsi_alloc_sdev+0x814/0xd70 drivers/scsi/scsi_scan.c:272
 scsi_probe_and_add_lun+0x200b/0x3590 drivers/scsi/scsi_scan.c:1106
 __scsi_scan_target+0x21f/0xdb0 drivers/scsi/scsi_scan.c:1588
 scsi_scan_channel drivers/scsi/scsi_scan.c:1676 [inline]
 scsi_scan_channel+0x148/0x1e0 drivers/scsi/scsi_scan.c:1652
 scsi_scan_host_selected+0x2df/0x3b0 drivers/scsi/scsi_scan.c:1705
 do_scsi_scan_host+0x1e8/0x260 drivers/scsi/scsi_scan.c:1844
 do_scan_async+0x3e/0x500 drivers/scsi/scsi_scan.c:1854
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801e52aa00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
 ffff88801e52aa80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88801e52ab00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                                           ^
 ffff88801e52ab80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88801e52ac00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
==================================================================

Fix bisection attempts:
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2022/05/18 14:56 upstream 210e04ff7681 d50eb50a .config log report syz C
ci-upstream-kasan-gce 2022/04/18 14:20 upstream b2d229d4ddb1 d50eb50a .config log report syz C
ci-upstream-kasan-gce 2022/02/24 03:19 upstream 23d04328444a d50eb50a .config log report syz C
ci-upstream-kasan-gce 2022/01/25 02:42 upstream dd81e1c7d5fb d50eb50a .config log report syz C
ci-upstream-kasan-gce 2021/12/26 02:04 upstream e2ae0d4a6b0b d50eb50a .config log report syz C
ci-upstream-kasan-gce 2021/11/26 01:27 upstream 8ced7ca35703 d50eb50a .config log report syz C
ci-upstream-kasan-gce 2021/10/07 09:20 upstream 5af4055fa813 55aa55c2 .config log report syz
ci-upstream-kasan-gce 2021/09/07 08:21 upstream 4b93c544e90e 55aa55c2 .config log report syz
ci-upstream-kasan-gce 2021/08/05 10:47 upstream 251a1524293d 55aa55c2 .config log report syz
ci-upstream-net-this-kasan-gce 2021/06/22 16:52 net 0cd58e5c53ba 3c7fef33 .config log report syz
Crashes (9):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2021/10/27 00:50 upstream 3906fe9bb7f1 d50eb50a .config log report syz C KASAN: use-after-free Read in dump_schedule
ci-upstream-kasan-gce-selinux-root 2021/10/18 20:48 upstream cf52ad5ff16c 0c5d9412 .config log report syz C KASAN: use-after-free Read in dump_schedule
ci-upstream-kasan-gce-selinux-root 2022/03/19 13:45 upstream 34e047aa16c0 e2d91b1d .config log report syz KASAN: use-after-free Read in dump_schedule
ci-upstream-kasan-gce 2021/07/06 04:37 upstream 3dbdb38e2869 55aa55c2 .config log report syz KASAN: use-after-free Read in dump_schedule
ci-upstream-net-this-kasan-gce 2021/05/23 16:09 net e29f011e8fc0 3c7fef33 .config log report syz KASAN: use-after-free Read in dump_schedule
ci-upstream-net-kasan-gce 2021/05/23 13:25 net-next f5120f599880 3c7fef33 .config log report syz KASAN: use-after-free Read in dump_schedule
ci-upstream-kasan-gce 2022/05/23 07:26 upstream 4b0986a3613c 7268fa62 .config log report info KASAN: use-after-free Read in dump_schedule
ci-upstream-kasan-gce 2021/07/05 22:54 upstream 3dbdb38e2869 55aa55c2 .config log report info KASAN: use-after-free Read in dump_schedule
ci-upstream-net-kasan-gce 2021/05/23 10:13 net-next f5120f599880 3c7fef33 .config log report info KASAN: use-after-free Read in dump_schedule