syzbot


KASAN: global-out-of-bounds Write in kbd_event

Status: fixed on 2019/12/13 00:31
Subsystems: serial input usb
[Documentation on labels]
Reported-by: syzbot+19340dff067c2d3835c0@syzkaller.appspotmail.com
Fix commit: b2b2dd71e085 tty: vt: keyboard: reject invalid keycodes
First crash: 1625d, last: 1603d
Duplicate bugs (3)
duplicates (3):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: use-after-free Read in hidinput_hid_event input C 2 1569d 1583d 0/26 closed as dup on 2020/06/18 12:11
KASAN: slab-out-of-bounds Write in hidinput_setkeycode input usb C 3 1593d 1593d 0/26 closed as dup on 2020/06/18 12:10
KASAN: slab-out-of-bounds Read in hidinput_hid_event input usb C 2 1581d 1583d 0/26 closed as dup on 2020/06/18 12:10
Discussions (18)
Title Replies (including bot) Last reply
[PATCH 3.16 000/245] 3.16.83-rc1 review 260 (260) 2020/04/24 17:54
[PATCH 5.4 00/78] 5.4.12-stable review 107 (107) 2020/02/11 15:01
[PATCH 3.16 000/148] 3.16.82-rc1 review 151 (151) 2020/02/09 18:51
[PATCH 4.19 00/46] 4.19.96-stable review 51 (51) 2020/01/15 02:09
[PATCH 4.14 00/39] 4.14.165-stable review 44 (44) 2020/01/15 02:08
[PATCH 4.9 00/31] 4.9.210-stable review 36 (36) 2020/01/15 02:08
[PATCH 4.4 00/28] 4.4.210-stable review 33 (33) 2020/01/15 02:08
[PATCH 4.9 000/199] 4.9.207-stable review 204 (204) 2019/12/20 18:47
[PATCH 4.4 000/162] 4.4.207-stable review 167 (167) 2019/12/20 18:47
[PATCH 4.14 000/267] 4.14.159-stable review 280 (280) 2019/12/17 18:18
[PATCH v2] HID: hid-input: clear unmapped usages 4 (4) 2019/12/13 20:42
[PATCH 4.19 000/243] 4.19.89-stable review 277 (277) 2019/12/13 19:35
[PATCH 5.4 00/92] 5.4.3-stable review 106 (106) 2019/12/13 16:08
[PATCH 5.3 000/105] 5.3.16-stable review 125 (125) 2019/12/13 04:53
[PATCH] HID: hid-input: clear unmapped usages 2 (2) 2019/11/25 09:33
[PATCH] tty: vt: keyboard: reject invalid keycodes 1 (1) 2019/11/22 20:42
Reminder: 45 active syzbot reports in usb subsystem 1 (1) 2019/11/19 04:27
KASAN: global-out-of-bounds Write in kbd_event 0 (1) 2019/11/06 17:13

Sample crash report:
==================================================================
BUG: KASAN: global-out-of-bounds in clear_bit include/asm-generic/bitops-instrumented.h:56 [inline]
BUG: KASAN: global-out-of-bounds in kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
BUG: KASAN: global-out-of-bounds in kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
Write of size 8 at addr ffffffff89a1b2d8 by task syz-executor108/1722

CPU: 1 PID: 1722 Comm: syz-executor108 Not tainted 5.4.0-rc6+ #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+0xca/0x13e lib/dump_stack.c:113
 print_address_description.constprop.0.cold+0x5/0x2fc mm/kasan/report.c:374
 __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:506
 kasan_report+0xe/0x20 mm/kasan/common.c:634
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x128/0x190 mm/kasan/generic.c:192
 clear_bit include/asm-generic/bitops-instrumented.h:56 [inline]
 kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
 kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
 input_to_handler+0x3b6/0x4c0 drivers/input/input.c:118
 input_pass_values.part.0+0x2e3/0x720 drivers/input/input.c:145
 input_pass_values drivers/input/input.c:949 [inline]
 input_set_keycode+0x290/0x320 drivers/input/input.c:954
 evdev_handle_set_keycode_v2+0xc4/0x120 drivers/input/evdev.c:882
 evdev_do_ioctl drivers/input/evdev.c:1150 [inline]
 evdev_ioctl_handler+0xd49/0x19f0 drivers/input/evdev.c:1284
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:696
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:718
 do_syscall_64+0xb7/0x580 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x444dc9
Code: e8 bc af 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 1b d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffaf4eda08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000444dc9
RDX: 0000000020000080 RSI: 0000000040284504 RDI: 0000000000000004
RBP: 00000000006cf018 R08: 090b000000008300 R09: 00000000004002e0
R10: 000000000000000f R11: 0000000000000246 R12: 0000000000402a70
R13: 0000000000402b00 R14: 0000000000000000 R15: 0000000000000000

The buggy address belongs to the variable:
 key_down+0x78/0x80

Memory state around the buggy address:
 ffffffff89a1b180: fa fa fa fa 04 fa fa fa fa fa fa fa 01 fa fa fa
 ffffffff89a1b200: fa fa fa fa 00 01 fa fa fa fa fa fa 00 00 00 00
>ffffffff89a1b280: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
                                                    ^
 ffffffff89a1b300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffffff89a1b380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/06 16:13 https://github.com/google/kasan.git usb-fuzzer b1aa9d834830 da505f84 .config console log report syz C ci2-upstream-usb
2019/11/29 01:55 https://github.com/google/kasan.git usb-fuzzer da06441bb485 76357d6f .config console log report ci2-upstream-usb
2019/11/26 10:11 https://github.com/google/kasan.git usb-fuzzer da06441bb485 598ca6c8 .config console log report ci2-upstream-usb
2019/11/15 18:04 https://github.com/google/kasan.git usb-fuzzer 3183c03757f8 79248ee8 .config console log report ci2-upstream-usb
2019/11/15 00:46 https://github.com/google/kasan.git usb-fuzzer 3183c03757f8 048f2d49 .config console log report ci2-upstream-usb
2019/11/06 15:44 https://github.com/google/kasan.git usb-fuzzer b1aa9d834830 da505f84 .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.