[v5.15] KASAN: use-after-free Read in dump_schedule

0 views
Skip to first unread message

syzbot

unread,
Mar 23, 2024, 4:43:25 AMMar 23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b95c01af2113 Linux 5.15.152
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=142632c9180000
kernel config: https://syzkaller.appspot.com/x/.config?x=5794ebfbd890383f
dashboard link: https://syzkaller.appspot.com/bug?extid=7cf7333eb728a0d62e89
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=156367b9180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a0e6be180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ff79808f6ebe/disk-b95c01af.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a4d83399ac47/vmlinux-b95c01af.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f783260a6e28/Image-b95c01af.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7cf733...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1863
Read of size 8 at addr ffff0000c8b8ae40 by task syz-executor348/4357

CPU: 0 PID: 4357 Comm: syz-executor348 Not tainted 5.15.152-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1863
taprio_dump+0x8dc/0xc58 net/sched/sch_taprio.c:1931
tc_fill_qdisc+0x568/0xf30 net/sched/sch_api.c:923
qdisc_notify+0x190/0x324 net/sched/sch_api.c:990
tc_modify_qdisc+0x11b8/0x1364 net/sched/sch_api.c:1688
rtnetlink_rcv_msg+0xa74/0xdac net/core/rtnetlink.c:5629
netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2505
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5647
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356
netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x584/0x870 net/socket.c:2431
___sys_sendmsg+0x214/0x294 net/socket.c:2485
__sys_sendmmsg+0x23c/0x648 net/socket.c:2571
__do_sys_sendmmsg net/socket.c:2600 [inline]
__se_sys_sendmmsg net/socket.c:2597 [inline]
__arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2597
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 4343:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
taprio_change+0x3b0/0x3694 net/sched/sch_taprio.c:1498
qdisc_change+0x228/0x548 net/sched/sch_api.c:1349
tc_modify_qdisc+0x116c/0x1364 net/sched/sch_api.c:1686
rtnetlink_rcv_msg+0xa74/0xdac net/core/rtnetlink.c:5629
netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2505
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5647
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356
netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x584/0x870 net/socket.c:2431
___sys_sendmsg+0x214/0x294 net/socket.c:2485
__sys_sendmmsg+0x23c/0x648 net/socket.c:2571
__do_sys_sendmmsg net/socket.c:2600 [inline]
__se_sys_sendmmsg net/socket.c:2597 [inline]
__arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2597
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 14:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0x178/0x410 mm/slub.c:4559
taprio_free_sched_cb+0x154/0x174 net/sched/sch_taprio.c:127
rcu_do_batch kernel/rcu/tree.c:2523 [inline]
rcu_core+0x830/0x1b34 kernel/rcu/tree.c:2763
rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2776
__do_softirq+0x344/0xdb0 kernel/softirq.c:558

Last potentially related work creation:
kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3007 [inline]
call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087
taprio_change+0x2c98/0x3694 net/sched/sch_taprio.c:1618
qdisc_change+0x228/0x548 net/sched/sch_api.c:1349
tc_modify_qdisc+0x116c/0x1364 net/sched/sch_api.c:1686
rtnetlink_rcv_msg+0xa74/0xdac net/core/rtnetlink.c:5629
netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2505
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5647
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356
netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x584/0x870 net/socket.c:2431
___sys_sendmsg+0x214/0x294 net/socket.c:2485
__sys_sendmmsg+0x23c/0x648 net/socket.c:2571
__do_sys_sendmmsg net/socket.c:2600 [inline]
__se_sys_sendmmsg net/socket.c:2597 [inline]
__arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2597
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000c8b8ae00
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 64 bytes inside of
128-byte region [ffff0000c8b8ae00, ffff0000c8b8ae80)
The buggy address belongs to the page:
page:00000000d69295a3 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108b8a
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000c0002300
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000c8b8ad00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c8b8ad80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c8b8ae00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000c8b8ae80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000c8b8af00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Mar 25, 2024, 11:23:23 AMMar 25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d7543167affd Linux 6.1.82
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14051291180000
kernel config: https://syzkaller.appspot.com/x/.config?x=bde0f71b47fafe10
dashboard link: https://syzkaller.appspot.com/bug?extid=ec83c5ce379ab3116017
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15d8df59180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1dc4836afbbe/disk-d7543167.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/dd967b6d61a8/vmlinux-d7543167.xz
kernel image: https://storage.googleapis.com/syzbot-assets/334421ea662d/Image-d7543167.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ec83c5...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1932
Read of size 8 at addr ffff0000e65c9a40 by task syz-executor.0/4612

CPU: 1 PID: 4612 Comm: syz-executor.0 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
dump_schedule+0xc8/0x7a0 net/sched/sch_taprio.c:1932
taprio_dump+0xa0c/0xd80 net/sched/sch_taprio.c:2029
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_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

Allocated by task 4607:
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:1579
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_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+0x154/0x174 net/sched/sch_taprio.c:127
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

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
taprio_change+0x2e7c/0x3834 net/sched/sch_taprio.c:1686
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_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

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

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

Memory state around the buggy address:
ffff0000e65c9900: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
ffff0000e65c9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000e65c9a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000e65c9a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000e65c9b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.0'.
Reply all
Reply to author
Forward
0 new messages