syzbot


KASAN: use-after-free Read in slip_open
Status: fixed on 2019/12/28 10:32
Reported-by: syzbot+beb2bc33804762bfd7cf@syzkaller.appspotmail.com
Fix commit: f5bcc687e3d6 slip: Fix use-after-free Read in slip_open
First crash: 910d, last: 910d

Cause bisection: introduced by (bisect log) :
commit 021ede687dcccba48a2cae8c98795e9eedc857e1
Author: Aleksander Morgado <aleksander@aleksander.es>
Date: Wed Nov 13 10:11:10 2019 +0000

  net: usb: qmi_wwan: add support for Foxconn T77W968 LTE modules

Crash: WARNING: ODEBUG bug in netdev_freemem (log)
Repro: C syz .config

Fix bisection: fixed by (bisect log) :
commit f5bcc687e3d699bc4949bf37ef5f77fa50269f8c
Author: Jouni Hogander <jouni.hogander@unikie.com>
Date: Mon Nov 25 12:23:43 2019 +0000

  slip: Fix use-after-free Read in slip_open

similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in slip_open C done done 7 903d 914d 1/1 fixed on 2020/01/03 09:37
upstream KASAN: use-after-free Read in slip_open C done 3 912d 913d 16/22 fixed on 2019/12/13 00:31
upstream KASAN: use-after-free Read in slip_open (2) 1 14d 10d 0/22 upstream: reported on 2022/05/14 07:35

Sample crash report:
RDX: 0000000020000080 RSI: 0000000000005423 RDI: 0000000000000003
RBP: 00007fff4b945330 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: use-after-free in sl_sync drivers/net/slip/slip.c:725 [inline]
BUG: KASAN: use-after-free in slip_open+0xd14/0xff1 drivers/net/slip/slip.c:805
Read of size 8 at addr ffff88808b6bed48 by task syz-executor221/7018

CPU: 0 PID: 7018 Comm: syz-executor221 Not tainted 4.14.156-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+0x142/0x197 lib/dump_stack.c:58
 print_address_description.cold+0x7c/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/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 sl_sync drivers/net/slip/slip.c:725 [inline]
 slip_open+0xd14/0xff1 drivers/net/slip/slip.c:805
 tty_ldisc_open.isra.0+0x73/0xb0 drivers/tty/tty_ldisc.c:474
 tty_set_ldisc+0x29a/0x610 drivers/tty/tty_ldisc.c:599
 tiocsetd drivers/tty/tty_io.c:2351 [inline]
 tty_ioctl+0x95b/0x1320 drivers/tty/tty_io.c:2595
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x441129
RSP: 002b:00007fff4b945318 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441129
RDX: 0000000020000080 RSI: 0000000000005423 RDI: 0000000000000003
RBP: 00007fff4b945330 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7017:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x51/0x80 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x4e/0xe0 mm/util.c:397
 kvmalloc include/linux/mm.h:531 [inline]
 kvzalloc include/linux/mm.h:539 [inline]
 alloc_netdev_mqs+0x7b/0xbc0 net/core/dev.c:8086
 sl_alloc drivers/net/slip/slip.c:751 [inline]
 slip_open+0x2f1/0xff1 drivers/net/slip/slip.c:816
 tty_ldisc_open.isra.0+0x73/0xb0 drivers/tty/tty_ldisc.c:474
 tty_set_ldisc+0x29a/0x610 drivers/tty/tty_ldisc.c:599
 tiocsetd drivers/tty/tty_io.c:2351 [inline]
 tty_ioctl+0x95b/0x1320 drivers/tty/tty_io.c:2595
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7017:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 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+0xcc/0x270 mm/slab.c:3815
 kvfree+0x4d/0x60 mm/util.c:416
 netdev_freemem net/core/dev.c:8038 [inline]
 free_netdev+0x2d0/0x360 net/core/dev.c:8200
 slip_open+0xbab/0xff1 drivers/net/slip/slip.c:862
 tty_ldisc_open.isra.0+0x73/0xb0 drivers/tty/tty_ldisc.c:474
 tty_set_ldisc+0x29a/0x610 drivers/tty/tty_ldisc.c:599
 tiocsetd drivers/tty/tty_io.c:2351 [inline]
 tty_ioctl+0x95b/0x1320 drivers/tty/tty_io.c:2595
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88808b6be280
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 2760 bytes inside of
 4096-byte region [ffff88808b6be280, ffff88808b6bf280)
The buggy address belongs to the page:
page:ffffea00022daf80 count:1 mapcount:0 mapping:ffff88808b6be280 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff88808b6be280 0000000000000000 0000000100000001
raw: ffffea0002960d20 ffff8880aa801a48 ffff8880aa800dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808b6bec00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808b6bec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808b6bed00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff88808b6bed80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808b6bee00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2019/11/25 21:49 linux-4.14.y 43598c571e7e 598ca6c8 .config log report syz C
ci2-linux-4-14 2019/11/25 21:32 linux-4.14.y 43598c571e7e 598ca6c8 .config log report