syzbot


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

Status: fixed on 2020/05/10 10:42
Reported-by: syzbot+c72da7b9ed57cde6fca2@syzkaller.appspotmail.com
Fix commit: 0d1c3530e1bd net_sched: keep alloc_hash updated after hash allocation
First crash: 1531d, last: 1509d
Cause bisection: introduced by (bisect log) :
commit 599be01ee567b61f4471ee8078870847d0a11e8e
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

Crash: KASAN: slab-out-of-bounds Write in tcindex_set_parms (log)
Repro: C syz .config
  
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 4.9 000/102] 4.9.218-rc1 review 112 (112) 2020/04/07 06:05
[PATCH 4.14 000/148] 4.14.175-rc1 review 153 (153) 2020/04/02 22:47
[PATCH 4.19 000/116] 4.19.114-rc1 review 129 (129) 2020/04/02 20:04
[PATCH 5.5 000/170] 5.5.14-rc1 review 180 (180) 2020/04/02 17:40
[PATCH 4.4 00/91] 4.4.218-rc1 review 97 (97) 2020/04/02 14:13
[PATCH 5.4 000/155] 5.4.29-rc1 review 156 (156) 2020/03/31 08:59
[Patch net] net_sched: hold rtnl lock in tcindex_partial_destroy_work() 4 (4) 2020/03/15 03:43
KASAN: slab-out-of-bounds Write in tcindex_set_parms 2 (4) 2020/03/11 04:56
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Write in tcindex_set_parms C done 2 1528d 1528d 1/1 fixed on 2020/04/12 11:41
linux-4.14 KASAN: slab-out-of-bounds Write in tcindex_set_parms C done 2 1521d 1521d 1/1 fixed on 2020/04/17 19:57
Last patch testing requests (1)
Created Duration User Patch Repo Result
2020/03/11 00:34 18m xiyou.wangcong@gmail.com https://github.com/congwang/linux.git tcindex OK

Sample crash report:
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: slab-out-of-bounds in tcindex_set_parms+0x17fd/0x1a00 net/sched/cls_tcindex.c:455
Write of size 16 at addr ffff8880a231e6b8 by task syz-executor747/10502

CPU: 1 PID: 10502 Comm: syz-executor747 Not tainted 5.6.0-rc6-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.constprop.0.cold+0xd3/0x315 mm/kasan/report.c:374
 __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:506
 kasan_report+0xe/0x20 mm/kasan/common.c:641
 tcindex_set_parms+0x17fd/0x1a00 net/sched/cls_tcindex.c:455
 tcindex_change+0x203/0x2e0 net/sched/cls_tcindex.c:518
 tc_new_tfilter+0xa59/0x20b0 net/sched/cls_api.c:2103
 rtnetlink_rcv_msg+0x810/0xad0 net/core/rtnetlink.c:5427
 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2478
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x537/0x740 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x882/0xe10 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6b9/0x7d0 net/socket.c:2345
 ___sys_sendmsg+0x100/0x170 net/socket.c:2399
 __sys_sendmsg+0xec/0x1b0 net/socket.c:2432
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440e79
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:00007ffead913b38 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004a2650 RCX: 0000000000440e79
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007ffead913b40 R08: 0000000120080522 R09: 0000000120080522
R10: 0000000120080522 R11: 0000000000000246 R12: 00000000004a2650
R13: 0000000000402410 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 10502:
 save_stack+0x1b/0x80 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:515 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:488
 kmem_cache_alloc_trace+0x153/0x7d0 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 tipc_crypto_start+0x77/0x370 net/tipc/crypto.c:1348
 tipc_init_net+0x331/0x5c0 net/tipc/core.c:71
 ops_init+0xaf/0x420 net/core/net_namespace.c:137
 setup_net+0x2d4/0x850 net/core/net_namespace.c:327
 copy_net_ns+0x293/0x590 net/core/net_namespace.c:468
 create_new_namespaces+0x3fb/0xb30 kernel/nsproxy.c:108
 unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:229
 ksys_unshare+0x43d/0x8e0 kernel/fork.c:2955
 __do_sys_unshare kernel/fork.c:3023 [inline]
 __se_sys_unshare kernel/fork.c:3021 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3021
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2515:
 save_stack+0x1b/0x80 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:476
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x109/0x2b0 mm/slab.c:3757
 call_usermodehelper_freeinfo kernel/umh.c:48 [inline]
 umh_complete kernel/umh.c:62 [inline]
 umh_complete+0x81/0x90 kernel/umh.c:51
 call_usermodehelper_exec_async+0x459/0x710 kernel/umh.c:122
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8880a231e600
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 184 bytes inside of
 192-byte region [ffff8880a231e600, ffff8880a231e6c0)
The buggy address belongs to the page:
page:ffffea000288c780 refcount:1 mapcount:0 mapping:ffff8880aa000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002884d08 ffffea00028895c8 ffff8880aa000000
raw: 0000000000000000 ffff8880a231e000 0000000100000010 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a231e580: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a231e600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a231e680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                           ^
 ffff8880a231e700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a231e780: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/22 20:09 upstream b74b991fb8b9 78267cec .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/03/19 08:01 upstream 5076190daded 0a96a13c .config console log report syz C ci-upstream-kasan-gce-root
2020/03/10 06:28 upstream 30bb5572ce7a 35f53e45 .config console log report syz C ci-upstream-kasan-gce
2020/03/10 01:42 upstream 2c523b344dfa 35f53e45 .config console log report syz C ci-upstream-kasan-gce-386
2020/03/11 06:57 net-old ece0d7bd7461 35f53e45 .config console log report syz C ci-upstream-net-this-kasan-gce
2020/03/11 06:16 net-old ece0d7bd7461 35f53e45 .config console log report syz C ci-upstream-net-this-kasan-gce
2020/03/10 22:17 net-next-old 6c9ee3069380 35f53e45 .config console log report syz C ci-upstream-net-kasan-gce
2020/03/08 09:44 net-next-old 425c075dcbb2 2e9971bb .config console log report syz C ci-upstream-net-kasan-gce
2020/03/30 00:55 linux-next 770fbb32d34e 05736b29 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/03/29 23:35 linux-next 770fbb32d34e 05736b29 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.