syzbot


KASAN: slab-out-of-bounds Write in tcindex_set_parms
Status: fixed on 2020/04/17 19:57
Reported-by: syzbot+a5203d2fc3d2d926b2e1@syzkaller.appspotmail.com
Fix commit: 9f8b6c44be17 net_sched: keep alloc_hash updated after hash allocation
First crash: 797d, last: 797d

Fix bisection: fixed by (bisect log) :
commit 9f8b6c44be178c2498a00b270872a6e30e7c8266
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 785d 806d 17/22 fixed on 2020/05/10 10:42
linux-4.19 KASAN: slab-out-of-bounds Write in tcindex_set_parms C done 2 804d 804d 1/1 fixed on 2020/04/12 11:41

Sample crash report:
audit: type=1400 audit(1584551797.681:36): avc:  denied  { map } for  pid=7252 comm="syz-executor815" path="/root/syz-executor815421090" dev="sda1" ino=1426 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+0x1521/0x16a0 net/sched/cls_tcindex.c:473
Write of size 16 at addr ffff888095dda8f0 by task syz-executor815/7253

CPU: 0 PID: 7253 Comm: syz-executor815 Not tainted 4.14.173-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+0x13e/0x194 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1e2 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/0x2ae mm/kasan/report.c:393
 tcindex_set_parms+0x1521/0x16a0 net/sched/cls_tcindex.c:473
 tcindex_change+0x1b5/0x270 net/sched/cls_tcindex.c:534
 tc_ctl_tfilter+0xf13/0x18e6 net/sched/cls_api.c:738
 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/0x620 net/netlink/af_netlink.c:1313
 netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xc5/0x100 net/socket.c:656
 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440e79
RSP: 002b:00007fffaef80ca8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004a2650 RCX: 0000000000440e79
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007fffaef80cb0 R08: 0000000120080522 R09: 0000000120080522
R10: 0000000120080522 R11: 0000000000000246 R12: 00000000004a2650
R13: 0000000000402410 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7253:
 save_stack+0x32/0xa0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc_track_caller+0x153/0x7b0 mm/slab.c:3735
 kmemdup+0x23/0x50 mm/util.c:118
 kmemdup include/linux/string.h:420 [inline]
 mpls_dev_sysctl_register+0x94/0x290 net/mpls/af_mpls.c:1323
 mpls_add_dev net/mpls/af_mpls.c:1389 [inline]
 mpls_dev_notify+0x1f9/0x691 net/mpls/af_mpls.c:1511
 notifier_call_chain+0x107/0x1a0 kernel/notifier.c:93
 call_netdevice_notifiers net/core/dev.c:1687 [inline]
 register_netdevice+0x9e2/0xc70 net/core/dev.c:7691
 register_netdev+0x17/0x30 net/core/dev.c:7798
 sit_init_net+0x2cf/0x8d0 net/ipv6/sit.c:1850
 ops_init+0xa5/0x3c0 net/core/net_namespace.c:118
 setup_net+0x22f/0x500 net/core/net_namespace.c:295
 copy_net_ns+0x19b/0x440 net/core/net_namespace.c:419
 create_new_namespaces+0x375/0x730 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xa5/0x1e0 kernel/nsproxy.c:206
 SYSC_unshare kernel/fork.c:2391 [inline]
 SyS_unshare+0x2ea/0x740 kernel/fork.c:2341
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 17:
 save_stack+0x32/0xa0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcb/0x260 mm/slab.c:3815
 __rcu_reclaim kernel/rcu/rcu.h:190 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x8a3/0x1190 kernel/rcu/tree.c:2946
 __do_softirq+0x254/0x9bf kernel/softirq.c:288

The buggy address belongs to the object at ffff888095dda840
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 48 bytes to the right of
 128-byte region [ffff888095dda840, ffff888095dda8c0)
The buggy address belongs to the page:
page:ffffea0002577680 count:1 mapcount:0 mapping:ffff888095dda000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff888095dda000 0000000000000000 0000000100000015
raw: ffffea0002936ae0 ffffea0002593920 ffff88812fe56640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888095dda780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
 ffff888095dda800: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
>ffff888095dda880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                                             ^
 ffff888095dda900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
 ffff888095dda980: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/03/18 17:19 linux-4.14.y 12cd844a39ed 0a96a13c .config log report syz C
ci2-linux-4-14 2020/03/18 16:04 linux-4.14.y 12cd844a39ed 0a96a13c .config log report syz C