Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions resources/seccomp/aarch64-unknown-linux-musl.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"syscall": "read"
},
{
"syscall": "readv",
"comment": "Used by the VirtIO net device to read from tap"
},
{
"syscall": "write"
},
Expand Down
4 changes: 4 additions & 0 deletions resources/seccomp/x86_64-unknown-linux-musl.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"syscall": "read"
},
{
"syscall": "readv",
"comment": "Used by the VirtIO net device to read from tap"
},
{
"syscall": "write"
},
Expand Down
17 changes: 17 additions & 0 deletions src/vmm/src/devices/virtio/iovec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
.checked_add(desc.len)
.ok_or(IoVecError::OverflowedDescriptor)?;
if matches!(max_size, Some(max) if self.len >= max) {
break;

Check warning on line 288 in src/vmm/src/devices/virtio/iovec.rs

View check run for this annotation

Codecov / codecov/patch

src/vmm/src/devices/virtio/iovec.rs#L288

Added line #L288 was not covered by tests
}
if desc.load_next_descriptor().is_none() {
break;
Expand Down Expand Up @@ -327,6 +327,23 @@
self.len = 0u32;
}

/// Push an iovec into the `IoVecBufferMut`.
/// # Safety
/// The iovec must refer to a valid memory slice.
pub unsafe fn push(&mut self, iovec: iovec) -> Result<(), IoVecError> {
let iov_len = iovec
.iov_len
.try_into()
.map_err(|_| IoVecError::OverflowedDescriptor)?;

self.vecs.push(iovec);
self.len = self
.len
.checked_add(iov_len)
.ok_or(IoVecError::OverflowedDescriptor)?;
Ok(())
}

/// Writes a number of bytes into the `IoVecBufferMut` starting at a given offset.
///
/// This will try to fill `IoVecBufferMut` writing bytes from the `buf` starting from
Expand Down
Loading
Loading