KASAN: user-memory-access Write in n_tty_set_termios
From: syzbot
Date: Sun Apr 01 2018 - 13:01:16 EST
Hello,
syzbot hit the following crash on upstream commit
10b84daddbec72c6b440216a69de9a9605127f7a (Sat Mar 31 17:59:00 2018 +0000)
Merge branch 'perf-urgent-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=3aa9784721dfb90e984d
So far this crash happened 2 times on upstream.
C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5259401455730688
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5604984590696448
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=6343571460325376
Kernel config:
https://syzkaller.appspot.com/x/.config?id=-2760467897697295172
compiler: gcc (GCC) 7.1.1 20170620
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+3aa9784721dfb90e984d@xxxxxxxxxxxxxxxxxxxxxxxxx
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.
==================================================================
BUG: KASAN: user-memory-access in memset include/linux/string.h:330 [inline]
BUG: KASAN: user-memory-access in bitmap_zero include/linux/bitmap.h:208
[inline]
BUG: KASAN: user-memory-access in n_tty_set_termios+0xfc/0xcf0
drivers/tty/n_tty.c:1766
Write of size 512 at addr 0000000000001060 by task syzkaller311122/4421
CPU: 0 PID: 4421 Comm: syzkaller311122 Not tainted 4.16.0-rc7+ #9
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+0x194/0x24d lib/dump_stack.c:53
kasan_report_error mm/kasan/report.c:352 [inline]
kasan_report+0x140/0x360 mm/kasan/report.c:412
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
memset+0x23/0x40 mm/kasan/kasan.c:285
memset include/linux/string.h:330 [inline]
bitmap_zero include/linux/bitmap.h:208 [inline]
n_tty_set_termios+0xfc/0xcf0 drivers/tty/n_tty.c:1766
tty_set_termios+0x750/0xa60 drivers/tty/tty_ioctl.c:341
set_termios+0x392/0x6d0 drivers/tty/tty_ioctl.c:414
tty_mode_ioctl+0x9fc/0xb30 drivers/tty/tty_ioctl.c:749
n_tty_ioctl_helper+0x40/0x360 drivers/tty/tty_ioctl.c:940
n_tty_ioctl+0x14d/0x2d0 drivers/tty/n_tty.c:2441
tty_ioctl+0x336/0x1610 drivers/tty/tty_io.c:2655
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x445bf9
RSP: 002b:00007fdf68f52d18 EFLAGS: 00000297 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006dac24 RCX: 0000000000445bf9
RDX: 0000000020000040 RSI: 0000000000005402 RDI: 0000000000000021
RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 6d74702f7665642f
R13: 00007ffdda32610f R14: 00007fdf68f539c0 R15: 0000000000000007
==================================================================
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 4421 Comm: syzkaller311122 Tainted: G B
4.16.0-rc7+ #9
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+0x194/0x24d lib/dump_stack.c:53
panic+0x1e4/0x41c kernel/panic.c:183
kasan_end_report+0x50/0x50 mm/kasan/report.c:180
kasan_report_error mm/kasan/report.c:359 [inline]
kasan_report+0x149/0x360 mm/kasan/report.c:412
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
memset+0x23/0x40 mm/kasan/kasan.c:285
memset include/linux/string.h:330 [inline]
bitmap_zero include/linux/bitmap.h:208 [inline]
n_tty_set_termios+0xfc/0xcf0 drivers/tty/n_tty.c:1766
tty_set_termios+0x750/0xa60 drivers/tty/tty_ioctl.c:341
set_termios+0x392/0x6d0 drivers/tty/tty_ioctl.c:414
tty_mode_ioctl+0x9fc/0xb30 drivers/tty/tty_ioctl.c:749
n_tty_ioctl_helper+0x40/0x360 drivers/tty/tty_ioctl.c:940
n_tty_ioctl+0x14d/0x2d0 drivers/tty/n_tty.c:2441
tty_ioctl+0x336/0x1610 drivers/tty/tty_io.c:2655
vfs_ioctl fs/ioctl.c:46 [inline]
do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x445bf9
RSP: 002b:00007fdf68f52d18 EFLAGS: 00000297 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006dac24 RCX: 0000000000445bf9
RDX: 0000000020000040 RSI: 0000000000005402 RDI: 0000000000000021
RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 6d74702f7665642f
R13: 00007ffdda32610f R14: 00007fdf68f539c0 R15: 0000000000000007
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..
---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzkaller@xxxxxxxxxxxxxxxxx
syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.