thread-keyring(7)

๐Ÿ’– thread-keyring(7) โ€” the per-thread keyring, bestie edition ๐Ÿ’–

okay so first of all, this is a page from Miscellaneous Information Manual, section 7, and it's all about thread-keyring โ€” the per-thread keyring. yes it's a whole vibe, yes you're gonna get it, let's go ๐Ÿฆ‹


โœจ NAME โœจ

thread-keyring โ€” per-thread keyring. that's it, that's the name, short and iconic ๐Ÿ’…


๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay bestie, listen. the thread keyring is a keyring used to anchor keys on behalf of a process. that's its whole job. it's giving "designated key-holder of the group chat" energy ๐Ÿ”‘

and the way it shows up? it is created only when a thread requests it. it doesn't just materialize out of nowhere. it's not doing too much. it appears when asked. queen behavior honestly ๐Ÿ‘‘

the thread keyring has the name (description) _tid.

there's also a special serial number value, KEY_SPEC_THREAD_KEYRING, and it's defined so you can use it in lieu of the actual serial number of the calling thread's thread keyring. so like, instead of hunting down the real number, you can just point at it like "yeah that one" ๐Ÿซต

also, from the keyctl(1) utility, '@t' can be used instead of a numeric key ID in much the same way โ€” but heads up, since keyctl(1) is a program that runs after forking, this is of no utility. not me finding the cool shortcut and then immediately finding out it doesn't actually help me ๐Ÿ˜ญ

now the important lore:

  • Thread keyrings are not inherited across clone(2) and fork(2).
  • They are cleared by execve(2).
  • A thread keyring is destroyed when the thread that refers to it terminates.

so no, your thread keyring does not get passed down like a family heirloom, and no, it does not survive exec. it's very much "this is mine, and when I go, it goes" main character energy ๐Ÿ’€

and here's the starting state: initially, a thread does not have a thread keyring. none. zero. empty handed. ๐Ÿ™ˆ

but what happens if a thread doesn't have a thread keyring when it's accessed? two paths:

  • if it is to be modified โ†’ it will be created โœจ
  • otherwise โ†’ the operation fails with the error ENOKEY ๐Ÿšซ

so like, it'll show up if you're actually trying to change something. if you're just poking at it for no reason? ENOKEY. the keyring said "not today" fr fr.


๐ŸŽ€ SEE ALSO ๐ŸŽ€

go read these next, they're all in the same friend group:


and that's the whole page, bestie!! โœจ๐Ÿ’–

this little masterpiece came from Linux man-pages 6.20, dated 2026-02-08 โ€” shoutout to the man-pages girlies, no cap ๐Ÿ™๐Ÿซถ lowkey obsessed with them for keeping the kernel lore documented. now go forth and slay your keyring management ๐ŸŒธ๐Ÿ’…๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: GPL-2.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms