syzbot


KASAN: slab-out-of-bounds Read in tcf_exts_destroy

Status: fixed on 2020/03/11 23:02
Reported-by: syzbot+8c1bbc0a9622aa45bcf6@syzkaller.appspotmail.com
Fix commit: 478c4b2ffd44 net_sched: fix an OOB access in cls_tcindex
First crash: 982d, last: 865d

Fix bisection: fixed by (bisect log) :
commit 478c4b2ffd44e5186c7e22ae7c38a86a5b9cfde5
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon Feb 3 05:14:35 2020 +0000

  net_sched: fix an OOB access in cls_tcindex

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in tcf_exts_destroy C done error 8 980d 883d 16/22 fixed on 2020/02/18 14:31
linux-4.14 KASAN: slab-out-of-bounds Read in tcf_exts_destroy C done 1 865d 978d 1/1 fixed on 2020/03/12 12:23

Sample crash report:
netlink: 'syz-executor929': attribute type 2 has an invalid length.
protocol 88fb is buggy, dev hsr_slave_0
protocol 88fb is buggy, dev hsr_slave_1
netlink: 'syz-executor929': attribute type 2 has an invalid length.
==================================================================
BUG: KASAN: slab-out-of-bounds in tcf_exts_destroy+0xb3/0xd0 net/sched/cls_api.c:2041
Read of size 8 at addr ffff8880a4549790 by task syz-executor929/7634

CPU: 0 PID: 7634 Comm: syz-executor929 Not tainted 4.19.79 #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+0x172/0x1f0 lib/dump_stack.c:113
 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_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 tcf_exts_destroy+0xb3/0xd0 net/sched/cls_api.c:2041
 tcindex_free_perfect_hash.isra.0+0xb3/0x150 net/sched/cls_tcindex.c:270
 tcindex_set_parms+0x10e7/0x1e20 net/sched/cls_tcindex.c:484
protocol 88fb is buggy, dev hsr_slave_0
protocol 88fb is buggy, dev hsr_slave_1
 tcindex_change+0x22d/0x315 net/sched/cls_tcindex.c:518
 tc_new_tfilter+0xc54/0x1790 net/sched/cls_api.c:1320
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4747
protocol 88fb is buggy, dev hsr_slave_0
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
protocol 88fb is buggy, dev hsr_slave_1
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4765
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x537/0x720 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+0x3e2/0x920 net/socket.c:2115
 __sys_sendmmsg+0x1bf/0x4e0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443299
Code: e8 9c 07 03 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 3b 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffde91bb8a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000443299
RDX: 0000000000000332 RSI: 0000000020000140 RDI: 0000000000000008
RBP: 000000000000000c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030766461746162
R13: 00000000004041f0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7634:
 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
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15d/0x750 mm/slab.c:3736
 kmalloc_array include/linux/slab.h:637 [inline]
 kcalloc include/linux/slab.h:648 [inline]
 tcindex_alloc_perfect_hash+0x5b/0x350 net/sched/cls_tcindex.c:278
 tcindex_set_parms+0x44e/0x1e20 net/sched/cls_tcindex.c:339
 tcindex_change+0x22d/0x315 net/sched/cls_tcindex.c:518
 tc_new_tfilter+0xc54/0x1790 net/sched/cls_api.c:1320
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4747
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4765
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x537/0x720 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+0x3e2/0x920 net/socket.c:2115
 __sys_sendmmsg+0x1bf/0x4e0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2232:
 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
 call_usermodehelper_freeinfo kernel/umh.c:45 [inline]
 umh_complete kernel/umh.c:59 [inline]
 umh_complete+0x8d/0xa0 kernel/umh.c:48
 call_usermodehelper_exec_async+0x560/0x640 kernel/umh.c:117
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff8880a4549700
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 144 bytes inside of
 192-byte region [ffff8880a4549700, ffff8880a45497c0)
The buggy address belongs to the page:
page:ffffea0002915240 count:1 mapcount:0 mapping:ffff88812c3f0040 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffffea00028faa88 ffffea00028f1f88 ffff88812c3f0040
raw: 0000000000000000 ffff8880a4549000 0000000100000010 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a4549680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880a4549700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a4549780: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                         ^
 ffff8880a4549800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a4549880: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2019/10/17 01:15 linux-4.19.y dafd634415a7 8c88c9c1 .config log report syz C