smk_write_rules_list(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… smk_write_rules_list β€” like, the write() for literally any /smack rule file, bestie (kernel API manual, note 9 section, okurrr)

Okay so picture this: you're in the kernel, you're in Smack land, and every single /smack rule file needs a write() handler. This is that handler. It's the one that catches your text and turns it into actual access rules. Slay. πŸŽ€


✨ SYNOPSIS ✨

ssize_t smk_write_rules_list (struct file *file , const char __user *buf
, size_t count , loff_t *ppos , struct list_head *rule_list , struct
mutex *rule_lock , int format );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • file β€” the file pointer. Not actually used. She's just here for the vibes πŸ™ˆ (yes fr, she's decorative).
  • buf β€” where to get the data from. This is your moment, the actual payload.
  • count β€” bytes sent. How much you're giving her.
  • ppos β€” where to start β€” and it must be 0. No partial reads, no games. Zero. Periodt.
  • rule_list β€” the list of rules to write to. The destination, the main character 🫢
  • rule_lock β€” lock for the rule list. Protect her at all costs πŸ”’
  • format β€” which flavour you want: /smack/load or /smack/load2 or /smack/change-rule format.

πŸ’– DESCRIPTION πŸ’–

So the whole job is: get one smack access rule from above πŸ’…. That's it. That's the task. But the formatting? That depends entirely on format, and each one is a different girl:

SMK_LONG_FMT β€” the flexible icon:

"subject<whitespace>object<whitespace>access[<whitespace>...]"

SMK_FIXED24_FMT β€” she is exactly this, no more no less, do not improvise:

"subject                 object rwxat"

SMK_CHANGE_FMT β€” the two-sided queen, enable and disable:

"subject<whitespace>object<whitespace> acc_enable<whitespace>acc_disable[<whitespace>...]"
Lowkey important: <whitespace> means whitespace, and that [<whitespace>...] means the trailing stuff is allowed to just keep going. Don't fight her on it ✨

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./security/smack/smackfs.c β€” go read the source, iykyk πŸ“–. And then the whole extended friend group:

smk_netlabel_audit_set(9), smk_set_access(9), smk_perm_from_str(9), smk_fill_rule(9), smk_parse_rule(9), smk_parse_long_rule(9), smk_open_load(9), smk_write_load(9), smk_cipso_doi(9), smk_unlbl_ambient(9), smk_open_cipso(9), smk_set_cipso(9), smk_write_cipso(9), smk_open_cipso2(9), smk_write_cipso2(9), smk_open_net4addr(9), smk_net4addr_insert(9), smk_write_net4addr(9), smk_open_net6addr(9), smk_net6addr_insert(9), smk_write_net6addr(9), smk_read_doi(9), smk_write_doi(9), smk_read_cipso_auto_level(9), smk_write_cipso_auto_level(9), smk_read_ambient(9), smk_write_ambient(9), smk_list_swap_rcu(9), smk_parse_label_list(9), smk_destroy_label_list(9), smk_write_onlycap(9), smk_read_unconfined(9), smk_write_unconfined(9), smk_read_logging(9), smk_write_logging(9), smk_open_load_self(9), smk_write_load_self(9), smk_user_access(9), smk_write_access(9), smk_open_load2(9), smk_write_load2(9), smk_open_load_self2(9), smk_write_load_self2(9), smk_write_access2(9), smk_write_revoke_subj(9), smk_init_sysfs(9), smk_write_change_rule(9), smk_read_syslog(9), smk_write_syslog(9), smk_open_relabel_self(9), smk_write_relabel_self(9), smk_read_ptrace(9), smk_write_ptrace(9), smk_fill_super(9), smk_get_tree(9), smk_init_fs_context(9), init_smk_fs(9)


That's the whole page, bestie β€” mwah πŸ’‹ Sourced straight from ./security/smack, dated October 2026, and this was smk_write_rules_list(9) in the Kernel API Manual. Go be iconic with your rules πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from