Skip to content

Commit

Permalink
Inflight I/O: Fix queue region header layout
Browse files Browse the repository at this point in the history
As defined in the vhost-user protocol[1], the last field of queue region
header should be a zero-sized array. However, current implementation
uses u64, which will cause a wrong inflight I/O memfd memory layout. So,
let's just remove the desc fileds to fix it.

[1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html

Signed-off-by: Jiachen Zhang <[email protected]>
  • Loading branch information
zhangjaycee committed Sep 24, 2021
1 parent 38fae60 commit c5f62ee
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/vhost_user/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,6 @@ pub struct QueueRegionSplit {
pub last_batch_head: u16,
/// Idx value of used ring
pub used_idx: u16,
/// Pointer to an array of DescStateSplit entries
pub desc: u64,
}

impl QueueRegionSplit {
Expand All @@ -890,7 +888,6 @@ impl QueueRegionSplit {
desc_num: queue_size,
last_batch_head: 0,
used_idx: 0,
desc: 0,
}
}
}
Expand Down Expand Up @@ -951,8 +948,6 @@ pub struct QueueRegionPacked {
pub old_used_wrap_counter: u8,
/// Padding
padding: [u8; 7],
/// Pointer to array tracking state of each descriptor from descriptor ring
pub desc: u64,
}

impl QueueRegionPacked {
Expand All @@ -969,7 +964,6 @@ impl QueueRegionPacked {
used_wrap_counter: 0,
old_used_wrap_counter: 0,
padding: [0; 7],
desc: 0,
}
}
}
Expand Down

0 comments on commit c5f62ee

Please sign in to comment.