Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions virtio-devices/src/seccomp_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ fn virtio_watchdog_thread_rules() -> Vec<(i64, Vec<SeccompRule>)> {
]
}

/// Rules needed to print absolute timestamps.
fn logging_rules() -> Vec<(i64, Vec<SeccompRule>)> {
vec![(libc::SYS_readlink, vec![]), (libc::SYS_openat, vec![])]
}

fn get_seccomp_rules(thread_type: Thread) -> Vec<(i64, Vec<SeccompRule>)> {
let mut rules = match thread_type {
Thread::VirtioBalloon => virtio_balloon_thread_rules(),
Expand All @@ -277,6 +282,7 @@ fn get_seccomp_rules(thread_type: Thread) -> Vec<(i64, Vec<SeccompRule>)> {
Thread::VirtioWatchdog => virtio_watchdog_thread_rules(),
};
rules.append(&mut virtio_thread_common());
rules.append(&mut logging_rules());
rules
}

Expand Down
26 changes: 17 additions & 9 deletions vmm/src/seccomp_filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,20 +939,28 @@ fn event_monitor_thread_rules() -> Result<Vec<(i64, Vec<SeccompRule>)>, BackendE
])
}

/// Rules needed to print absolute timestamps.
fn logging_rules() -> Vec<(i64, Vec<SeccompRule>)> {
vec![(libc::SYS_readlink, vec![]), (libc::SYS_openat, vec![])]
}

fn get_seccomp_rules(
thread_type: Thread,
hypervisor_type: HypervisorType,
) -> Result<Vec<(i64, Vec<SeccompRule>)>, BackendError> {
match thread_type {
Thread::HttpApi => Ok(http_api_thread_rules()?),
let mut rules = match thread_type {
Thread::HttpApi => http_api_thread_rules()?,
#[cfg(feature = "dbus_api")]
Thread::DBusApi => Ok(dbus_api_thread_rules()?),
Thread::EventMonitor => Ok(event_monitor_thread_rules()?),
Thread::SignalHandler => Ok(signal_handler_thread_rules()?),
Thread::Vcpu => Ok(vcpu_thread_rules(hypervisor_type)?),
Thread::Vmm => Ok(vmm_thread_rules(hypervisor_type)?),
Thread::PtyForeground => Ok(pty_foreground_thread_rules()?),
}
Thread::DBusApi => dbus_api_thread_rules()?,
Thread::EventMonitor => event_monitor_thread_rules()?,
Thread::SignalHandler => signal_handler_thread_rules()?,
Thread::Vcpu => vcpu_thread_rules(hypervisor_type)?,
Thread::Vmm => vmm_thread_rules(hypervisor_type)?,
Thread::PtyForeground => pty_foreground_thread_rules()?,
};

rules.append(&mut logging_rules());
Ok(rules)
}

/// Generate a BPF program based on the seccomp_action value
Expand Down
Loading