key_task_permission(9)
π NAME π
key_task_permission β check a key can be used. (yes bestie, this is key_task_permission(9) from the Kernel API Manual π«Ά)
β¨ SYNOPSIS β¨
int key_task_permission (const key_ref_t key_ref , const struct cred
*cred , enum key_need_perm need_perm );
π ARGUMENTS π
key_refβ the key you're checking, bestie.credβ the credentials to use.need_permβ the permission you need.
πΈ DESCRIPTION πΈ
okay so key_task_permission checks whether permission is granted to use a key in the desired way β but it lets the security modules override that. π
β οΈ caveat that matters, bestie: the caller must hold either a ref on cred or must hold the RCU readlock. like, actually. do not skip this one.
It returns 0 if successful, and -EACCES if access is denied based on the permissions bits or the LSM check. periodt. π
π¦ SEE ALSO π¦
- Kernel file
./security/keys/permission.c key_validate(9)
later bestie β source ./security/keys, dated October 2026 πβ¨
π¦ 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