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 */
168 return cap_issubset(cred->cap_ambient, in cap_ambient_invariant_ok()
169 cap_intersect(cred->cap_permitted, in cap_ambient_invariant_ok()
170 cred->cap_inheritable)); in cap_ambient_invariant_ok()
175 return rcu_replace_pointer(current->cred, override_cred, 1); in override_creds()
180 return rcu_replace_pointer(current->cred, revert_cred, 1); in revert_creds()
184 * get_cred_many - Get references on a set of credentials
188 * Get references on the specified set of credentials. The caller must release
202 nonconst_cred->non_rcu = 0; in get_cred_many()
203 atomic_long_add(nr, &nonconst_cred->usage); in get_cred_many()
208 * get_cred - Get a reference on a set of credentials
212 * release the reference. If %NULL is passed, it is returned with no action.
226 if (!atomic_long_inc_not_zero(&nonconst_cred->usage)) in get_cred_rcu()
228 nonconst_cred->non_rcu = 0; in get_cred_rcu()
233 * put_cred - Release a reference to a set of credentials
234 * @cred: The credentials to release
235 * @nr: Number of references to release
237 * Release a reference to a set of credentials, deleting them when the last ref
249 if (atomic_long_sub_and_test(nr, &cred->usage)) in put_cred_many()
255 * put_cred - Release a reference to a set of credentials
256 * @cred: The credentials to release
258 * Release a reference to a set of credentials, deleting them when the last ref
267 * current_cred - Access the current task's subjective credentials
269 * Access the subjective credentials of the current task. RCU-safe,
273 rcu_dereference_protected(current->cred, 1)
276 * current_real_cred - Access the current task's objective credentials
278 * Access the objective credentials of the current task. RCU-safe,
282 rcu_dereference_protected(current->real_cred, 1)
285 * __task_cred - Access a task's objective credentials
295 rcu_dereference((task)->real_cred)
298 * get_current_cred - Get the current task's subjective credentials
308 * get_current_user - Get the current task's user_struct
318 __u = get_uid(__cred->user); \
323 * get_current_groups - Get the current task's supplementary group list
333 __groups = get_group_info(__cred->group_info); \
339 __typeof__(((struct cred *)NULL)->xxx) ___val; \
341 ___val = __task_cred((task))->xxx; \
352 current_cred()->xxx; \
382 *(_uid) = __cred->uid; \
383 *(_gid) = __cred->gid; \
390 *(_euid) = __cred->euid; \
391 *(_egid) = __cred->egid; \
398 *(_fsuid) = __cred->fsuid; \
399 *(_fsgid) = __cred->fsgid; \