Skip to content

syscall_table: expose get_syscall_nr without json#101

Open
lu-zero wants to merge 1 commit into
rust-vmm:mainfrom
lu-zero:pr/get-syscall-nr
Open

syscall_table: expose get_syscall_nr without json#101
lu-zero wants to merge 1 commit into
rust-vmm:mainfrom
lu-zero:pr/get-syscall-nr

Conversation

@lu-zero

@lu-zero lu-zero commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Expose architecture-specific syscall name lookup for callers that build filters in Rust without using the JSON frontend.

  • Always compile syscall_table (no longer gated on the json feature)
  • Add public get_syscall_nr(name, arch) -> Option<i64>
  • Unit and integration tests for host and cross-arch lookups

Rationale

hakoniwa could move its seccomp backend from libseccomp to seccompiler. It keeps its own filter IR and OCI/podman-style profile loader; it only needs seccompiler for name→number resolution, BPF compilation, and install.

Today the syscall tables are only linked when the json feature is enabled, so a pure library consumer cannot resolve names like "openat" without also pulling in the JSON frontend. get_syscall_nr fills that gap in the same way programmatic builders need (and matches the “skip unknown syscalls” pattern used with libseccomp’s name lookup).

This is a small, self-contained slice of that work; further PRs will cover per-rule actions, optional PR_SET_NO_NEW_PRIVS, and related install helpers.

Testing

cargo test
cargo test --features json
cargo fmt --check

Programmatic filter construction needs name-to-number resolution
without enabling the JSON frontend. Always compile the syscall
tables and export get_syscall_nr(name, arch).

Add unit and integration coverage for host and cross-arch lookups.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
@lu-zero
lu-zero force-pushed the pr/get-syscall-nr branch from 91b5b20 to f1584c4 Compare July 18, 2026 12:32
@lu-zero lu-zero changed the title syscall_table: expose get_syscall_nr without the json feature syscall_table: expose get_syscall_nr without json Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant