syzbot


KASAN: invalid-free in x25_asy_free

Status: fixed on 2019/01/15 20:25
Reported-by: syzbot+5e5e969e525129229052@syzkaller.appspotmail.com
Fix commit: d5c7c745f254 net/wan: fix a double free in x25_asy_open_tty()
First crash: 1284d, last: 1273d

Sample crash report:
RDX: 0000000020000080 RSI: 0000000000005423 RDI: 0000000000000004
RBP: 00007ffe025ca540 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000005 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: double-free or invalid-free in x25_asy_free+0x37/0x140 drivers/net/wan/x25_asy.c:111

CPU: 0 PID: 7895 Comm: syz-executor609 Not tainted 4.20.0 #387
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+0x1d3/0x2c6 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_invalid_free+0x64/0xa0 mm/kasan/report.c:336
 __kasan_slab_free+0x13a/0x150 mm/kasan/kasan.c:501
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 x25_asy_free+0x37/0x140 drivers/net/wan/x25_asy.c:111
 x25_asy_open_tty+0x6ad/0x7e7 drivers/net/wan/x25_asy.c:572
 tty_ldisc_open.isra.1+0x8b/0xe0 drivers/tty/tty_ldisc.c:453
 tty_set_ldisc+0x2dc/0x6a0 drivers/tty/tty_ldisc.c:578
 tiocsetd drivers/tty/tty_io.c:2321 [inline]
 tty_ioctl+0x39d/0x17d0 drivers/tty/tty_io.c:2581
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441019
Code: e8 0c ad 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe025ca528 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441019
RDX: 0000000020000080 RSI: 0000000000005423 RDI: 0000000000000004
RBP: 00007ffe025ca540 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000005 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7895:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3722 [inline]
 __kmalloc+0x15b/0x770 mm/slab.c:3731
 kmalloc include/linux/slab.h:551 [inline]
 x25_asy_open drivers/net/wan/x25_asy.c:465 [inline]
 x25_asy_open_tty+0x32a/0x7e7 drivers/net/wan/x25_asy.c:570
 tty_ldisc_open.isra.1+0x8b/0xe0 drivers/tty/tty_ldisc.c:453
 tty_set_ldisc+0x2dc/0x6a0 drivers/tty/tty_ldisc.c:578
 tiocsetd drivers/tty/tty_io.c:2321 [inline]
 tty_ioctl+0x39d/0x17d0 drivers/tty/tty_io.c:2581
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7895:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 x25_asy_open drivers/net/wan/x25_asy.c:489 [inline]
 x25_asy_open_tty+0x6a0/0x7e7 drivers/net/wan/x25_asy.c:570
 tty_ldisc_open.isra.1+0x8b/0xe0 drivers/tty/tty_ldisc.c:453
 tty_set_ldisc+0x2dc/0x6a0 drivers/tty/tty_ldisc.c:578
 tiocsetd drivers/tty/tty_io.c:2321 [inline]
 tty_ioctl+0x39d/0x17d0 drivers/tty/tty_io.c:2581
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8881b68c4480
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff8881b68c4480, ffff8881b68c4880)
The buggy address belongs to the page:
page:ffffea0006da3100 count:1 mapcount:0 mapping:ffff8881da800ac0 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000010200(slab|head)
raw: 02fffc0000010200 ffffea0007632608 ffff8881da801848 ffff8881da800ac0
raw: 0000000000000000 ffff8881b68c4000 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881b68c4380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881b68c4400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881b68c4480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8881b68c4500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881b68c4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (67):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2018/12/25 00:47 upstream 8fe28cb58bcb 8a41a0ad .config log report syz C
ci-upstream-kasan-gce 2018/12/25 00:20 upstream 8fe28cb58bcb 8a41a0ad .config log report syz C
ci-upstream-kasan-gce-386 2018/12/25 01:29 upstream 8fe28cb58bcb 8a41a0ad .config log report syz C
ci-upstream-kasan-gce 2019/01/04 09:03 upstream 645ff1e8e704 7da23925 .config log report
ci-upstream-kasan-gce 2019/01/04 05:18 upstream 645ff1e8e704 7da23925 .config log report
ci-upstream-kasan-gce-smack-root 2019/01/03 16:09 upstream 645ff1e8e704 66fcd29b .config log report
ci-upstream-kasan-gce 2019/01/03 16:02 upstream 645ff1e8e704 66fcd29b .config log report
ci-upstream-kasan-gce-root 2019/01/03 14:46 upstream 645ff1e8e704 66fcd29b .config log report
ci-upstream-kasan-gce-root 2019/01/02 19:40 upstream 8e143b90e4d4 f0491811 .config log report
ci-upstream-kasan-gce 2019/01/02 17:42 upstream 8e143b90e4d4 f0491811 .config log report
ci-upstream-kasan-gce 2019/01/02 14:37 upstream 8e143b90e4d4 f0491811 .config log report
ci-upstream-kasan-gce-root 2019/01/02 07:51 upstream 28e8c4bc8eb4 3d85f48c .config log report
ci-upstream-kasan-gce 2019/01/01 21:22 upstream e1ef035d272e 3d85f48c .config log report
ci-upstream-kasan-gce-root 2019/01/01 15:24 upstream e1ef035d272e 3d85f48c .config log report
ci-upstream-kasan-gce-root 2019/01/01 13:29 upstream e1ef035d272e 3d85f48c .config log report
ci-upstream-kasan-gce-root 2019/01/01 09:16 upstream f12e840c819b 3d85f48c .config log report
ci-upstream-kasan-gce-selinux-root 2019/01/01 08:14 upstream f12e840c819b 3d85f48c .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/31 18:09 upstream 195303136f19 2b42fdc8 .config log report
ci-upstream-kasan-gce 2018/12/31 17:10 upstream 195303136f19 2b42fdc8 .config log report
ci-upstream-kasan-gce 2018/12/31 14:12 upstream 195303136f19 2b42fdc8 .config log report
ci-upstream-kasan-gce-root 2018/12/31 13:45 upstream 195303136f19 2b42fdc8 .config log report
ci-upstream-kasan-gce-root 2018/12/31 06:10 upstream 195303136f19 2b42fdc8 .config log report
ci-upstream-kasan-gce-root 2018/12/30 15:30 upstream 195303136f19 9942de5f .config log report
ci-upstream-kasan-gce 2018/12/30 15:21 upstream 195303136f19 9942de5f .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/30 10:14 upstream 195303136f19 35e3f847 .config log report
ci-upstream-kasan-gce 2018/12/30 09:07 upstream 195303136f19 35e3f847 .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/30 05:14 upstream 195303136f19 35e3f847 .config log report
ci-upstream-kasan-gce 2018/12/30 05:00 upstream 195303136f19 35e3f847 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/29 20:18 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/29 17:58 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce-root 2018/12/29 17:47 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce 2018/12/29 13:31 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/29 13:29 upstream 903b77c63167 a40793d7 .config log report
ci-upstream-kasan-gce 2018/12/29 07:55 upstream f346b0becb1b e33ad0f1 .config log report
ci-upstream-kasan-gce-root 2018/12/29 05:36 upstream f346b0becb1b e33ad0f1 .config log report
ci-upstream-kasan-gce-smack-root 2018/12/28 17:06 upstream 00c569b567c7 fc6ae81a .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/28 04:47 upstream b71acb0e3721 af317504 .config log report
ci-upstream-kasan-gce 2018/12/27 16:37 upstream fc2fd5f0f1aa 43cf01dd .config log report
ci-upstream-kasan-gce 2018/12/27 15:54 upstream fc2fd5f0f1aa 43cf01dd .config log report
ci-upstream-kasan-gce-root 2018/12/26 16:32 upstream 5694cecdb092 8a41a0ad .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/26 11:34 upstream d8924c0d76aa 8a41a0ad .config log report
ci-upstream-kasan-gce-smack-root 2018/12/26 08:52 upstream d8924c0d76aa 8a41a0ad .config log report
ci-upstream-kasan-gce-selinux-root 2018/12/26 04:30 upstream d8924c0d76aa 8a41a0ad .config log report
ci-upstream-kasan-gce 2018/12/26 04:27 upstream d8924c0d76aa 8a41a0ad .config log report
ci-upstream-kasan-gce 2018/12/25 08:58 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-smack-root 2018/12/25 06:52 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-root 2018/12/24 23:32 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce 2018/12/24 23:30 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce 2018/12/24 23:10 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-386 2019/01/02 09:26 upstream 8e143b90e4d4 3d85f48c .config log report
ci-upstream-kasan-gce-386 2019/01/01 03:22 upstream f12e840c819b 3d85f48c .config log report
ci-upstream-kasan-gce-386 2019/01/01 01:58 upstream f12e840c819b 3d85f48c .config log report
ci-upstream-kasan-gce-386 2018/12/25 15:51 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-kasan-gce-386 2018/12/24 23:31 upstream 8fe28cb58bcb 8a41a0ad .config log report
ci-upstream-linux-next-kasan-gce-root 2018/12/29 06:35 linux-next 6a1d293238c1 e33ad0f1 .config log report
ci-upstream-linux-next-kasan-gce-root 2018/12/28 07:38 linux-next 6a1d293238c1 af317504 .config log report
ci-upstream-linux-next-kasan-gce-root 2018/12/28 04:36 linux-next 6a1d293238c1 af317504 .config log report