audit_log_n_untrustedstring(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ audit_log_n_untrustedstring β€” the Kernel API Manual, bestie edition πŸŽ€

okay so bestie, we're in the Kernel API Manual today and the star of the show is audit_log_n_untrustedstring. no cap, this one's a whole vibe: it's the function you call when the string you're logging is lowkey unhinged and might contain literally anything. 😭


✨ NAME ✨

audit_log_n_untrustedstring β€” log a string that may contain random characters πŸ¦‹

like… random random. we don't trust it and neither should you, that's the whole point of the name iykyk πŸ’…


🌸 SYNOPSIS 🌸

void audit_log_n_untrustedstring (struct audit_buffer *ab , const char
*string , size_t len );

that's it, that's the whole signature. three little args. she's simple but she's doing important work πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • ab β€” an audit_buffer, aka the little vessel your string is gonna get poured into 🫢
  • string β€” the string to be logged (the suspicious one, the main character, the "we don't know what's in here" one) πŸ™ˆ
  • len β€” length of string (not including trailing null), so like, count your chars, don't count the \0 πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea, bestie. this code will escape a string that's passed to it if the string contains any of these:

  • a control character
  • an unprintable character
  • a double quote mark
  • or a space

that's the vibe check list. fail it and you get escaped πŸ’€

now for the aesthetics:

  • Unescaped strings will start and end with a double quote mark β€” so they look all wrapped up and cute, slay ✨
  • Strings that are escaped are printed in hex (2 digits per char) β€” it's giving forensic investigator realness πŸ”₯

and the caller specifies the number of characters in the string to log β€” which may or may not be the entire string. so you're the one deciding how much of the situation we're reporting, and honestly? that's power πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

this is the group chat, and everyone's invited. literally all of them. Kernel file ./kernel/audit.c, struct audit_net(9), struct auditd_connection(9), struct audit_ctl_mutex(9), auditd_test_task(9), audit_ctl_lock(9), audit_ctl_unlock(9), audit_ctl_owner_current(9), auditd_pid_vnr(9), audit_cfg_lsm(9), audit_get_sk(9), audit_log_lost(9), auditd_conn_free(9), auditd_set(9), kauditd_printk_skb(9), kauditd_rehold_skb(9), kauditd_hold_skb(9), kauditd_retry_skb(9), auditd_reset(9), auditd_send_unicast_skb(9), kauditd_send_queue(9), kauditd_thread(9), audit_send_reply(9), audit_receive(9), audit_serial(9), audit_log_start(9), audit_expand(9), audit_log_format(9), audit_log_n_hex(9), audit_string_contains_control(9), audit_log_untrustedstring(9), audit_buffer_aux_new(9), audit_buffer_aux_end(9), audit_log_subj_ctx(9), audit_log_path_denied(9), audit_set_loginuid(9), audit_signal_info(9), __audit_log_end(9), audit_log_end(9), audit_log(9).

that's a lot of friends but every single one of them is iconic, no skips 🌈⭐


ngl bestie, the whole point of this one is trust issues β€” the string is untrusted, so the function sanitises before anything hits your log. your logs stay clean, the vibes stay immaculate. periodt. πŸ’…

and that's the page! this little beauty lives in ./kernel, dated October 2026, and yes she's still filing under audit_log_n_untrustedstring(9) β€” mwah, love that for her πŸŽ€πŸ’–πŸ§š

πŸ“¦ where this page comes from