Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\persistent.c Create Date:2022-07-28 18:26:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Get the persistent keyring for a specific UID and link it to the nominated* keyring.

Proto:static long key_get_persistent(struct user_namespace *ns, kuid_t uid, key_ref_t dest_ref)

Type:long

Parameter:

TypeParameterName
struct user_namespace *ns
kuid_tuid
key_ref_tdest_ref
83  memset( & index_key, 0, size of index_key )
84  type = key_type_keyring
85  description = buf
86  desc_len = sprintf(buf, "_persistent.%u", m_kuid - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid.)
87  Finalise an index key to include a part of the description actually in the* index key, to set the domain tag and to calculate the hash.
89  If Register of per-UID persistent keyrings for this namespace Then
90  reg_ref = make_key_ref( Register of per-UID persistent keyrings for this namespace , true)
91  lock for reading
92  persistent_ref = Search the given keyring for a key that might be updated.* The caller must guarantee that the keyring is a keyring and that the* permission is granted to modify the keyring as no check is made here. The
93  lease a read lock
95  If persistent_ref Then Go to found
102  lock for writing
103  persistent_ref = Create the persistent keyring for the specified user.* Called with the namespace's sem locked for writing.
104  lease a write lock
105  If Not IS_ERR(persistent_ref) Then Go to found
108  Return PTR_ERR(persistent_ref)
110  found :
111  ret = key_task_permission - Check a key can be used*@key_ref: The key to check.*@cred: The credentials to use.*@perm: The permissions to check for.* Check to see whether permission is granted to use a key in the desired way,
112  If ret == 0 Then
113  persistent = key_ref_to_ptr(persistent_ref)
114  ret = key_link - Link a key to a keyring*@keyring: The keyring to make the link in
115  If ret == 0 Then
121  key_ref_put(persistent_ref)
122  Return ret
Caller
NameDescribe
keyctl_get_persistentGet the persistent keyring for a specific UID and link it to the nominated* keyring.