syzbot


KASAN: use-after-free Write in tcindex_set_parms

Status: fixed on 2020/04/18 14:50
Reported-by: syzbot+bdd9cefe13c3d2122c7e@syzkaller.appspotmail.com
Fix commit: 9f8b6c44be17 net_sched: keep alloc_hash updated after hash allocation
First crash: 1492d, last: 1491d
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
linux-4.19 KASAN: use-after-free Write in tcindex_set_parms C done 3 1498d 1502d 1/1 fixed on 2020/04/12 11:41
upstream KASAN: use-after-free Write in tcindex_set_parms net C done 13 1480d 1499d 15/26 fixed on 2020/05/10 10:42

Sample crash report:
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in tcindex_set_parms+0x1521/0x16a0 net/sched/cls_tcindex.c:473
Write of size 16 at addr ffff8880a865b280 by task syz-executor955/7435

CPU: 0 PID: 7435 Comm: syz-executor955 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:0x443869
RSP: 002b:00007ffd70c9b928 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000443869
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007ffd70c9b930 R08: 0000000001bbbbbb R09: 0000000001bbbbbb
R10: 0000000001bbbbbb R11: 0000000000000246 R12: 00007ffd70c9b940
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7435:
 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
 kmem_cache_alloc_trace+0x14d/0x7b0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 call_usermodehelper_setup+0x6f/0x2e0 kernel/umh.c:374
 call_modprobe kernel/kmod.c:94 [inline]
 __request_module+0x35a/0x8eb kernel/kmod.c:171
 dev_load+0x166/0x1a0 net/core/dev_ioctl.c:388
 dev_ioctl+0x51e/0xcb0 net/core/dev_ioctl.c:475
 sock_do_ioctl+0x8c/0xa0 net/socket.c:981
 sock_ioctl+0x28d/0x450 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7435:
 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
 call_usermodehelper_freeinfo kernel/umh.c:43 [inline]
 call_usermodehelper_exec+0x1f7/0x410 kernel/umh.c:458
 call_modprobe kernel/kmod.c:99 [inline]
 __request_module+0x37a/0x8eb kernel/kmod.c:171
 dev_load+0x166/0x1a0 net/core/dev_ioctl.c:388
 dev_ioctl+0x51e/0xcb0 net/core/dev_ioctl.c:475
 sock_do_ioctl+0x8c/0xa0 net/socket.c:981
 sock_ioctl+0x28d/0x450 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880a865b240
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 64 bytes inside of
 128-byte region [ffff8880a865b240, ffff8880a865b2c0)
The buggy address belongs to the page:
page:ffffea0002a196c0 count:1 mapcount:0 mapping:ffff8880a865b000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a865b000 0000000000000000 0000000100000015
raw: ffffea00023abc20 ffffea00027b20a0 ffff88812fe56640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a865b180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
 ffff8880a865b200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880a865b280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8880a865b300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a865b380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/19 11:53 linux-4.14.y 12cd844a39ed 2c31c529 .config console log report syz C ci2-linux-4-14
2020/03/18 15:25 linux-4.14.y 12cd844a39ed 0a96a13c .config console log report syz C ci2-linux-4-14
2020/03/18 14:50 linux-4.14.y 12cd844a39ed 0a96a13c .config console log report syz ci2-linux-4-14
* Struck through repros no longer work on HEAD.