restrict_link_reject(9)
π restrict_link_reject β Kernel API Manual β¨
okay so bestie, we're in the restrict_link_reject(9) page today and honestly? it's a short one, but it ate. it's a tiny function with one job and zero chill about it. let's get into it π
β¨ NAME β¨
restrict_link_reject β literally just hands you back -EPERM to restrict link. that's it. that's the whole vibe. iconic, lowkey. π
π¦ SYNOPSIS π¦
int restrict_link_reject (struct key *keyring , const struct key_type
*type , const union key_payload *payload , struct key *restriction_key
);
no cap, that's the signature. four args, one int, all business. π«Ά
πΈ ARGUMENTS πΈ
keyringβ the keyring being added to. the destination, the main character of this whole situation πtypeβ the type of key being added. tells you what kind of key is trying to slide in πpayloadβ the payload of the key intended to be added. the actual contents of the wannabe key πrestriction_keyβ keys providing additional data for evaluating restriction. extra context for the restriction logic, iykyk π
π₯ DESCRIPTION π₯
so the whole personality of this function: reject the addition of any links to a keyring. every single one. no exceptions, no "but they're nice keys", nothing gets in. it's giving bouncer-at-the-club energy π
β¨ but β¨ β and this is the important part β it can be overridden by passing KEY_ALLOC_BYPASS_RESTRICTION to key_instantiate_and_link when adding a key to a keyring. so there's a back door, but you gotta know the password. no cap. π
this thing is meant to be stored in a key_restriction structure which is passed in the restrict_link parameter to keyring_alloc. so like, that's where it lives, that's how it gets wired up. periodt. π
ngl bestie, if you're using this you're deliberately locking things down β that's the point, so don't act surprised when links get rejected π
π SEE ALSO π
Kernel file ./security/keys/keyring.c β and the whole friend group:
key_put_tag(9)key_remove_domain(9)keyring_search_rcu(9)keyring_search(9)keyring_restrict(9)key_link(9)key_unlink(9)key_move(9)keyring_clear(9)
go read them, they're all slay in their own way fr fr πβ¨
okay that's the page!! this came out of ./security/keys, dated October 2026, and it's the restrict_link_reject(9) page β Kernel API Manual edition. mwah, love u, go read your kernel source bestie ππ¦π§
π¦ 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