syzbot


KASAN: slab-out-of-bounds Read in qrtr_endpoint_post (2)

Status: fixed on 2021/11/10 00:50
Reported-by: syzbot+1917d778024161609247@syzkaller.appspotmail.com
Fix commit: ad9d24c9429e net: qrtr: fix OOB Read in qrtr_endpoint_post
First crash: 788d, last: 423d

Cause bisection: introduced by (bisect log) :
commit e42671084361302141a09284fde9bbc14fdd16bf
Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Date: Thu May 7 12:53:06 2020 +0000

  net: qrtr: Do not depend on ARCH_QCOM

Crash: KASAN: slab-out-of-bounds Read in qrtr_endpoint_post (log)
Repro: C syz .config
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in qrtr_endpoint_post C 8 821d 822d 17/24 fixed on 2020/07/20 08:03
Patch testing requests:
Created Duration User Patch Repo Result
2021/06/14 11:27 16m paskripkin@gmail.com patch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git v5.13-rc4 OK
2021/06/14 09:56 16m paskripkin@gmail.com patch upstream report log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:406 [inline]
BUG: KASAN: slab-out-of-bounds in skb_put_data include/linux/skbuff.h:2275 [inline]
BUG: KASAN: slab-out-of-bounds in qrtr_endpoint_post+0x5c1/0x1050 net/qrtr/qrtr.c:493
Read of size 4294967293 at addr ffff8880a78ceba0 by task syz-executor116/6853

CPU: 0 PID: 6853 Comm: syz-executor116 Not tainted 5.9.0-rc8-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+0x198/0x1fd lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 memcpy+0x20/0x60 mm/kasan/common.c:105
 memcpy include/linux/string.h:406 [inline]
 skb_put_data include/linux/skbuff.h:2275 [inline]
 qrtr_endpoint_post+0x5c1/0x1050 net/qrtr/qrtr.c:493
 qrtr_tun_write_iter+0xf5/0x180 net/qrtr/tun.c:92
 call_write_iter include/linux/fs.h:1882 [inline]
 new_sync_write+0x422/0x650 fs/read_write.c:503
 vfs_write+0x5ad/0x730 fs/read_write.c:586
 ksys_write+0x12d/0x250 fs/read_write.c:639
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x440279
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 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc4447bda8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440279
RDX: 0000000000000020 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401a80
R13: 0000000000401b10 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6853:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 __do_kmalloc mm/slab.c:3659 [inline]
 __kmalloc+0x1b0/0x360 mm/slab.c:3668
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 qrtr_tun_write_iter+0x8a/0x180 net/qrtr/tun.c:83
 call_write_iter include/linux/fs.h:1882 [inline]
 new_sync_write+0x422/0x650 fs/read_write.c:503
 vfs_write+0x5ad/0x730 fs/read_write.c:586
 ksys_write+0x12d/0x250 fs/read_write.c:639
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8880a78ceb80
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes to the right of
 32-byte region [ffff8880a78ceb80, ffff8880a78ceba0)
The buggy address belongs to the page:
page:0000000049b6cf59 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880a78cefc1 pfn:0xa78ce
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea000277e148 ffffea00027a8c88 ffff8880aa040100
raw: ffff8880a78cefc1 ffff8880a78ce000 000000010000002d 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a78cea80: 00 00 fc fc fc fc fc fc 00 00 fc fc fc fc fc fc
 ffff8880a78ceb00: 00 00 fc fc fc fc fc fc fa fb fb fb fc fc fc fc
>ffff8880a78ceb80: 00 00 00 00 fc fc fc fc fb fb fb fb fc fc fc fc
                               ^
 ffff8880a78cec00: fb fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
 ffff8880a78cec80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
==================================================================

