mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices, vmm: Add seccomp rules for iommufd and vfio cdev
Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
@@ -53,6 +53,10 @@ macro_rules! or {
|
||||
const VFIO_IOMMU_MAP_DMA: u64 = 0x3b71;
|
||||
const VFIO_IOMMU_UNMAP_DMA: u64 = 0x3b72;
|
||||
|
||||
// See include/uapi/linux/iommufd.h in the kernel code.
|
||||
const IOMMU_IOAS_MAP: u64 = 0x3b85;
|
||||
const IOMMU_IOAS_UNMAP: u64 = 0x3b86;
|
||||
|
||||
#[cfg(feature = "sev_snp")]
|
||||
fn mshv_sev_snp_ioctl_seccomp_rule() -> SeccompRule {
|
||||
and![
|
||||
@@ -83,6 +87,8 @@ fn create_virtio_iommu_ioctl_seccomp_rule() -> Vec<SeccompRule> {
|
||||
or![
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, VFIO_IOMMU_MAP_DMA).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, VFIO_IOMMU_UNMAP_DMA).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, IOMMU_IOAS_MAP).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, IOMMU_IOAS_UNMAP).unwrap()],
|
||||
]
|
||||
}
|
||||
|
||||
@@ -90,6 +96,8 @@ fn create_virtio_mem_ioctl_seccomp_rule() -> Vec<SeccompRule> {
|
||||
or![
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, VFIO_IOMMU_MAP_DMA).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, VFIO_IOMMU_UNMAP_DMA).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, IOMMU_IOAS_MAP).unwrap()],
|
||||
and![Cond::new(1, ArgLen::Dword, Eq, IOMMU_IOAS_UNMAP).unwrap()],
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user