STRUCT SECCOMP_KADDFD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct seccomp_kaddfd(9) πŸ’…

okay bestie, welcome to the Kernel API Manual ✨ β€” yes, that's the manual name, we're fancy here. no cap. this one's about a lil struct that's basically a little container for seccomp_addfd ioctl messages 🫢

🌸 NAME 🌸

struct seccomp_kaddfd β€” literally just a container for seccomp_addfd ioctl messages, that's her whole job πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

struct seccomp_kaddfd {
    struct file *file;
    int fd;
    unsigned int flags;
    __u32 ioctl_flags;
    union {
      bool setfd;
      int ret;
    };
    struct completion completion;
    struct list_head list;
 };

like, look at her. iconic shape. perfect struct energy πŸ‘‘


πŸŽ€ Members πŸŽ€

  • file β€” a reference to the file that's gonna get installed in the other task πŸ—‚οΈ
  • fd β€” the fd number to install it at, iykyk. but wait β€” if the fd number is -1, that means the installing process should allocate the fd as normal ✨ (so -1 is basically "you pick, king")
  • flags β€” the flags for the new file descriptor. and at the moment, only O_CLOEXEC is allowed, periodt 🚫 no other flags are getting past the bouncer
  • ioctl_flags β€” the flags used for the seccomp_addfd ioctl πŸ’«
  • {unnamed_union} β€” anonymous. she has no name. mysterious. main character energy fr πŸ™ˆ
  • setfd β€” whether or not SECCOMP_ADDFD_FLAG_SETFD was set during notify_addfd ⭐
  • ret β€” the return value of the installing process. it's set to the fd num upon success (>= 0) βœ…
  • completion β€” indicates that the installing process has completed fd installation, or gone away β€” either because of a successful reply, or because of a signal 😭 (she's an angel, she always lets you know)
  • list β€” the list_head for chaining seccomp_kaddfd together πŸ”— gotta link the girls up

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./kernel/seccomp.c β€” go read it, it's giving lore:

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_attach_filter(9), seccomp_set_mode_strict(9), seccomp_set_mode_filter(9), prctl_set_seccomp(9)


okay that's the whole page!! this one came from ./kernel and it's dated October 2026 🌈 so go forth, understand your struct, and slay πŸ’…πŸ’œ 🧚

πŸ“¦ where this page comes from