key_reject_and_link(9)
π NAME π
okay so bestie, welcome to the Kernel API Manual page for key_reject_and_link(9) β the function whose whole job is to negatively instantiate a key and link it into the keyring. no cap, that's literally the name. π
β¨ SYNOPSIS β¨
int key_reject_and_link (struct key *key , unsigned timeout , unsigned
error , struct key *keyring , struct key *authkey );
π ARGUMENTS π
keyβ the key you're instantiating, bestie.timeoutβ the timeout on the negative key.errorβ the error to return when the key is hit.keyringβ keyring to create a link in on success (orNULL).authkeyβ the authorisation token permitting instantiation.
π¦ DESCRIPTION π¦
okay so picture this: you've got a key chilling in the uninstantiated state, and this function negatively instantiates it. if it works, it sets the key's timeout and stored error, and if a destination keyring is supplied, it links the key in there too. the key and any links to it get automatically garbage collected after the timeout expires β the cleanup is automatic, periodt. β¨
negative keys are literally a rate-limit hack for repeated request_key calls: they make those calls return the stored error code β typically ENOKEY β until the negative key expires. it's giving βno, try again laterβ but in kernel. π
if it's successful, 0 is returned, the authorisation token is revoked, and anyone waiting for the key gets woken up. if the key was already instantiated, you get -EBUSY back instead.
heads up: already instantiated? -EBUSY. that's the vibe check, and the key does not pass it. π
π SEE ALSO π
kernel file ./security/keys/key.c and the whole friend group:
key_alloc(9)key_payload_reserve(9)key_instantiate_and_link(9)key_put(9)key_create_or_update(9)key_create(9)key_update(9)key_revoke(9)key_invalidate(9)generic_key_instantiate(9)register_key_type(9)unregister_key_type(9)
okay bye bestie π«Ά this iconic little page came from ./security/keys, dated October 2026, and it's still the key_reject_and_link(9) page β slay. π
π¦ 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