In the Linux kernel, the following vulnerability has been resolved:
Drivers: hv: vmbus: Bounds check the shared ring buffer indices
In a CoCo VM the host is untrusted. Since the VMBus ring buffer read and
write indices live in shared memory, the guest has to treat both as
potentially malicious.
hv_ringbuffer_write() copies into the ring at write_index with no bounds
checking, so the host can make the guest write packet data at any offset
up to 4 GiB past the start of the ring buffer. read_index matters too:
the available space derived from both indices is the only bound on how
much is copied, and an out-of-range index can make it far larger than
the ring.
The fix is to validate both indices before use and to use the validated
snapshot instead of re-accessing. For invalid indices,
hv_ringbuffer_write() logs and returns -EIO.
One re-read of write_index is left unchecked in this patch:
hv_get_ring_bufferindices() fetches it again for the prev_indices
trailer. The value is only returned to the host and is not used as an
offset or length for indexing. Since this is not a security issue, it is
addressed later in the series.
Open-coding the bytes available arithmetic keeps the fix free of
prerequisites; a later patch refactors it into a helper function.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
CVSS Score: 9.3
AV:L - The Hyper-V host writes hv_ring_buffer.read_index and write_index in the decrypted ring-header page that __vmbus_establish_gpadl() shares for a non-confidential channel. hv_ringbuffer_write() uses that write_index as the memcpy offset when heartbeat_onchannelcallback() replies through vmbus_sendpacket().
AC:L - The host offers the heartbeat channel without VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER so the ring stays shared, then sets both indices so hv_get_bytes_to_write() wraps past the size check. heartbeat_onchannelcallback() answers the host's own packet via vmbus_sendpacket(), so the copy is under the host's control.
PR:N - The host writes the shared outbound ring header from outside the guest and presents no guest credential. vmbus_onoffer() accepts the heartbeat device because allowed_in_isolated is set, and the reply runs in kernel context.
UI:N - The host posts the inbound heartbeat and poisons the outbound indices itself. heartbeat_onchannelcallback() sends the reply from the guest kernel as part of handling that packet.
S:C - hv_copyto_ringbuffer() memcpy's at the ring data pointer plus the host-chosen write_index, past the double-mapped vmap, so bytes that should stay in the host-shared ring land in other guest kernel memory across the CoCo private boundary.
C:H - The echoed hbeat_txf_buf, whose bytes the host chose and whose length is recvlen up to one page, is written at a host-chosen u32 offset. That corrupts guest pointers later VMBus replies use to copy private memory into the shared ring.
I:H - hv_copyto_ringbuffer() memcpy's the outbound packet at write_index with no upper bound against ring_datasize, a host-chosen offset up to 4GiB past the ring, using bytes from the host-supplied heartbeat buffer.
A:H - The memcpy in hv_copyto_ringbuffer() runs while hv_ringbuffer_write() holds outring_info->ring_lock with IRQs disabled, so a write_index on the vmap guard page or an unmapped hole faults and oopses the guest.
| Attack Vector |
Local |
Scope |
Changed |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - The Hyper-V host writes hv_ring_buffer.read_index and write_index in the decrypted ring-header page that __vmbus_establish_gpadl() shares for a non-confidential channel. hv_ringbuffer_write() uses that write_index as the memcpy offset when heartbeat_onchannelcallback() replies through vmbus_sendpacket().
AC:L - The host offers the heartbeat channel without VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER so the ring stays shared, then sets both indices so hv_get_bytes_to_write() wraps past the size check. heartbeat_onchannelcallback() answers the host's own packet via vmbus_sendpacket(), so the copy is under the host's control.
PR:N - The host writes the shared outbound ring header from outside the guest and presents no guest credential. vmbus_onoffer() accepts the heartbeat device because allowed_in_isolated is set, and the reply runs in kernel context.
UI:N - The host posts the inbound heartbeat and poisons the outbound indices itself. heartbeat_onchannelcallback() sends the reply from the guest kernel as part of handling that packet.
S:C - hv_copyto_ringbuffer() memcpy's at the ring data pointer plus the host-chosen write_index, past the double-mapped vmap, so bytes that should stay in the host-shared ring land in other guest kernel memory across the CoCo private boundary.
C:H - The echoed hbeat_txf_buf, whose bytes the host chose and whose length is recvlen up to one page, is written at a host-chosen u32 offset. That corrupts guest pointers later VMBus replies use to copy private memory into the shared ring.
I:H - hv_copyto_ringbuffer() memcpy's the outbound packet at write_index with no upper bound against ring_datasize, a host-chosen offset up to 4GiB past the ring, using bytes from the host-supplied heartbeat buffer.
A:H - The memcpy in hv_copyto_ringbuffer() runs while hv_ringbuffer_write() holds outring_info->ring_lock with IRQs disabled, so a write_index on the vmap guard page or an unmapped hole faults and oopses the guest.
CVSS 3.1