KASAN: use-after-free Read in mon_bin_flush

4 views
Skip to first unread message

syzbot

unread,
Sep 16, 2022, 2:37:36 AM9/16/22
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 59390358870a Merge 5.10.140 into android12-5.10-lts
git tree: android12-5.10-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=16dc1b44880000
kernel config: https://syzkaller.appspot.com/x/.config?x=c98e80cfe0fe368f
dashboard link: https://syzkaller.appspot.com/bug?extid=23f57c5ae902429285d7
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15351680880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12c40828880000

Downloadable assets:
disk image: https://storage.googleapis.com/91fc7665325c/disk-59390358.raw.xz
vmlinux: https://storage.googleapis.com/36d96f923b20/vmlinux-59390358.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+23f57c...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline]
BUG: KASAN: use-after-free in mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884
Read of size 8 at addr ffff88811d8f5ab8 by task syz-executor653/386

CPU: 1 PID: 386 Comm: syz-executor653 Not tainted 5.10.140-syzkaller-00825-g59390358870a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
print_address_description+0x81/0x3c0 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline]
mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884
mon_bin_ioctl+0x2fb/0xed0 drivers/usb/mon/mon_bin.c:1060
vfs_ioctl fs/ioctl.c:48 [inline]
__do_sys_ioctl fs/ioctl.c:753 [inline]
__se_sys_ioctl+0x115/0x190 fs/ioctl.c:739
__x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f8570d8b819
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 18 00 00 90 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:00007f8570d302f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f8570e09480 RCX: 00007f8570d8b819
RDX: 0000000000000006 RSI: 0000000000009208 RDI: 0000000000000003
RBP: 00007f8570dd62bc R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8570dd52f0
R13: 0000000020001978 R14: 6273752f7665642f R15: 00007f8570e09488

The buggy address belongs to the page:
page:ffffea0004763d40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11d8f5
flags: 0x8000000000000000()
raw: 8000000000000000 ffffea0004763d48 ffffea0004763d48 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
ffff88811d8f5980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811d8f5a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811d8f5a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88811d8f5b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811d8f5b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
general protection fault, probably for non-canonical address 0xdffffc000000013c: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000009e0-0x00000000000009e7]
CPU: 1 PID: 386 Comm: syz-executor653 Tainted: G B 5.10.140-syzkaller-00825-g59390358870a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885
Code: 74 08 48 89 df e8 8f 3a 94 fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff
RSP: 0018:ffffc90000c97d08 EFLAGS: 00010007
RAX: 000000000000013c RBX: dffffc0000000000 RCX: 0000000000000002
RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000001
RBP: ffffc90000c97d70 R08: ffffffff813efe13 R09: fffffbfff0d864f9
R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: 00000000fffffffd
R13: ffff88811cd19618 R14: ffff88811cd19600 R15: 00000000000009e4
FS: 00007f8570d30700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020002000 CR3: 000000011785e000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
mon_bin_ioctl+0x2fb/0xed0 drivers/usb/mon/mon_bin.c:1060
vfs_ioctl fs/ioctl.c:48 [inline]
__do_sys_ioctl fs/ioctl.c:753 [inline]
__se_sys_ioctl+0x115/0x190 fs/ioctl.c:739
__x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f8570d8b819
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 18 00 00 90 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:00007f8570d302f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f8570e09480 RCX: 00007f8570d8b819
RDX: 0000000000000006 RSI: 0000000000009208 RDI: 0000000000000003
RBP: 00007f8570dd62bc R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8570dd52f0
R13: 0000000020001978 R14: 6273752f7665642f R15: 00007f8570e09488
Modules linked in:
---[ end trace a8255d76b47e1058 ]---
RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885
Code: 74 08 48 89 df e8 8f 3a 94 fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff
RSP: 0018:ffffc90000c97d08 EFLAGS: 00010007
RAX: 000000000000013c RBX: dffffc0000000000 RCX: 0000000000000002
RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000001
RBP: ffffc90000c97d70 R08: ffffffff813efe13 R09: fffffbfff0d864f9
R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: 00000000fffffffd
R13: ffff88811cd19618 R14: ffff88811cd19600 R15: 00000000000009e4
FS: 00007f8570d30700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020002000 CR3: 000000011785e000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 74 08 je 0xa
2: 48 89 df mov %rbx,%rdi
5: e8 8f 3a 94 fe callq 0xfe943a99
a: 48 8b 03 mov (%rbx),%rax
d: 41 81 e7 ff 0f 00 00 and $0xfff,%r15d
14: 4d 8d 7c 07 24 lea 0x24(%r15,%rax,1),%r15
19: 4c 89 f8 mov %r15,%rax
1c: 48 c1 e8 03 shr $0x3,%rax
20: 48 bb 00 00 00 00 00 movabs $0xdffffc0000000000,%rbx
27: fc ff df
* 2a: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax <-- trapping instruction
2e: 84 c0 test %al,%al
30: 75 6b jne 0x9d
32: 41 8b 37 mov (%r15),%esi
35: 83 c6 40 add $0x40,%esi
38: 4c 89 f7 mov %r14,%rdi
3b: e8 a9 fd ff ff callq 0xfffffde9


---
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 syzk...@googlegroups.com.

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
Reply all
Reply to author
Forward
0 new messages