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

@@ -454,7 +454,7 @@ fn get_cli_options_sorted(
Arg::new("seccomp")
.long("seccomp")
.num_args(1)
.value_parser(["true", "false", "log"])
.value_parser(["true", "false", "log", "errno"])
.default_value("true"),
Arg::new("serial")
.long("serial")
@@ -588,6 +588,7 @@ fn start_vmm(
"true" => SeccompAction::Trap,
"false" => SeccompAction::Allow,
"log" => SeccompAction::Log,
"errno" => SeccompAction::Errno(libc::EPERM as u32),
val => {
// The user providing an invalid value will be rejected
panic!("Invalid parameter {val} for \"--seccomp\" flag");