syd 3.54.1

rock-solid application kernel
Documentation
//
// Syd: rock-solid application kernel
// src/kernel/ptrace/event/scmp.rs: ptrace(2) seccomp event handler
//
// Copyright (c) 2025, 2026 Ali Polatel <alip@chesswob.org>
//
// SPDX-License-Identifier: GPL-3.0

use std::sync::{Arc, RwLock};

use nix::unistd::Pid;

use crate::{
    confine::SydNotifResp, cookie::safe_kill, kernel::ptrace::handle_ptrace_sysenter,
    ptrace::ptrace_syscall_info, sandbox::Sandbox, workers::WorkerCache,
};

pub(crate) fn sysevent_scmp(
    pid: Pid,
    info: ptrace_syscall_info,
    cache: &Arc<WorkerCache>,
    sandbox: &Arc<RwLock<Sandbox>>,
) -> Option<SydNotifResp> {
    if info.seccomp().is_none() {
        let _ = safe_kill(pid, libc::SIGKILL);
        return None;
    }

    // Handle system call entry.
    handle_ptrace_sysenter(pid, info, cache, sandbox)
}