Skip to content

Commit 7ab92d6

Browse files
committed
rfc: why do we need to clone EventFd?
In the PoC we are using a `notifier()` call that returns an `Option<EventFd>`, which essentially means that we need to clone the file descriptor. This causes us to call `dup`, which seccomp filters don't like. If instead we just return an `Option<&EventFd>` we don't need to clone anything. However, not sure if that would work with the PCIe logic. Signed-off-by: Babis Chalios <bchalios@amazon.es>
1 parent 253c94d commit 7ab92d6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/vmm/src/devices/virtio/transport/mmio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ impl VirtioInterrupt for IrqTrigger {
400400
}
401401
}
402402

403-
fn notifier(&self, _interrupt_type: VirtioInterruptType) -> Option<EventFd> {
404-
self.irq_evt.try_clone().ok()
403+
fn notifier(&self, _interrupt_type: VirtioInterruptType) -> Option<&EventFd> {
404+
Some(&self.irq_evt)
405405
}
406406

407407
fn status(&self) -> Arc<AtomicU32> {

src/vmm/src/devices/virtio/transport/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub trait VirtioInterrupt: std::fmt::Debug + Send + Sync {
2424
fn trigger(&self, interrupt_type: VirtioInterruptType) -> Result<(), std::io::Error>;
2525

2626
/// Get the `EventFd` (if any) that backs the underlying interrupt.
27-
fn notifier(&self, _interrupt_type: VirtioInterruptType) -> Option<EventFd> {
27+
fn notifier(&self, _interrupt_type: VirtioInterruptType) -> Option<&EventFd> {
2828
None
2929
}
3030

0 commit comments

Comments
 (0)