syzbot
KASAN: use-after-free Read in snd_rawmidi_transmit (3)
Status:
upstream: reported on 2026/10/18 20:11
Reported-by: syzbot+2edbc52074a1a1c23f71@syzkaller.appspotmail.com
First crash: 3d01h, last: 3d01h
Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __snd_rawmidi_transmit_peek sound/core/rawmidi.c:1286 [inline]
BUG: KASAN: use-after-free in snd_rawmidi_transmit+0x392/0x400 sound/core/rawmidi.c:1411
Read of size 1 at addr ffff88804727607a by task syz.2.1044/9265
CPU: 1 PID: 9265 Comm: syz.2.1044 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
print_address_description+0x60/0x2d0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0xdf/0x130 mm/kasan/report.c:451
__snd_rawmidi_transmit_peek sound/core/rawmidi.c:1286 [inline]
snd_rawmidi_transmit+0x392/0x400 sound/core/rawmidi.c:1411
snd_usbmidi_standard_output+0x1de/0xe10 sound/usb/midi.c:718
snd_usbmidi_do_output+0x216/0x550 sound/usb/midi.c:311
snd_usbmidi_error_timer+0x319/0x660 sound/usb/midi.c:362
call_timer_fn+0x17b/0x540 kernel/time/timer.c:1648
expire_timers kernel/time/timer.c:1699 [inline]
__run_timers+0x56c/0x810 kernel/time/timer.c:1970
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1983
handle_softirqs+0x336/0x830 kernel/softirq.c:576
__do_softirq kernel/softirq.c:610 [inline]
invoke_softirq kernel/softirq.c:450 [inline]
__irq_exit_rcu+0x13b/0x230 kernel/softirq.c:659
irq_exit_rcu+0x5/0x20 kernel/softirq.c:671
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:lock_acquire+0x209/0x400 kernel/locking/lockdep.c:5741
Code: f7 84 24 80 00 00 00 00 02 00 00 43 c6 44 3c 04 f8 0f 85 f0 00 00 00 41 f7 c6 00 02 00 00 74 01 fb 48 c7 44 24 60 0e 36 e0 45 <4b> c7 04 3c 00 00 00 00 43 c7 44 3c 08 00 00 00 00 65 48 8b 04 25
RSP: 0018:ffffc900035cfb40 EFLAGS: 00000206
RAX: 0000000000000001 RBX: 0000000000000000 RCX: 6df5484ed29bd600
RDX: 0000000000000000 RSI: ffffffff8a2b3e00 RDI: ffffffff8a7a4b40
RBP: ffffc900035cfc58 R08: dffffc0000000000 R09: 1ffffffff2202a1e
R10: dffffc0000000000 R11: fffffbfff2202a1f R12: 1ffff920006b9f74
R13: ffff888017869628 R14: 0000000000000246 R15: dffffc0000000000
__might_fault+0xb3/0x110 mm/memory.c:5357
do_recvmmsg+0x389/0x7f0 net/socket.c:2807
__sys_recvmmsg net/socket.c:2880 [inline]
__do_sys_recvmmsg net/socket.c:2903 [inline]
__se_sys_recvmmsg net/socket.c:2896 [inline]
__x64_sys_recvmmsg+0x195/0x250 net/socket.c:2896
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fd106457559
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd10468e028 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007fd1066df090 RCX: 00007fd106457559
RDX: 0000000000010106 RSI: 0000200000000640 RDI: 0000000000000004
RBP: 00007fd1064eeab8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fd1066df128 R14: 00007fd1066df090 R15: 00007ffd7601ed38
</TASK>
Allocated by task 9218:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
__kasan_kmalloc+0xaf/0xe0 mm/kasan/common.c:522
kmalloc_node include/linux/slab.h:630 [inline]
kvmalloc_node+0x84/0x130 mm/util.c:619
kvmalloc include/linux/mm.h:816 [inline]
kvzalloc include/linux/mm.h:824 [inline]
snd_rawmidi_runtime_create sound/core/rawmidi.c:162 [inline]
open_substream+0x298/0x6c0 sound/core/rawmidi.c:306
rawmidi_open_priv+0xc4/0x620 sound/core/rawmidi.c:357
snd_rawmidi_kernel_open+0x1a2/0x240 sound/core/rawmidi.c:392
midisynth_use+0xed/0x280 sound/core/seq/seq_midi.c:221
subscribe_port sound/core/seq/seq_ports.c:412 [inline]
check_and_subscribe_port+0x635/0xaf0 sound/core/seq/seq_ports.c:495
snd_seq_port_connect+0x251/0x420 sound/core/seq/seq_ports.c:581
snd_seq_ioctl_subscribe_port+0x30a/0x6d0 sound/core/seq/seq_clientmgr.c:1557
snd_seq_oss_midi_open+0x3dd/0x7f0 sound/core/seq/oss/seq_oss_midi.c:365
snd_seq_oss_synth_setup_midi+0x129/0x520 sound/core/seq/oss/seq_oss_synth.c:269
snd_seq_oss_open+0x935/0xf00 sound/core/seq/oss/seq_oss_init.c:261
odev_open+0x63/0x90 sound/core/seq/oss/seq_oss.c:128
chrdev_open+0x585/0x5f0 fs/char_dev.c:414
do_dentry_open+0x7f7/0xf90 fs/open.c:826
do_open fs/namei.c:3659 [inline]
path_openat+0x2718/0x2fb0 fs/namei.c:3793
do_filp_open+0x1df/0x400 fs/namei.c:3820
do_sys_openat2+0x14b/0x500 fs/open.c:1255
do_sys_open fs/open.c:1271 [inline]
__do_sys_openat fs/open.c:1287 [inline]
__se_sys_openat fs/open.c:1282 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1282
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 9218:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1710 [inline]
slab_free_freelist_hook+0xec/0x170 mm/slub.c:1736
slab_free mm/slub.c:3504 [inline]
kfree+0xef/0x2a0 mm/slub.c:4564
snd_rawmidi_runtime_free sound/core/rawmidi.c:176 [inline]
close_substream+0x36c/0x5b0 sound/core/rawmidi.c:528
rawmidi_release_priv+0xe6/0x170 sound/core/rawmidi.c:547
snd_rawmidi_kernel_release+0x42/0xa0 sound/core/rawmidi.c:564
unsubscribe_port sound/core/seq/seq_ports.c:437 [inline]
__delete_and_unsubscribe_port+0x28a/0x440 sound/core/seq/seq_ports.c:537
snd_seq_port_disconnect+0x52e/0x660 sound/core/seq/seq_ports.c:616
snd_seq_ioctl_unsubscribe_port+0x30a/0x6d0 sound/core/seq/seq_clientmgr.c:1602
snd_seq_oss_midi_close+0x356/0x6c0 sound/core/seq/oss/seq_oss_midi.c:413
snd_seq_oss_synth_reset+0x3e9/0x9a0 sound/core/seq/oss/seq_oss_synth.c:406
snd_seq_oss_reset+0x56/0x240 sound/core/seq/oss/seq_oss_init.c:436
snd_seq_oss_release+0xfb/0x310 sound/core/seq/oss/seq_oss_init.c:413
odev_release+0x52/0x70 sound/core/seq/oss/seq_oss.c:144
__fput+0x212/0x8c0 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:184
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:217
__syscall_exit_to_user_mode_work kernel/entry/common.c:299 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:310
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff888047276000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 122 bytes inside of
4096-byte region [ffff888047276000, ffff888047277000)
The buggy address belongs to the page:
page:ffffea00011c9c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x47270
head:ffffea00011c9c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017842140
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9218, ts 365624062954, free_ts 365512653714
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192
__alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
alloc_slab_page mm/slub.c:1780 [inline]
allocate_slab mm/slub.c:1917 [inline]
new_slab+0xc0/0x4b0 mm/slub.c:1980
___slab_alloc+0x807/0xdd0 mm/slub.c:3013
__slab_alloc mm/slub.c:3100 [inline]
slab_alloc_node mm/slub.c:3191 [inline]
__kmalloc_node+0x142/0x3a0 mm/slub.c:4456
kmalloc_node include/linux/slab.h:630 [inline]
kvmalloc_node+0x84/0x130 mm/util.c:619
kvmalloc include/linux/mm.h:816 [inline]
kvzalloc include/linux/mm.h:824 [inline]
snd_rawmidi_runtime_create sound/core/rawmidi.c:162 [inline]
open_substream+0x298/0x6c0 sound/core/rawmidi.c:306
rawmidi_open_priv+0x93/0x620 sound/core/rawmidi.c:352
snd_rawmidi_kernel_open+0x1a2/0x240 sound/core/rawmidi.c:392
midisynth_subscribe+0xed/0x330 sound/core/seq/seq_midi.c:177
subscribe_port sound/core/seq/seq_ports.c:412 [inline]
check_and_subscribe_port+0x635/0xaf0 sound/core/seq/seq_ports.c:495
snd_seq_port_connect+0x1d3/0x420 sound/core/seq/seq_ports.c:576
snd_seq_ioctl_subscribe_port+0x30a/0x6d0 sound/core/seq/seq_clientmgr.c:1557
snd_seq_oss_midi_open+0x4f3/0x7f0 sound/core/seq/oss/seq_oss_midi.c:374
snd_seq_oss_synth_setup_midi+0x129/0x520 sound/core/seq/oss/seq_oss_synth.c:269
snd_seq_oss_open+0x935/0xf00 sound/core/seq/oss/seq_oss_init.c:261
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396
free_slab mm/slub.c:2020 [inline]
discard_slab mm/slub.c:2026 [inline]
__unfreeze_partials+0x188/0x1e0 mm/slub.c:2512
put_cpu_partial+0x12d/0x190 mm/slub.c:2592
qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3225 [inline]
slab_alloc mm/slub.c:3233 [inline]
kmem_cache_alloc+0x15d/0x280 mm/slub.c:3238
getname_flags+0xb7/0x4f0 fs/namei.c:138
do_sys_openat2+0xdd/0x500 fs/open.c:1249
do_sys_open fs/open.c:1271 [inline]
__do_sys_openat fs/open.c:1287 [inline]
__se_sys_openat fs/open.c:1282 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1282
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Memory state around the buggy address:
ffff888047275f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888047275f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888047276000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888047276080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888047276100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: f7 84 24 80 00 00 00 testl $0x200,0x80(%rsp)
7: 00 02 00 00
b: 43 c6 44 3c 04 f8 movb $0xf8,0x4(%r12,%r15,1)
11: 0f 85 f0 00 00 00 jne 0x107
17: 41 f7 c6 00 02 00 00 test $0x200,%r14d
1e: 74 01 je 0x21
20: fb sti
21: 48 c7 44 24 60 0e 36 movq $0x45e0360e,0x60(%rsp)
28: e0 45
* 2a: 4b c7 04 3c 00 00 00 movq $0x0,(%r12,%r15,1) <-- trapping instruction
31: 00
32: 43 c7 44 3c 08 00 00 movl $0x0,0x8(%r12,%r15,1)
39: 00 00
3b: 65 gs
3c: 48 rex.W
3d: 8b .byte 0x8b
3e: 04 25 add $0x25,%al
* Struck through repros no longer work on HEAD.