Re: [syzbot] [usb?] KASAN: slab-use-after-free Read in attach_store

syzbot <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
general protection fault in attach_store

Oops: general protection fault, probably for non-canonical address 0xdffffc000000001f: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x00000000000000f8-0x00000000000000ff]
CPU: 3 UID: 0 PID: 5994 Comm: syz-executor227 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x15d/0x1bd0 kernel/locking/mutex.c:821
Code: 08 84 d2 0f 85 67 14 00 00 44 8b 3d bd 29 b6 0f 45 85 ff 75 29 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 58 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 5e 14 00 00 48 3b 5b 58 0f 85 8b 07 00 00 bf 01
RSP: 0018:ffffc900034a79c0 EFLAGS: 00010202

RAX: dffffc0000000000 RBX: 00000000000000a0 RCX: 0000000000000001
RDX: 000000000000001f RSI: ffffffff8e183b4b RDI: 00000000000000f8
RBP: ffffc900034a7b30 R08: ffffffff87ea8263 R09: 0000000000000004
R10: ffffc900034a7b48 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000000
FS:  00007fa40066f6c0(0000) GS:ffff8880d60e9000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555b3ccb5258 CR3: 000000002e664000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 attach_store+0x333/0x8f0 drivers/usb/usbip/vhci_sysfs.c:364
 dev_attr_store+0x58/0x80 drivers/base/core.c:2505
 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345
 new_sync_write fs/read_write.c:595 [inline]
 vfs_write+0x6ac/0x1050 fs/read_write.c:687
 ksys_write+0x12a/0x250 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa401ec7bde
Code: 08 0f 85 f5 e2 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 90 41 57 41 56 4d 89 c6 41 55 4d 89 cd 41 54 55 53 48 83 ec 08
RSP: 002b:00007fa40066f098 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa40066f6c0 RCX: 00007fa401ec7bde
RDX: 0000000000000009 RSI: 00007fa40066f100 RDI: 0000000000000007
RBP: 00007fa401f130b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffd0
R13: 0000000000000009 R14: 00007ffc9812f530 R15: 00007ffc9812f618
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x15d/0x1bd0 kernel/locking/mutex.c:821
Code: 08 84 d2 0f 85 67 14 00 00 44 8b 3d bd 29 b6 0f 45 85 ff 75 29 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 58 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 5e 14 00 00 48 3b 5b 58 0f 85 8b 07 00 00 bf 01
RSP: 0018:ffffc900034a79c0 EFLAGS: 00010202

RAX: dffffc0000000000 RBX: 00000000000000a0 RCX: 0000000000000001
RDX: 000000000000001f RSI: ffffffff8e183b4b RDI: 00000000000000f8
RBP: ffffc900034a7b30 R08: ffffffff87ea8263 R09: 0000000000000004
R10: ffffc900034a7b48 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000000
FS:  00007fa40066f6c0(0000) GS:ffff8880d60e9000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555b3cb6c620 CR3: 000000002e664000 CR4: 0000000000352ef0
----------------
Code disassembly (best guess):
   0:	08 84 d2 0f 85 67 14 	or     %al,0x1467850f(%rdx,%rdx,8)
   7:	00 00                	add    %al,(%rax)
   9:	44 8b 3d bd 29 b6 0f 	mov    0xfb629bd(%rip),%r15d        # 0xfb629cd
  10:	45 85 ff             	test   %r15d,%r15d
  13:	75 29                	jne    0x3e
  15:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1c:	fc ff df
  1f:	48 8d 7b 58          	lea    0x58(%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:	0f 85 5e 14 00 00    	jne    0x1492
  34:	48 3b 5b 58          	cmp    0x58(%rbx),%rbx
  38:	0f 85 8b 07 00 00    	jne    0x7c9
  3e:	bf                   	.byte 0xbf
  3f:	01                   	.byte 0x1


Tested on:

commit:         15ef2f78 Merge tag 'input-for-v7.2-rc7' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=158bca25580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c44651ea7dd2f307
dashboard link: https://syzkaller.appspot.com/bug?extid=8753715f05759f1a10de
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17f74279580000
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.