vmm: Enable FD-based VFIO devices

Signed-off-by: Bo Chen <bchen@crusoe.ai>
Assisted-by: Claude:Opus-4.7
This commit is contained in:
Bo Chen
2026-04-24 22:57:43 +00:00
committed by Rob Bradford
parent d9f89ef2ab
commit c315d5fd96
3 changed files with 196 additions and 22 deletions
+5 -4
View File
@@ -786,10 +786,11 @@ where
impl ApplyLandlock for DeviceConfig {
fn apply_landlock(&self, landlock: &mut Landlock) -> LandlockResult<()> {
let path = self
.path
.as_deref()
.expect("DeviceConfig::parse and OpenAPI spec enforce a path");
// When the device is supplied via an externally-opened FD, there is no
// path to grant access to: the file is already open. Skip the rule.
let Some(path) = self.path.as_deref() else {
return Ok(());
};
let device_path = fs::read_link(path).map_err(LandlockError::OpenPath)?;
let iommu_group = device_path.file_name();
let iommu_group_str = iommu_group