26 releases (16 breaking)

0.17.0 Sep 28, 2023
0.16.2 Nov 12, 2022
0.16.1 Sep 11, 2021
0.15.0 Oct 6, 2020
0.7.0 Jul 22, 2018

#557 in Unix APIs

Download history 73/week @ 2024-12-21 134/week @ 2024-12-28 122/week @ 2025-01-04 132/week @ 2025-01-11 139/week @ 2025-01-18 153/week @ 2025-01-25 163/week @ 2025-02-01 154/week @ 2025-02-08 186/week @ 2025-02-15 185/week @ 2025-02-22 164/week @ 2025-03-01 151/week @ 2025-03-08 200/week @ 2025-03-15 150/week @ 2025-03-22 110/week @ 2025-03-29 114/week @ 2025-04-05

611 downloads per month
Used in 6 crates

MIT/Apache and LGPL-2.1

105KB
5.5K SLoC

Simple seccomp library for rust. Please note that the syscall list is incomplete and you might need to send a PR to get your syscalls included. This crate releases frequently if the syscall list has been updated.

Example

use syscallz::{Context, Syscall, Action};

fn main() -> syscallz::Result<()> {

    // The default action if no other rule matches is syscallz::DEFAULT_KILL
    // For a different default use `Context::init_with_action`
    let mut ctx = Context::init()?;

    // Allow-list some syscalls
    ctx.allow_syscall(Syscall::open);
    ctx.allow_syscall(Syscall::getpid);
    // Set a specific action for a syscall
    ctx.set_action_for_syscall(Action::Errno(1), Syscall::execve);

    // Enforce the seccomp filter
    ctx.load()?;

    Ok(())
}

syscallz-rs Build Status crates.io docs.rs

Simple seccomp library for rust. Please note that the syscall list is incomplete and you might need to send a PR to get your syscalls included. This crate releases frequently if the syscall list has been updated.

# Cargo.toml
[dependencies]
syscallz = "0.16"

License

MIT/Apache-2.0

Dependencies

~0.3–0.8MB
~19K SLoC