seccomp_attach_filter(9)
π seccomp_attach_filter(9)
okay bestie, welcome to the Kernel API Manual, section 9 β this is the seccomp_attach_filter(9) page and it's short but it's got β¨loreβ¨ so let's get into it π
πΈ NAME πΈ
seccomp_attach_filter β validate and attach filter. that's it. that's the whole vibe check: it checks the filter, then it attaches the filter π«Ά
β¨ SYNOPSIS β¨
long seccomp_attach_filter (unsigned int flags , struct seccomp_filter
*filter );
like literally that's the whole signature, no cap π
π¦ ARGUMENTS π¦
flagsβ flags to change filter behavior. the little knobs that switch up how the filter acts ποΈfilterβ seccomp filter to add to the current process. this is the actual filter being yeeted into your current process π«‘
π DESCRIPTION π
bestie read this part carefully because it's giving prerequisites π
Caller must be holding current->sighand->siglock lock. β not optional, not a suggestion, you literally have to be holding it before you call this. no lock, no service π«
so what does it give back? returns 0 on success, -ve on error, orβ¦ π
- in
TSYNCmode: the pid of a thread which was either not in the correct seccomp mode or did not have an ancestral seccomp filter π₯ - in
NEW_LISTENERmode: the fd of the new listener π
so yeah, "success" isn't always just 0 β sometimes it hands you a pid or an fd and you gotta know which mode you're in. iykyk π€«
π SEE ALSO π
Kernel file ./kernel/seccomp.c and the whole friend group π«Ά
struct seccomp_kaddfd(9)struct notification(9)struct action_cache(9)struct seccomp_filter(9)seccomp_check_filter(9)seccomp_cache_check_allow(9)seccomp_run_filters(9)seccomp_can_sync_threads(9)seccomp_filter_release(9)seccomp_sync_threads(9)seccomp_prepare_filter(9)seccomp_prepare_user_filter(9)seccomp_is_const_allow(9)seccomp_cache_prepare(9)seccomp_set_mode_strict(9)seccomp_set_mode_filter(9)prctl_set_seccomp(9)
and that's the page!! mwah π this one came from the ./kernel source tree, dated October 2026 β go read the other seccomp_* pages too, they all ate π₯ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms