KASAN: use-after-free Read in qfq_find_class

7 views
Skip to first unread message

syzbot

unread,
May 31, 2020, 11:28:16 AM5/31/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 4f68020f Linux 4.14.182
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16c5fbee100000
kernel config: https://syzkaller.appspot.com/x/.config?x=512ec6eb8f94d0c8
dashboard link: https://syzkaller.appspot.com/bug?extid=dfce07970ed912950568
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

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

==================================================================
BUG: KASAN: use-after-free in qdisc_class_find include/net/sch_generic.h:414 [inline]
BUG: KASAN: use-after-free in qfq_find_class+0x144/0x170 net/sched/sch_qfq.c:214
Read of size 4 at addr ffff8880a4e8ac00 by task syz-executor.3/1968

CPU: 0 PID: 1968 Comm: syz-executor.3 Not tainted 4.14.182-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2b9 mm/kasan/report.c:393
qdisc_class_find include/net/sch_generic.h:414 [inline]
qfq_find_class+0x144/0x170 net/sched/sch_qfq.c:214
tc_ctl_tclass+0x5a4/0xa00 net/sched/sch_api.c:1817
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45ca69
RSP: 002b:00007fc4b6d43c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000004fc600 RCX: 000000000045ca69
RDX: 0492492492492642 RSI: 0000000020000180 RDI: 0000000000000006
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000007
R13: 00000000000008de R14: 00000000004cba68 R15: 00007fc4b6d446d4

Allocated by task 1968:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
kmem_cache_alloc_trace+0x14d/0x3f0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
qfq_change_class+0x7d2/0x107a net/sched/sch_qfq.c:475
tc_ctl_tclass+0x3e2/0xa00 net/sched/sch_api.c:1848
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 1968:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
qfq_change_class+0xd86/0x107a net/sched/sch_qfq.c:529
tc_ctl_tclass+0x3e2/0xa00 net/sched/sch_api.c:1848
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a4e8ac00
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
128-byte region [ffff8880a4e8ac00, ffff8880a4e8ac80)
The buggy address belongs to the page:
page:ffffea000293a280 count:1 mapcount:0 mapping:ffff8880a4e8a000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a4e8a000 0000000000000000 0000000100000015
raw: ffffea000212cee0 ffffea0002a22360 ffff8880aa800640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a4e8ab00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880a4e8ab80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a4e8ac00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a4e8ac80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880a4e8ad00: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
May 31, 2020, 11:57:17 AM5/31/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 4f68020f Linux 4.14.182
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12ca9dba100000
kernel config: https://syzkaller.appspot.com/x/.config?x=512ec6eb8f94d0c8
dashboard link: https://syzkaller.appspot.com/bug?extid=dfce07970ed912950568
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10330cf2100000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16b6b5ce100000

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

RDX: 0492492492492642 RSI: 0000000020000180 RDI: 0000000000000006
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: use-after-free in qdisc_class_find include/net/sch_generic.h:414 [inline]
BUG: KASAN: use-after-free in qfq_find_class+0x144/0x170 net/sched/sch_qfq.c:214
Read of size 4 at addr ffff8880a9a93d80 by task syz-executor262/6558

CPU: 0 PID: 6558 Comm: syz-executor262 Not tainted 4.14.182-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2b9 mm/kasan/report.c:393
qdisc_class_find include/net/sch_generic.h:414 [inline]
qfq_find_class+0x144/0x170 net/sched/sch_qfq.c:214
tc_ctl_tclass+0x5a4/0xa00 net/sched/sch_api.c:1817
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x444089
RSP: 002b:00007fffd2a727a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000444089
RDX: 0492492492492642 RSI: 0000000020000180 RDI: 0000000000000006
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6558:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
kmem_cache_alloc_trace+0x14d/0x3f0 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
qfq_change_class+0x7d2/0x107a net/sched/sch_qfq.c:475
tc_ctl_tclass+0x3e2/0xa00 net/sched/sch_api.c:1848
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6558:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
qfq_change_class+0xd86/0x107a net/sched/sch_qfq.c:529
tc_ctl_tclass+0x3e2/0xa00 net/sched/sch_api.c:1848
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x349/0x840 net/socket.c:2062
__sys_sendmmsg+0x129/0x330 net/socket.c:2152
SYSC_sendmmsg net/socket.c:2183 [inline]
SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a9a93d80
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
128-byte region [ffff8880a9a93d80, ffff8880a9a93e00)
The buggy address belongs to the page:
page:ffffea0002a6a4c0 count:1 mapcount:0 mapping:ffff8880a9a93000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a9a93000 0000000000000000 0000000100000015
raw: ffffea0002814ee0 ffffea000253e560 ffff8880aa800640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a9a93c80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880a9a93d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a9a93d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a9a93e00: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8880a9a93e80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
==================================================================

Reply all
Reply to author
Forward
0 new messages