KASAN: slab-out-of-bounds Write in betop_probe

7 views
Skip to first unread message

syzbot

unread,
Apr 25, 2020, 2:12:17 AM4/25/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: e70de07a ANDROID: Remove VLA from uid_sys_stats.c
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=127a14b0100000
kernel config: https://syzkaller.appspot.com/x/.config?x=5ca90a2020718dd5
dashboard link: https://syzkaller.appspot.com/bug?extid=99b487e857c23dc656a0
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12d07cefe00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14b97828100000

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

usb 1-1: config 0 interface 0 altsetting 0 has 1 endpoint descriptor, different from the interface descriptor's value: 9
usb 1-1: New USB device found, idVendor=20bc, idProduct=5500, bcdDevice= 0.00
usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
usb 1-1: config 0 descriptor??
betop 0003:20BC:5500.0001: hidraw0: USB HID v0.00 Device [HID 20bc:5500] on usb-dummy_hcd.0-1/input0
==================================================================
BUG: KASAN: slab-out-of-bounds in set_bit include/asm-generic/bitops-instrumented.h:28 [inline]
BUG: KASAN: slab-out-of-bounds in betopff_init drivers/hid/hid-betopff.c:99 [inline]
BUG: KASAN: slab-out-of-bounds in betop_probe+0x3d4/0x5c0 drivers/hid/hid-betopff.c:134
Write of size 8 at addr ffff8881cdc223c0 by task kworker/0:1/12

CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.4.35-syzkaller-00682-ge70de07acfd5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x14a/0x1ce lib/dump_stack.c:118
print_address_description+0x93/0x620 mm/kasan/report.c:374
__kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
kasan_report+0x34/0x60 mm/kasan/common.c:634
check_memory_region_inline mm/kasan/generic.c:182 [inline]
check_memory_region+0x2b5/0x2f0 mm/kasan/generic.c:192
set_bit include/asm-generic/bitops-instrumented.h:28 [inline]
betopff_init drivers/hid/hid-betopff.c:99 [inline]
betop_probe+0x3d4/0x5c0 drivers/hid/hid-betopff.c:134
hid_device_probe+0x274/0x410 drivers/hid/hid-core.c:2263
really_probe+0x6fe/0xf50 drivers/base/dd.c:551
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
hid_add_device+0xd7e/0xfd0 drivers/hid/hid-core.c:2419
usbhid_probe+0x94e/0xcc0 drivers/hid/usbhid/hid-core.c:1386
usb_probe_interface+0x621/0xac0 drivers/usb/core/driver.c:361
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_set_configuration+0x184c/0x1dc0 drivers/usb/core/message.c:2023
generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2548
hub_port_connect drivers/usb/core/hub.c:5110 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5225 [inline]
port_event drivers/usb/core/hub.c:5371 [inline]
hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5453
process_one_work+0x777/0xf90 kernel/workqueue.c:2274
worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
kthread+0x2df/0x300 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 228:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
__kmalloc+0xf7/0x2d0 mm/slub.c:3821
kmalloc include/linux/slab.h:561 [inline]
simple_xattr_alloc+0x40/0xb0 fs/xattr.c:820
shmem_initxattrs+0x91/0x200 mm/shmem.c:3204
security_inode_init_security+0x27c/0x3c0 security/security.c:996
shmem_mknod+0xb0/0x1a0 mm/shmem.c:2889
lookup_open fs/namei.c:3342 [inline]
do_last fs/namei.c:3434 [inline]
path_openat+0x20c3/0x3d10 fs/namei.c:3646
do_filp_open+0x20d/0x440 fs/namei.c:3676
do_sys_open+0x387/0x7d0 fs/open.c:1106
do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8881cdc22380
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 64 bytes inside of
96-byte region [ffff8881cdc22380, ffff8881cdc223e0)
The buggy address belongs to the page:
page:ffffea0007370880 refcount:1 mapcount:0 mapping:ffff8881da803400 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0007393840 0000001500000015 ffff8881da803400
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881cdc22280: 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc
ffff8881cdc22300: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
>ffff8881cdc22380: 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc
^
ffff8881cdc22400: 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc
ffff8881cdc22480: 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc
==================================================================
Disabling lock debugging due to kern


---
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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Aug 26, 2022, 8:12:20 PM8/26/22
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages