key_reject_and_link(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 (or NULL).
  • 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:


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