key_task_permission(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 πŸ¦‹


later bestie β€” source ./security/keys, dated October 2026 πŸ’–βœ¨

πŸ“¦ where this page comes from