request_key_and_link(9)
π request_key_and_link(9) π
okay so bestie, this is from the Kernel API Manual and it's literally the glow-up guide for requesting a key and caching it in a keyring β no cap, it's giving main character energy for kernel key management ποΈβ¨
β¨ SYNOPSIS β¨
struct key * request_key_and_link (struct key_type *type , const char
*description , struct key_tag *domain_tag , const void *callout_info ,
size_t callout_len , void *aux , struct key *dest_keyring , unsigned
long flags );
π ARGUMENTS π
typeβ the type of key we want, like the vibe check for what kind of key this is πdescriptionβ the searchable description of the key β this is how we find it later, periodtdomain_tagβ the domain in which the key operates, iykyk π¦callout_infoβ the data to pass to the instantiation upcall (orNULL), lowkey the instructions for the upcall π«Άcallout_lenβ the length ofcallout_info, fr fr gotta know how much data we're passingauxβ auxiliary data for the upcall, extra sprinkle on top β¨dest_keyringβ where to cache the key, like its home base πflagsβ flags tokey_alloc, the little settings that matter π
πΈ DESCRIPTION πΈ
okay so here's the tea: a key matching the specified criteria (type, description, domain_tag) is searched for in the process's keyrings. if it's found, it's returned with its usage count incremented β slay! π₯
otherwise, if callout_info is not NULL, a key will be allocated and some service (probably in userspace) will be asked to instantiate it. like, "hey bestie, can you make this key for me?" π
if successfully found or created, the key will be linked to the destination keyring if one is provided. iconic behavior tbh π
Returns a pointer to the key if successful. but bestie, there are so many ways this can go sideways:
-EACCES,-ENOKEY,-EKEYREVOKEDor-EKEYEXPIREDβ if an inaccessible, negative, revoked or expired key was found π¬-ENOKEYβ if no key was found and nocallout_infowas given, literally nothing to work with-EDQUOTβ if insufficient key quota was available to create a new key, the quota said no π-ENOMEMβ if insufficient memory was available, out of brain space
π«Ά important note bestie: if the returned key was created, then it may still be under construction, and wait_for_key_construction should be used to wait for that to complete. don't skip this step, fr fr π
π₯ SEE ALSO π₯
- Kernel file
./security/keys/request_key.cβ that's where the magic lives β¨ complete_request_key(9)β the finisherwait_for_key_construction(9)β the patient bestie who waitsrequest_key_tag(9)β the tag variantrequest_key_with_auxdata(9)β the auxdata variantrequest_key_rcu(9)β the RCU-friendly variant, lowkey fancy π
and that's the whole vibe, bestie! this page is from ./security/keys and it's dated October 2026 β so go forth and request those keys like the icon you are πππ
π¦ 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