syzbot


KASAN: use-after-free Read in qfq_search_class

Status: fixed on 2021/07/24 09:31
Reported-by: syzbot+be654aa177a9b51f83b9@syzkaller.appspotmail.com
Fix commit: 98fd088c3254 pkt_sched: sch_qfq: fix qfq_change_class() error path
First crash: 1495d, last: 1009d
Fix bisection: fixed by (bisect log) :
commit 98fd088c325429327fc5ddb0b12c6a203ebf7f30
Author: Eric Dumazet <edumazet@google.com>
Date: Mon Jun 21 17:54:49 2021 +0000

  pkt_sched: sch_qfq: fix qfq_change_class() error path

  
Fix bisection attempts (18)
Created Duration User Patch Repo Result
2021/07/23 21:28 5h25m bisect fix linux-4.19.y job log (1)
2021/06/23 20:54 30m bisect fix linux-4.19.y job log (0) log
2021/05/24 20:22 32m bisect fix linux-4.19.y job log (0) log
2021/04/24 19:35 33m bisect fix linux-4.19.y job log (0) log
2021/03/25 10:53 31m bisect fix linux-4.19.y job log (0) log
2021/02/23 08:34 34m bisect fix linux-4.19.y job log (0) log
2021/02/19 05:08 19m bisect fix linux-4.19.y error job log (0)
2021/01/19 01:46 30m bisect fix linux-4.19.y job log (0) log
2020/12/20 01:14 26m bisect fix linux-4.19.y job log (0) log
2020/11/20 00:41 25m bisect fix linux-4.19.y job log (0) log
2020/10/21 00:11 27m bisect fix linux-4.19.y job log (0) log
2020/09/20 23:40 27m bisect fix linux-4.19.y job log (0) log
2020/08/21 23:10 30m bisect fix linux-4.19.y job log (0) log
2020/07/22 22:40 28m bisect fix linux-4.19.y job log (0) log
2020/06/22 22:13 26m bisect fix linux-4.19.y job log (0) log
2020/05/23 21:26 25m bisect fix linux-4.19.y job log (0) log
2020/04/23 20:36 28m bisect fix linux-4.19.y job log (0) log
2020/03/24 15:36 30m bisect fix linux-4.19.y job log (0) log

Sample crash report:
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fcd9605dd80
R13: 0000000000000009 R14: 0000000000000000 R15: 0507002400000074
netlink: 24 bytes leftover after parsing attributes in process `syz-executor372'.
==================================================================
BUG: KASAN: use-after-free in qdisc_class_find include/net/sch_generic.h:528 [inline]
BUG: KASAN: use-after-free in qfq_find_class net/sched/sch_qfq.c:214 [inline]
BUG: KASAN: use-after-free in qfq_search_class+0x16e/0x1a0 net/sched/sch_qfq.c:565
Read of size 4 at addr ffff8880a0f21b40 by task syz-executor372/11117

CPU: 0 PID: 11117 Comm: syz-executor372 Not tainted 4.19.105-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 qdisc_class_find include/net/sch_generic.h:528 [inline]
 qfq_find_class net/sched/sch_qfq.c:214 [inline]
 qfq_search_class+0x16e/0x1a0 net/sched/sch_qfq.c:565
 tc_ctl_tclass+0x73b/0xc60 net/sched/sch_api.c:1956
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4777
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4795
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4471f9
Code: e8 0c bb 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 0f 83 fb 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fcd9603cd78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dcc78 RCX: 00000000004471f9
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 000000000000000f
RBP: 00000000006dcc70 R08: 0000000000000001 R09: 0000000000000036
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fcd9603cd80
R13: 0000000000000010 R14: 0000000000000000 R15: 0507002400000074

Allocated by task 11102:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 qfq_change_class+0x7e1/0x15ce net/sched/sch_qfq.c:476
 tc_ctl_tclass+0x4f8/0xc60 net/sched/sch_api.c:1992
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4777
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4795
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 11102:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 qfq_change_class+0xff7/0x15ce net/sched/sch_qfq.c:530
 tc_ctl_tclass+0x4f8/0xc60 net/sched/sch_api.c:1992
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4777
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4795
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a0f21b40
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 0 bytes inside of
 128-byte region [ffff8880a0f21b40, ffff8880a0f21bc0)
The buggy address belongs to the page:
page:ffffea000283c840 count:1 mapcount:0 mapping:ffff88812c31c640 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002a1bbc8 ffffea00026c0f48 ffff88812c31c640
raw: 0000000000000000 ffff8880a0f21000 0000000100000015 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a0f21a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880a0f21a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a0f21b00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8880a0f21b80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a0f21c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/02/23 15:34 linux-4.19.y 4fccc2503536 2c36e7a7 .config console log report syz C ci2-linux-4-19
2020/02/23 14:12 linux-4.19.y 4fccc2503536 2c36e7a7 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.