query_label(9)
π 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 ofbufqueryβ the binary query string that gets matched against the dfaquery_lenβ size ofqueryview_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
- 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