KASAN: use-after-free Read in release_tty

12 views
Skip to first unread message

syzbot

unread,
Mar 3, 2020, 8:53:13 PM3/3/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a083db76 Linux 4.19.107
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1167eac3e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c32f76aaadd644de
dashboard link: https://syzkaller.appspot.com/bug?extid=039d42b9933aec042da7
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+039d42...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic64_read include/asm-generic/atomic-instrumented.h:27 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:47 [inline]
BUG: KASAN: use-after-free in work_is_canceling kernel/workqueue.c:753 [inline]
BUG: KASAN: use-after-free in __cancel_work_timer+0x3ec/0x4f0 kernel/workqueue.c:2998
Read of size 8 at addr ffff8880a3654148 by task syz-executor.4/6925

CPU: 0 PID: 6925 Comm: syz-executor.4 Not tainted 4.19.107-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+0x188/0x20d lib/dump_stack.c:118
print_address_description.cold+0x7c/0x212 mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x88/0x2b9 mm/kasan/report.c:396
atomic64_read include/asm-generic/atomic-instrumented.h:27 [inline]
atomic_long_read include/asm-generic/atomic-long.h:47 [inline]
work_is_canceling kernel/workqueue.c:753 [inline]
__cancel_work_timer+0x3ec/0x4f0 kernel/workqueue.c:2998
release_tty+0x266/0x4c0 drivers/tty/tty_io.c:1515
tty_release_struct+0x37/0x50 drivers/tty/tty_io.c:1624
tty_release+0xbc7/0xe90 drivers/tty/tty_io.c:1784
__fput+0x2cd/0x890 fs/file_table.c:278
task_work_run+0x13f/0x1b0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x416011
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007fff30437ff0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000416011
RDX: 0000001b30420000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: ffffffff81009476 R09: 00000000d0bb5368
R10: 00007fff304380d0 R11: 0000000000000293 R12: 000000000076bf20
R13: 0000000000770c20 R14: 00000000000a4180 R15: 000000000076bf2c

Allocated by task 18343:
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
vc_allocate drivers/tty/vt/vt.c:1099 [inline]
vc_allocate+0x1db/0x6d0 drivers/tty/vt/vt.c:1080
con_install+0x4f/0x400 drivers/tty/vt/vt.c:3215
tty_driver_install_tty drivers/tty/tty_io.c:1226 [inline]
tty_init_dev drivers/tty/tty_io.c:1339 [inline]
tty_init_dev+0xee/0x450 drivers/tty/tty_io.c:1316
tty_open_by_driver drivers/tty/tty_io.c:1981 [inline]
tty_open+0x4b0/0xb00 drivers/tty/tty_io.c:2029
chrdev_open+0x219/0x5c0 fs/char_dev.c:423
do_dentry_open+0x4a8/0x1160 fs/open.c:796
do_last fs/namei.c:3421 [inline]
path_openat+0x1031/0x4200 fs/namei.c:3537
do_filp_open+0x1a1/0x280 fs/namei.c:3567
do_sys_open+0x3c0/0x500 fs/open.c:1088
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6929:
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
__cache_free mm/slab.c:3503 [inline]
kfree+0xce/0x220 mm/slab.c:3822
vt_disallocate_all+0x293/0x3b0 drivers/tty/vt/vt_ioctl.c:323
vt_ioctl+0xb79/0x2310 drivers/tty/vt/vt_ioctl.c:816
tty_ioctl+0x7a1/0x1420 drivers/tty/tty_io.c:2669
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcda/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a3654140
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 8 bytes inside of
2048-byte region [ffff8880a3654140, ffff8880a3654940)
The buggy address belongs to the page:
page:ffffea00028d9500 count:1 mapcount:0 mapping:ffff88812c3dcc40 index:0xffff8880a36549c0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea00013bb908 ffffea0001319a08 ffff88812c3dcc40
raw: ffff8880a36549c0 ffff8880a3654140 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a3654000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a3654080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a3654100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8880a3654180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a3654200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 9, 2020, 5:36:13 PM3/9/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 78d697fc Linux 4.14.172
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=118db981e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=3484a1ea90b8523a
dashboard link: https://syzkaller.appspot.com/bug?extid=364514747b351532772d
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+364514...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:45 [inline]
BUG: KASAN: use-after-free in work_is_canceling kernel/workqueue.c:755 [inline]
BUG: KASAN: use-after-free in __cancel_work_timer+0x454/0x460 kernel/workqueue.c:2947
Read of size 8 at addr ffff888053b10588 by task syz-executor.2/24303

