Re: UBSAN: shift-out-of-bounds in hid_report_raw_event

From: Randy Dunlap
Date: Tue Feb 16 2021 - 17:41:42 EST


On 2/15/21 3:18 PM, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 291009f6 Merge tag 'pm-5.11-rc8' of git://git.kernel.org/p..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17cd1098d00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6a218c95bd23063a
> dashboard link: https://syzkaller.appspot.com/bug?extid=ee5ce0deec4ff5aa64e1
> compiler: Debian clang version 11.0.1-2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10410288d00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13642124d00000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+ee5ce0deec4ff5aa64e1@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ================================================================================
> UBSAN: shift-out-of-bounds in drivers/hid/hid-core.c:1315:20
> shift exponent 4294967295 is too large for 32-bit type 'int'
> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.11.0-rc7-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
> <IRQ>
> __dump_stack lib/dump_stack.c:79 [inline]
> dump_stack+0x137/0x1be lib/dump_stack.c:120
> ubsan_epilogue lib/ubsan.c:148 [inline]
> __ubsan_handle_shift_out_of_bounds+0x432/0x4d0 lib/ubsan.c:395
> snto32 drivers/hid/hid-core.c:1315 [inline]
> hid_input_field drivers/hid/hid-core.c:1548 [inline]
> hid_report_raw_event+0xa9d/0x1480 drivers/hid/hid-core.c:1783
> hid_input_report+0x3f6/0x4d0 drivers/hid/hid-core.c:1850
> hid_irq_in+0x48d/0x690 drivers/hid/usbhid/hid-core.c:284
> __usb_hcd_giveback_urb+0x375/0x520 drivers/usb/core/hcd.c:1656
> dummy_timer+0xa22/0x2e70 drivers/usb/gadget/udc/dummy_hcd.c:1971

>
>
> ---
> This report 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 syzkaller@xxxxxxxxxxxxxxxx.
>
> syzbot will keep track of this issue. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this issue, for details see:
> https://goo.gl/tpsmEJ#testing-patches

#syz dup: UBSAN: shift-out-of-bounds in snto32


--
~Randy