syzbot


KASAN: use-after-free Read in u32_destroy_key

Status: upstream: reported C repro on 2020/06/09 01:13
Reported-by: syzbot+4effaa8c391c52e99ecd@syzkaller.appspotmail.com
First crash: 1474d, last: 979d
Fix bisection the fix commit could be any of (bisect log):
  c6db52a88798 Linux 4.14.183
  4139fb08c05f Linux 4.14.187
  
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/02/08 13:32 14m retest repro linux-4.14.y report log
2022/09/18 05:29 10m retest repro linux-4.14.y report log

Sample crash report:
audit: type=1400 audit(1591668159.693:8): avc:  denied  { execmem } for  pid=6331 comm="syz-executor215" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in u32_destroy_key.constprop.0+0x1a7/0x1e0 net/sched/cls_u32.c:405
Read of size 4 at addr ffff88809a949d98 by task kworker/u4:2/121

CPU: 1 PID: 121 Comm: kworker/u4:2 Not tainted 4.14.183-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: tc_filter_workqueue u32_delete_key_freepf_work
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1dc 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/0x2b9 mm/kasan/report.c:393
 u32_destroy_key.constprop.0+0x1a7/0x1e0 net/sched/cls_u32.c:405
 u32_delete_key_freepf_work+0x1c/0x22 net/sched/cls_u32.c:456
 process_one_work+0x7c0/0x14c0 kernel/workqueue.c:2116
 worker_thread+0x5d7/0x1080 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 6353:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x14d/0x3f0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 u32_init+0x3e9/0x890 net/sched/cls_u32.c:367
 tcf_proto_create net/sched/cls_api.c:166 [inline]
 tc_ctl_tfilter+0xa68/0x18e7 net/sched/cls_api.c:677
 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/0x610 net/netlink/af_netlink.c:1313
 netlink_sendmsg+0x64a/0xbb0 net/netlink/af_netlink.c:1878
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x349/0x840 net/socket.c:2062
 __sys_sendmmsg+0x129/0x330 net/socket.c:2152
 SYSC_sendmmsg net/socket.c:2183 [inline]
 SyS_sendmmsg+0x2f/0x50 net/socket.c:2178
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 121:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcb/0x260 mm/slab.c:3815
 u32_destroy_key.constprop.0+0x108/0x1e0 net/sched/cls_u32.c:406
 u32_delete_key_freepf_work+0x1c/0x22 net/sched/cls_u32.c:456
 process_one_work+0x7c0/0x14c0 kernel/workqueue.c:2116
 worker_thread+0x5d7/0x1080 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88809a949d80
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 24 bytes inside of
 64-byte region [ffff88809a949d80, ffff88809a949dc0)
The buggy address belongs to the page:
page:ffffea00026a5240 count:1 mapcount:0 mapping:ffff88809a949000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88809a949000 0000000000000000 0000000100000020
raw: ffffea00026a0a20 ffffea00026818a0 ffff8880aa800340 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809a949c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88809a949d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88809a949d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                            ^
 ffff88809a949e00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88809a949e80: 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc fc
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/09 02:04 linux-4.14.y c6db52a88798 0d60b78a .config console log report syz C ci2-linux-4-14
2021/10/16 23:34 linux-4.14.y ed99bf0e81b5 0c5d9412 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in u32_destroy_key
2020/12/17 17:50 linux-4.14.y 3f2ecb86cb90 04201c06 .config console log report info ci2-linux-4-14
2020/11/10 12:27 linux-4.14.y e98f3c4269fd cca87986 .config console log report info ci2-linux-4-14
2020/09/25 15:58 linux-4.14.y cbfa1702aaf6 4a006f63 .config console log report info ci2-linux-4-14
2020/07/24 17:37 linux-4.14.y 69b94dd6dcd1 554af388 .config console log report ci2-linux-4-14
2020/07/20 07:23 linux-4.14.y b850307b279c 9c812472 .config console log report ci2-linux-4-14
2020/06/09 01:12 linux-4.14.y c6db52a88798 0d60b78a .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.