Fix bisection attempts:
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2021/04/23 20:18 upstream 5bfc75d92efd 5ef9c291 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2021/03/19 17:21 upstream 8b12a62a4e3e 5ef9c291 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2020/12/23 19:31 upstream 614cb5894306 5ef9c291 .config log report syz C
* Struck through repros no longer work on HEAD.
Crashes (41):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/10/05 11:37 upstream 549738f15da0 5ef9c291 .config log report syz C
ci-upstream-kasan-gce-root 2020/10/04 04:13 upstream 22fbc037cd32 1a3f9408 .config log report syz C
ci-upstream-kasan-gce-smack-root 2020/09/25 13:54 upstream 171d4ff79f96 54289b08 .config log report syz C
ci-upstream-kasan-gce 2020/09/23 15:28 upstream 805c6d3c1921 287cd75a .config log report syz C
ci-upstream-kasan-gce 2020/08/13 05:12 upstream fb893de323e2 bc15f7db .config log report syz C
ci-upstream-kasan-gce 2020/08/13 02:51 upstream fb893de323e2 bc15f7db .config log report syz C
ci-upstream-kasan-gce-root 2020/08/02 23:20 upstream ac3a0c847296 63a73341 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2020/08/01 09:40 upstream d8b9faec54ae d895b3be .config log report syz C
ci-upstream-kasan-gce-selinux-root 2020/08/01 07:29 upstream d8b9faec54ae d895b3be .config log report syz C
ci-upstream-kasan-gce-smack-root 2020/07/31 19:40 upstream d8b9faec54ae d895b3be .config log report syz C
ci-upstream-kasan-gce-smack-root 2020/07/31 14:52 upstream 83bdc7275e62 8df85ed9 .config log report syz C
ci-upstream-kasan-gce-root 2020/07/31 14:40 upstream 83bdc7275e62 8df85ed9 .config log report syz C
ci-upstream-kasan-gce-386 2020/09/23 07:06 upstream eff48ddeab78 3e8f6c27 .config log report syz C
ci-upstream-kasan-gce-386 2020/08/13 07:21 upstream fb893de323e2 bc15f7db .config log report syz C
ci-upstream-kasan-gce-386 2020/08/13 05:01 upstream fb893de323e2 bc15f7db .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/11/02 07:02 linux-next 4e78c578cb98 8bc4594f .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/08/05 02:29 linux-next 01830e6c042e 80a06902 .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/08/05 00:13 linux-next 01830e6c042e 80a06902 .config log report syz C
ci-upstream-kasan-gce 2021/07/31 02:43 upstream 764a5bc89b12 6c236867 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-smack-root 2021/07/28 14:09 upstream 7d549995d4e0 17d6ab15 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-selinux-root 2021/05/17 21:15 upstream d07f6ca923ea a2eb125d .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-root 2021/05/11 01:51 upstream 0aa099a312b6 ca873091 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-smack-root 2021/04/29 00:56 upstream acd3d2859453 77e2b668 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-smack-root 2021/04/26 06:34 upstream d2d09fbe33f8 2a82f1b3 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce 2021/03/24 19:58 upstream 7acac4b3196c 607e3baf .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce 2021/03/23 04:08 upstream 84196390620a 8092f30d .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce 2021/03/23 04:07 upstream 84196390620a 8092f30d .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-root 2021/03/23 03:19 upstream 84196390620a 8092f30d .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-selinux-root 2021/02/17 17:00 upstream f40ddce88593 052f8d9f .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-linux-next-kasan-gce-root 2021/07/28 15:59 linux-next 42d0b5f52c9b 17d6ab15 .config log report info KASAN: slab-out-of-bounds Read in qrtr_endpoint_post
ci-upstream-kasan-gce-selinux-root 2021/01/05 09:11 upstream 36bbbd0e234d 2a28ff1f .config log report info
ci-upstream-kasan-gce 2020/11/23 19:14 upstream 418baf2c28f3 878fb17a .config log report info
ci-upstream-kasan-gce 2020/08/25 20:07 upstream 6a9dc5fd6170 344da168 .config log report
ci-upstream-kasan-gce 2020/08/21 20:40 upstream cd02217a5d81 6436ce4b .config log report
ci-upstream-kasan-gce 2020/08/13 11:14 upstream fb893de323e2 bc15f7db .config log report
ci-upstream-kasan-gce-smack-root 2020/08/13 11:00 upstream fb893de323e2 bc15f7db .config log report
ci-upstream-kasan-gce-root 2020/08/11 03:40 upstream fc80c51fd4b2 7adc7b65 .config log report
ci-upstream-kasan-gce-selinux-root 2020/08/11 03:17 upstream fc80c51fd4b2 7adc7b65 .config log report
ci-upstream-kasan-gce-selinux-root 2020/08/10 02:45 upstream 9420f1ce0186 70301872 .config log report
ci-upstream-kasan-gce-root 2020/07/31 14:29 upstream 83bdc7275e62 8df85ed9 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/08/01 20:34 linux-next 01830e6c042e d895b3be .config log report
* Struck through repros no longer work on HEAD.