CPU: 0 PID: 24303 Comm: syz-executor.2 Not tainted 4.14.172-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
__read_once_size include/linux/compiler.h:183 [inline]
atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline]
atomic_long_read include/asm-generic/atomic-long.h:45 [inline]
work_is_canceling kernel/workqueue.c:755 [inline]
__cancel_work_timer+0x454/0x460 kernel/workqueue.c:2947
release_tty+0x3e1/0x7a0 drivers/tty/tty_io.c:1507
tty_release_struct+0x37/0x50 drivers/tty/tty_io.c:1616
tty_release+0xaa6/0xd60 drivers/tty/tty_io.c:1776
__fput+0x25f/0x790 fs/file_table.c:210
task_work_run+0x113/0x190 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:191 [inline]
exit_to_usermode_loop+0x1d6/0x220 arch/x86/entry/common.c:164
prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x416041
RSP: 002b:00007ffeab4600b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000416041
RDX: 0000001b2c820000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: 00000000f6c41bb6 R09: 00000000f6c41bba
R10: 00007ffeab460190 R11: 0000000000000293 R12: 000000000076bfc0
R13: 00000000007701d0 R14: 0000000000073b1e R15: 000000000076bfcc

Allocated by task 24306:
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]
vc_allocate drivers/tty/vt/vt.c:772 [inline]
vc_allocate+0x142/0x550 drivers/tty/vt/vt.c:753
con_install+0x4f/0x3e0 drivers/tty/vt/vt.c:2881
tty_driver_install_tty drivers/tty/tty_io.c:1225 [inline]
tty_init_dev drivers/tty/tty_io.c:1338 [inline]
tty_init_dev+0xe1/0x3a0 drivers/tty/tty_io.c:1315
tty_open_by_driver drivers/tty/tty_io.c:1973 [inline]
tty_open+0x410/0x9c0 drivers/tty/tty_io.c:2021
chrdev_open+0x1fc/0x540 fs/char_dev.c:423
do_dentry_open+0x732/0xe90 fs/open.c:777
vfs_open+0x105/0x220 fs/open.c:891
do_last fs/namei.c:3428 [inline]
path_openat+0x8ca/0x3c50 fs/namei.c:3569
do_filp_open+0x18e/0x250 fs/namei.c:3603
do_sys_open+0x29d/0x3f0 fs/open.c:1084
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 24305:
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
vt_disallocate_all+0x25c/0x340 drivers/tty/vt/vt_ioctl.c:323
vt_ioctl+0x6e3/0x1f00 drivers/tty/vt/vt_ioctl.c:816
tty_ioctl+0x6c5/0x1220 drivers/tty/tty_io.c:2661
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 ffff888053b10580
which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 8 bytes inside of
2048-byte region [ffff888053b10580, ffff888053b10d80)
The buggy address belongs to the page:
page:ffffea00014ec400 count:1 mapcount:0 mapping:ffff888053b10580 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888053b10580 0000000000000000 0000000100000003
raw: ffffea000145a720 ffffea0002831620 ffff88812fe56c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888053b10480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888053b10500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888053b10580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888053b10600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888053b10680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

syzbot

unread,
Jul 1, 2020, 9:53:12 PM7/1/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Jul 7, 2020, 5:36:16 PM7/7/20
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages