query_label(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… query_label(9)

okay so this is query_label, from the Kernel API Manual β€” yes bestie, we're in kernel land today, and this little function is out here querying a label and writing permissions straight into buf. iconic behavior honestly.


✨ NAME ✨

query_label β€” queries a label and writes permissions to buf


🌸 SYNOPSIS 🌸

ssize_t query_label (char *buf , size_t buf_len , char *query , size_t
query_len , bool view_only );

πŸŽ€ ARGUMENTS πŸŽ€

  • buf β€” the resulting permissions string gets stored here. it is NOT NULL, like do not even try it 🫢
  • buf_len β€” size of buf
  • query β€” the binary query string that gets matched against the dfa
  • query_len β€” size of query
  • view_only β€” only compute for the querier's view

πŸ¦‹ DESCRIPTION πŸ¦‹

the buffers pointed to by buf and query may overlap β€” lowkey wild but true. the query buffer gets parsed before buf is written to, so it all works out ✨

the query should look like "LABEL_NAME DFA_STRING" where LABEL_NAME is the name of the label, in the current namespace, that is to be queried, and DFA_STRING is a binary string to match against the label(s)'s DFA. the way it's giving very structured πŸ’…

LABEL_NAME must be NUL terminated. DFA_STRING may contain NUL characters but must *not* be NUL terminated.

no cap bestie, that NUL rule is the opposite way round for the two of them β€” don't mix it up 😭

πŸ”₯ RETURN πŸ”₯

number of characters written to buf, or -errno on failure


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./security/apparmor/apparmorfs.c β€” plus the whole friend group: mangle_name(9), __aafs_setup_d_inode(9), aafs_create(9), aafs_create_file(9), aafs_create_dir(9), aafs_remove(9), aa_simple_write_to_buffer(9), aa_get_data_from_compressed(9), query_data(9), aa_write_access(9), __next_ns(9), __first_profile(9), __next_profile(9), next_profile(9), p_start(9), p_next(9), p_stop(9), seq_show_profile(9), entry_create_file(9), entry_create_dir(9), entry_remove_file(9), entry_remove_dir(9), aa_destroy_aafs(9), aa_create_aafs(9)


and that's the whole page, bestie 🧚 this one's brought to you by the source ./security/apparmor, dated October 2026 β€” periodt πŸ’–

πŸ“¦ where this page comes from