syzbot


KASAN: slab-out-of-bounds Write in tcindex_set_parms

Status: fixed on 2020/04/12 11:41
Reported-by: syzbot+07793f753385ffac9073@syzkaller.appspotmail.com
Fix commit: 557d015ffb27 net_sched: keep alloc_hash updated after hash allocation
First crash: 1543d, last: 1543d
Fix bisection: fixed by (bisect log) :
commit 557d015ffb27b672e24e6ad141fd887783871dc2
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu Mar 12 05:42:28 2020 +0000

  net_sched: keep alloc_hash updated after hash allocation

  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in tcindex_set_parms C done 10 1524d 1545d 15/26 fixed on 2020/05/10 10:42
linux-4.14 KASAN: slab-out-of-bounds Write in tcindex_set_parms C done 2 1535d 1536d 1/1 fixed on 2020/04/17 19:57

Sample crash report:
audit: type=1400 audit(1583918104.591:36): avc:  denied  { map } for  pid=8151 comm="syz-executor606" path="/root/syz-executor606153954" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: slab-out-of-bounds in tcindex_set_parms+0x17d0/0x19d0 net/sched/cls_tcindex.c:455
Write of size 16 at addr ffff8880a7af60b8 by task syz-executor606/8152

CPU: 1 PID: 8152 Comm: syz-executor606 Not tainted 4.19.108-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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x212 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+0x88/0x2b9 mm/kasan/report.c:396
 tcindex_set_parms+0x17d0/0x19d0 net/sched/cls_tcindex.c:455
 tcindex_change+0x200/0x2d3 net/sched/cls_tcindex.c:517
 tc_new_tfilter+0xa6b/0x1450 net/sched/cls_api.c:1320
 rtnetlink_rcv_msg+0x453/0xaf0 net/core/rtnetlink.c:4777
 netlink_rcv_skb+0x160/0x410 net/netlink/af_netlink.c:2455
 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
 netlink_unicast+0x4d7/0x6a0 net/netlink/af_netlink.c:1344
 netlink_sendmsg+0x80b/0xcd0 net/netlink/af_netlink.c:1909
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0xec/0x1b0 net/socket.c:2153
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440eb9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 7b 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffccbed80a8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004a2690 RCX: 0000000000440eb9
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00000000004a2690 R08: 0000000120080522 R09: 0000000120080522
R10: 0000000120080522 R11: 0000000000000246 R12: 00000000004023c0
R13: 0000000000402450 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1:
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
 kmem_cache_alloc+0x127/0x710 mm/slab.c:3559
 kmem_cache_zalloc include/linux/slab.h:699 [inline]
 __kernfs_new_node+0xd2/0x680 fs/kernfs/dir.c:633
 kernfs_new_node+0x92/0x120 fs/kernfs/dir.c:693
 kernfs_create_dir_ns+0x48/0x150 fs/kernfs/dir.c:1019
 sysfs_create_dir_ns+0x127/0x280 fs/sysfs/dir.c:58
 create_dir lib/kobject.c:88 [inline]
 kobject_add_internal+0x29d/0x8c0 lib/kobject.c:247
 kobject_add_varg lib/kobject.c:382 [inline]
 kobject_add+0x150/0x1c0 lib/kobject.c:426
 device_add+0x3a4/0x1660 drivers/base/core.c:1971
 workqueue_sysfs_register+0x1a5/0x3e0 kernel/workqueue.c:5469
 __alloc_workqueue_key+0x666/0xf10 kernel/workqueue.c:4121
 ib_core_init+0x61/0x2cb drivers/infiniband/core/device.c:1163
 do_one_initcall+0xf1/0x734 init/main.c:883
 do_initcall_level init/main.c:951 [inline]
 do_initcalls init/main.c:959 [inline]
 do_basic_setup init/main.c:977 [inline]
 kernel_init_freeable+0x4c9/0x5bb init/main.c:1144
 kernel_init+0xd/0x1c0 init/main.c:1061
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a7af6000
 which belongs to the cache kernfs_node_cache of size 160
The buggy address is located 24 bytes to the right of
 160-byte region [ffff8880a7af6000, ffff8880a7af60a0)
The buggy address belongs to the page:
page:ffffea00029ebd80 count:1 mapcount:0 mapping:ffff88821bc46c80 index:0xffff8880a7af6fee
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00029ebd08 ffffea00029ebdc8 ffff88821bc46c80
raw: ffff8880a7af6fee ffff8880a7af6000 0000000100000012 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a7af5f80: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a7af6000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a7af6080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00
                                        ^
 ffff8880a7af6100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a7af6180: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/11 09:17 linux-4.19.y 7472c4028e23 35f53e45 .config console log report syz C ci2-linux-4-19
2020/03/11 08:07 linux-4.19.y 7472c4028e23 35f53e45 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.