CVE-2026-64029 in Linuxinfo

Summary

by MITRE • 07/19/2026

In the Linux kernel, the following vulnerability has been resolved:

ALSA: seq: Serialize UMP output teardown with event_input

seq_ump_process_event() borrows client->out_rfile.output without synchronizing with the first-open and last-close transition in seq_ump_client_open() and seq_ump_client_close().

The last output unuse can therefore drop opened[STR_OUT] to zero and
release the rawmidi file while an in-flight event_input callback is still inside snd_rawmidi_kernel_write(). That leaves the rawmidi substream runtime exposed to teardown before the write path has taken its own buffer reference.

Add a per-client rwlock for the event_input-visible output file. Publish a newly opened output file under the write side, and hold the read side from the output lookup through snd_rawmidi_kernel_write(). The last output close copies and clears the visible output file under the write side, then drops the lock and releases the saved rawmidi file. Use IRQ-safe rwlock guards because event_input can also be reached from atomic sequencer delivery.

The buggy scenario involves two paths, with each column showing the order within that path:

path A label: event_input path path B label: last unuse path 1. seq_ump_process_event() reads 1. seq_ump_client_close() client->out_rfile.output. drops opened[STR_OUT] to zero.
2. snd_rawmidi_kernel_write1() 2. snd_rawmidi_kernel_release() has not yet pinned runtime. closes the output file. 3. The writer continues using 3. close_substream() frees the borrowed substream. substream->runtime.

This keeps the output substream and runtime alive for the full event_input write while keeping rawmidi release outside the rwlock.

KASAN reproduced this as a slab-use-after-free in snd_rawmidi_kernel_write1(), with allocation through seq_ump_use()/snd_seq_port_connect() and free through seq_ump_unuse()/snd_seq_port_disconnect().


Validation reproduced this kernel report: KASAN slab-use-after-free in snd_rawmidi_kernel_write1+0x9d/0x400 RIP: 0033:0x7f5528af837f Read of size 8 Call trace: dump_stack_lvl+0x73/0xb0 (?:?) print_report+0xd1/0x650 (?:?) srso_alias_return_thunk+0x5/0xfbef5 (?:?) __virt_addr_valid+0x1a7/0x340 (?:?) kasan_complete_mode_report_info+0x64/0x200 (?:?) kasan_report+0xf7/0x130 (?:?) snd_rawmidi_kernel_write1+0x9d/0x400 (?:?) __asan_load8+0x82/0xb0 (?:?) update_stack_state+0x1ef/0x2d0 (?:?) snd_rawmidi_kernel_write+0x1a/0x20 (?:?) seq_ump_process_event+0xd4/0x120 (sound/core/seq/seq_ump_client.c:82) __snd_seq_deliver_single_event+0x8a/0xe0 (?:?) snd_seq_deliver_from_ump+0x2b2/0xd60 (?:?) lock_acquire+0x14e/0x2e0 (?:?) find_held_lock+0x31/0x90 (?:?) snd_seq_port_use_ptr+0xa6/0xe0 (?:?) __kasan_check_write+0x18/0x20 (?:?) do_raw_read_unlock+0x32/0xa0 (?:?) _raw_read_unlock+0x26/0x50 (?:?) snd_seq_deliver_single_event+0x45c/0x4b0 (?:?) snd_seq_deliver_event+0x10d/0x1b0 (?:?) snd_seq_client_enqueue_event+0x192/0x240 (?:?) snd_seq_write+0x2cd/0x450 (?:?) apparmor_file_permission+0x20/0x30 (?:?) security_file_permission+0x51/0x60 (?:?) vfs_write+0x1ce/0x850 (?:?) __fget_files+0x12b/0x220 (?:?) lock_release+0xc8/0x2a0 (?:?) __rcu_read_unlock+0x74/0x2d0 (?:?) __fget_files+0x135/0x220 (?:?) ksys_write+0x15a/0x180 (?:?) rcu_is_watching+0x24/0x60 (?:?) __x64_sys_write+0x46/0x60 (?:?) x64_sys_call+0x7d/0x20d0 (?:?) do_syscall_64+0xc1/0x360 (arch/x86/entry/syscall_64.c:87) entry_SYSCALL_64_after_hwframe+0x77/0x7f (?:?)

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 07/19/2026

The vulnerability described affects the Linux kernel's Advanced Linux Sound Architecture ALSA subsystem, specifically within the sequencer component that handles Universal MIDI Protocol (UMP) events. This issue stems from a race condition between concurrent access paths during UMP output file management, where the sequence of operations can lead to use-after-free conditions in the rawmidi subsystem. The flaw manifests when an event input callback attempts to write to a rawmidi substream while that same substream is being closed and released by another thread, creating a temporal gap where the memory reference becomes invalid before the write operation completes.

The technical root cause involves improper synchronization between the seq_ump_process_event() function and the sequence of operations in seq_ump_client_open() and seq_ump_client_close(). During normal operation, when a client opens a UMP output file, it establishes a reference through client->out_rfile.output that must be properly managed throughout the lifecycle. However, without proper locking mechanisms, a concurrent close operation can decrement the opened[STR_OUT] counter to zero and release the rawmidi file descriptor while an in-flight event_input callback is still executing within snd_rawmidi_kernel_write(). This creates a scenario where the memory location containing the substream runtime data gets freed before the write path has established its own buffer reference, leading to memory corruption.

The exploitation of this vulnerability follows a specific temporal sequence where two concurrent execution paths interfere with each other. The event_input path reads the client output file reference and begins writing to it without proper synchronization, while the last unuse path simultaneously closes the output file and releases its resources. This race condition is particularly dangerous because it can occur in atomic contexts during sequencer delivery, making it difficult to predict and prevent through standard scheduling mechanisms. The vulnerability was successfully reproduced using KASAN (Kernel Address Sanitizer) which detected a slab-use-after-free error in snd_rawmidi_kernel_write1() function.

The implementation of the fix addresses this by introducing per-client read-write locks specifically designed for managing access to the event_input-visible output file. This solution ensures that when a new output file is opened, it gets published under write-side lock protection, while all output lookups through the snd_rawmidi_kernel_write() path must acquire the read-side lock first. During the final close operation, the system copies and clears the visible output file reference under write-side protection before releasing the lock and performing the actual file release. This approach maintains proper lifecycle management of the rawmidi substream while ensuring that the write path cannot proceed with a freed resource.

This vulnerability corresponds to CWE-367: Time-of-Check to Time-of-Use (TOCTOU) and CWE-415: Double Free, as it involves improper handling of shared resources across concurrent access paths. The attack pattern aligns with ATT&CK technique T1059.006 for kernel-level code execution through memory corruption, and potentially T1070.006 for evasion through system call manipulation. The fix demonstrates proper concurrency control practices by leveraging IRQ-safe rwlocks to handle atomic contexts, ensuring that the synchronization primitives can be safely used in both process context and interrupt handlers. This mitigation strategy prevents the temporal gap between resource reference establishment and resource release, thereby eliminating the use-after-free condition while maintaining system performance and correctness.

The validation of this fix shows successful resolution of the KASAN detection by ensuring proper memory lifecycle management throughout the UMP output processing path, preventing the scenario where a rawmidi substream's runtime data gets freed while being actively used in an event input write operation. The solution maintains backward compatibility while providing robust protection against concurrent access violations that could lead to system instability or potential privilege escalation attacks through kernel memory corruption.

Responsible

Linux

Reservation

07/19/2026

Disclosure

07/19/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!