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)andfork(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:
keyctl(1)keyctl(3)keyrings(7)persistent-keyring(7)process-keyring(7)session-keyring(7)user-keyring(7)user-session-keyring(7)
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
- Copyright 2014, Red Hat, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms