Lines Matching +full:key +full:- +full:release

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Credentials management - see Documentation/security/credentials.rst
13 #include <linux/key.h>
33 * get_group_info - Get a reference to a group info structure
43 refcount_inc(&gi->usage); in get_group_info()
48 * put_group_info - Release a reference to a group info structure
49 * @group_info: The group info to release
53 if (refcount_dec_and_test(&(group_info)->usage)) \
97 * upon another object, be that a file, a task, a key or whatever.
99 * Note that some members of this structure belong to both categories - the
102 * A task has two security pointers. task->real_cred points to the objective
106 * task->cred points to the subjective context that defines the details of how
109 * same context as task->real_cred.
121 unsigned securebits; /* SUID-less security management */
130 struct key *session_keyring; /* keyring inherited over fork */
131 struct key *process_keyring; /* keyring private to this process */
132 struct key *thread_keyring; /* keyring private to this thread */
133 struct key *request_key_auth; /* assumed request_key authority */
170 return cap_issubset(cred->cap_ambient, in cap_ambient_invariant_ok()
171 cap_intersect(cred->cap_permitted, in cap_ambient_invariant_ok()
172 cred->cap_inheritable)); in cap_ambient_invariant_ok()
176 * get_new_cred_many - Get references on a new set of credentials
181 * release all acquired references.
185 atomic_long_add(nr, &cred->usage); in get_new_cred_many()
190 * get_new_cred - Get a reference on a new set of credentials
194 * release the reference.
202 * get_cred_many - Get references on a set of credentials
206 * Get references on the specified set of credentials. The caller must release
220 nonconst_cred->non_rcu = 0; in get_cred_many()
225 * get_cred - Get a reference on a set of credentials
229 * release the reference. If %NULL is passed, it is returned with no action.
243 if (!atomic_long_inc_not_zero(&nonconst_cred->usage)) in get_cred_rcu()
245 nonconst_cred->non_rcu = 0; in get_cred_rcu()
250 * put_cred - Release a reference to a set of credentials
251 * @cred: The credentials to release
252 * @nr: Number of references to release
254 * Release a reference to a set of credentials, deleting them when the last ref
266 if (atomic_long_sub_and_test(nr, &cred->usage)) in put_cred_many()
272 * put_cred - Release a reference to a set of credentials
273 * @cred: The credentials to release
275 * Release a reference to a set of credentials, deleting them when the last ref
284 * current_cred - Access the current task's subjective credentials
286 * Access the subjective credentials of the current task. RCU-safe,
290 rcu_dereference_protected(current->cred, 1)
293 * current_real_cred - Access the current task's objective credentials
295 * Access the objective credentials of the current task. RCU-safe,
299 rcu_dereference_protected(current->real_cred, 1)
302 * __task_cred - Access a task's objective credentials
312 rcu_dereference((task)->real_cred)
315 * get_current_cred - Get the current task's subjective credentials
325 * get_current_user - Get the current task's user_struct
335 __u = get_uid(__cred->user); \
340 * get_current_groups - Get the current task's supplementary group list
350 __groups = get_group_info(__cred->group_info); \
356 __typeof__(((struct cred *)NULL)->xxx) ___val; \
358 ___val = __task_cred((task))->xxx; \
369 current_cred()->xxx; \
399 *(_uid) = __cred->uid; \
400 *(_gid) = __cred->gid; \
407 *(_euid) = __cred->euid; \
408 *(_egid) = __cred->egid; \
415 *(_fsuid) = __cred->fsuid; \
416 *(_fsgid) = __cred->fsgid; \