general protection fault in digitv_i2c_xfer
From: Rondreis
Date: Thu Sep 22 2022 - 07:27:16 EST
Hello,
When fuzzing the Linux kernel driver v6.0-rc6, the following crash was
triggered.
HEAD commit: 521a547ced6477c54b4b0cc206000406c221b4d6
git tree: upstream
kernel config: https://pastebin.com/raw/hekxU61F
console output: https://pastebin.com/raw/eQmbXagT
Sorry for failing to extract the reproducer. But on other versions of
Linux, I also triggered this crash.
I would 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
0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 3 PID: 14711 Comm: syz-executor.2 Not tainted 6.0.0-rc6+ #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:digitv_i2c_xfer+0xf2/0x3b0 drivers/media/usb/dvb-usb/digitv.c:67
Code: 5c 24 08 48 8d 7b 08 48 89 f8 48 c1 e8 03 42 80 3c 30 00 0f 85
6f 02 00 00 48 8b 6b 08 48 89 e8 48 89 ea 48 c1 e8 03 83 e2 07 <42> 0f
b6 04 30 38 d0 7f 08 84 c0 0f 85 40 02 00 00 0f b6 45 00 44
RSP: 0018:ffffc90006db7cd0 EFLAGS: 00010246
RAX: 0000000000000002 RBX: ffff8880005140e0 RCX: 0000000000040000
RDX: 0000000000000000 RSI: ffff8880180bba80 RDI: ffff8880005140e8
RBP: 0000000000000010 R08: ffffffff861bedfa R09: 0000000000000000
R10: 0000000000000005 R11: fffffbfff1d34d22 R12: 0000000000000000
R13: 0000000000000001 R14: dffffc0000000000 R15: 0000000000000001
FS: 00007fa593c8e700(0000) GS:ffff88807ed00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa593471b30 CR3: 0000000024995000 CR4: 0000000000350ee0
Call Trace:
<TASK>
__i2c_transfer drivers/i2c/i2c-core-base.c:2109 [inline]
__i2c_transfer+0x4c2/0x16a0 drivers/i2c/i2c-core-base.c:2074
i2c_transfer+0x1e6/0x3e0 drivers/i2c/i2c-core-base.c:2170
i2cdev_ioctl_rdwr.isra.0+0x2ea/0x6a0 drivers/i2c/i2c-dev.c:297
i2cdev_ioctl+0x488/0x7b0 drivers/i2c/i2c-dev.c:458
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
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:0x7fa5934a80fd
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:00007fa593c8dbf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fa59359c340 RCX: 00007fa5934a80fd
RDX: 0000000020000640 RSI: 0000000000000707 RDI: 0000000000000003
RBP: 00007fa59350b606 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffea1fefa1f R14: 00007ffea1fefbc0 R15: 00007fa593c8dd80
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:digitv_i2c_xfer+0xf2/0x3b0 drivers/media/usb/dvb-usb/digitv.c:67
Code: 5c 24 08 48 8d 7b 08 48 89 f8 48 c1 e8 03 42 80 3c 30 00 0f 85
6f 02 00 00 48 8b 6b 08 48 89 e8 48 89 ea 48 c1 e8 03 83 e2 07 <42> 0f
b6 04 30 38 d0 7f 08 84 c0 0f 85 40 02 00 00 0f b6 45 00 44
RSP: 0018:ffffc90006db7cd0 EFLAGS: 00010246
RAX: 0000000000000002 RBX: ffff8880005140e0 RCX: 0000000000040000
RDX: 0000000000000000 RSI: ffff8880180bba80 RDI: ffff8880005140e8
RBP: 0000000000000010 R08: ffffffff861bedfa R09: 0000000000000000
R10: 0000000000000005 R11: fffffbfff1d34d22 R12: 0000000000000000
R13: 0000000000000001 R14: dffffc0000000000 R15: 0000000000000001
FS: 00007fa593c8e700(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa59359d060 CR3: 0000000024995000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess):
0: 5c pop %rsp
1: 24 08 and $0x8,%al
3: 48 8d 7b 08 lea 0x8(%rbx),%rdi
7: 48 89 f8 mov %rdi,%rax
a: 48 c1 e8 03 shr $0x3,%rax
e: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1)
13: 0f 85 6f 02 00 00 jne 0x288
19: 48 8b 6b 08 mov 0x8(%rbx),%rbp
1d: 48 89 e8 mov %rbp,%rax
20: 48 89 ea mov %rbp,%rdx
23: 48 c1 e8 03 shr $0x3,%rax
27: 83 e2 07 and $0x7,%edx
* 2a: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax <-- trapping instruction
2f: 38 d0 cmp %dl,%al
31: 7f 08 jg 0x3b
33: 84 c0 test %al,%al
35: 0f 85 40 02 00 00 jne 0x27b
3b: 0f b6 45 00 movzbl 0x0(%rbp),%eax
3f: 44 rex.R