2022-09-16 13:36:42

by Rondreis

[permalink] [raw]
Subject: general protection fault in gs_start_io

Hello,

When fuzzing the Linux kernel driver v6.0-rc4, the following crash was
triggered.

HEAD commit: 7e18e42e4b280c85b76967a9106a13ca61c16179
git tree: upstream

kernel config: https://pastebin.com/raw/xtrgsXP3
console output: https://pastebin.com/raw/Mm6mVaYt

Basically, in the c reproducer, we use the gadget module to emulate
attaching a USB device and executing some simple sequence of system
calls.

Sorry I do not have c reproducer for this bug, but I would so
appreciate it if you have any idea how to solve this bug.

The crash report is as follows:

general protection fault, probably for non-canonical address
0xdffffc000000001c: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000000e0-0x00000000000000e7]
CPU: 0 PID: 17757 Comm: syz-executor.4 Not tainted 6.0.0-rc4+ #20
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:gs_start_io+0x24d/0x2c0 drivers/usb/gadget/function/u_serial.c:571
Code: 03 80 3c 02 00 0f 85 85 00 00 00 48 8b 9b d8 03 00 00 48 b8 00
00 00 00 00 fc ff df 48 8d bb e0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c
02 00 75 59 48 8b bb e0 00 00 00 41 bc fb ff ff ff 48 8b 54
RSP: 0018:ffffc90018f07838 EFLAGS: 00010012
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88801a2f3a80
RDX: 000000000000001c RSI: ffff88801a2f3a80 RDI: 00000000000000e0
RBP: ffff88801387e3d8 R08: ffffffff85d97033 R09: fffffbfff1d34743
R10: ffffffff8e9a3a17 R11: fffffbfff1d34742 R12: 0000000000000000
R13: ffff888047e78158 R14: ffff88801387e3f0 R15: ffff88801387e404
FS: 00007f2212ea8700(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c004475000 CR3: 000000006746a000 CR4: 0000000000350ef0
Call Trace:
<TASK>
gs_open+0x253/0x540 drivers/usb/gadget/function/u_serial.c:638
tty_open+0x2e5/0xc30 drivers/tty/tty_io.c:2150
chrdev_open+0x219/0x5c0 fs/char_dev.c:414
do_dentry_open+0x4a4/0x13a0 fs/open.c:878
do_open fs/namei.c:3557 [inline]
path_openat+0x1c1f/0x2840 fs/namei.c:3691
do_filp_open+0x1ca/0x2a0 fs/namei.c:3718
trace_clock_x86_tsc+0x10/0x10
do_sys_open+0xc3/0x140 fs/open.c:1327
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f22126a80fd
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2212ea7bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f221279c340 RCX: 00007f22126a80fd
RDX: 0000000000004000 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f221270b606 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd1cb1673f R14: 00007ffd1cb168e0 R15: 00007f2212ea7d80
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:gs_start_io+0x24d/0x2c0 drivers/usb/gadget/function/u_serial.c:571
Code: 03 80 3c 02 00 0f 85 85 00 00 00 48 8b 9b d8 03 00 00 48 b8 00
00 00 00 00 fc ff df 48 8d bb e0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c
02 00 75 59 48 8b bb e0 00 00 00 41 bc fb ff ff ff 48 8b 54
RSP: 0018:ffffc90018f07838 EFLAGS: 00010012
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffff88801a2f3a80
RDX: 000000000000001c RSI: ffff88801a2f3a80 RDI: 00000000000000e0
RBP: ffff88801387e3d8 R08: ffffffff85d97033 R09: fffffbfff1d34743
R10: ffffffff8e9a3a17 R11: fffffbfff1d34742 R12: 0000000000000000
R13: ffff888047e78158 R14: ffff88801387e3f0 R15: ffff88801387e404
FS: 00007f2212ea8700(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c004475000 CR3: 000000006746a000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess):
0: 03 80 3c 02 00 0f add 0xf00023c(%rax),%eax
6: 85 85 00 00 00 48 test %eax,0x48000000(%rbp)
c: 8b 9b d8 03 00 00 mov 0x3d8(%rbx),%ebx
12: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
19: fc ff df
1c: 48 8d bb e0 00 00 00 lea 0xe0(%rbx),%rdi
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 75 59 jne 0x89
30: 48 8b bb e0 00 00 00 mov 0xe0(%rbx),%rdi
37: 41 bc fb ff ff ff mov $0xfffffffb,%r12d
3d: 48 rex.W
3e: 8b .byte 0x8b
3f: 54 push %rsp


2022-09-17 09:28:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: general protection fault in gs_start_io

On Fri, Sep 16, 2022 at 08:47:17PM +0800, Rondreis wrote:
> Hello,
>
> When fuzzing the Linux kernel driver v6.0-rc4, the following crash was
> triggered.

Great, please send a patch to fix this so that we can get it resolved.
Otherwise we will just have to put it on the very-large-pile of other
syzbot-found bugs at the moment...

thanks,

greg k-h