vmm: Support setting seccomp to errno

This will generate -EPERM on seccomp violations as opposed to causing
the VMM to exit with SIGSYS.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-06-05 10:56:17 +01:00
committed by Bo Chen
parent 9c5180fc2c
commit 58306b6f28
4 changed files with 20 additions and 22 deletions

View File

@@ -1249,23 +1249,12 @@ pub fn get_seccomp_filter(
) -> Result<BpfProgram, Error> {
match seccomp_action {
SeccompAction::Allow => Ok(vec![]),
SeccompAction::Log => SeccompFilter::new(
get_seccomp_rules(thread_type, hypervisor_type)
.map_err(Error::Backend)?
.into_iter()
.collect(),
SeccompAction::Log,
SeccompAction::Allow,
consts::ARCH.try_into().unwrap(),
)
.and_then(|filter| filter.try_into())
.map_err(Error::Backend),
_ => SeccompFilter::new(
get_seccomp_rules(thread_type, hypervisor_type)
.map_err(Error::Backend)?
.into_iter()
.collect(),
SeccompAction::Trap,
seccomp_action.clone(),
SeccompAction::Allow,
consts::ARCH.try_into().unwrap(),
)