函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\process_keys.c Create Date:2022-07-27 19:56:37
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Look up the user and user session keyrings for the current process's UID,* creating them if they don't exist.

函数原型:int look_up_user_keyrings(struct key **_user_keyring, struct key **_user_session_keyring)

返回类型:int

参数:

类型参数名称
struct key **_user_keyring
struct key **_user_session_keyring
77  cred等于current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.()
78  user_ns等于current_user_ns()
82  uid等于from_kuid(user_ns, 进程uid)
86  user_keyring_perm等于KEY_POS_ALL按位与possessor can set key attributes 的反按位或KEY_USR_ALL
88  kenter("%u", uid)
90  reg_keyring等于Get or create a user register keyring.
91  如果是错误则返回:错误
94  lock for writing
95  ret等于0
101  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
102  uid_keyring_r等于keyring_search - Search the supplied keyring tree for a matching key*@keyring: The root of the keyring tree to be searched
104  kdebug("_uid %p", uid_keyring_r)
105  如果uid_keyring_r恒等于错误号
106  uid_keyring等于Allocate a keyring and link into the destination keyring.
111  如果是错误
112  ret等于错误
113  转到:error
115  否则如果是错误
116  ret等于错误
117  转到:error
118  否则
119  uid_keyring等于key_ref_to_ptr(uid_keyring_r)
123  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
124  session_keyring_r等于keyring_search - Search the supplied keyring tree for a matching key*@keyring: The root of the keyring tree to be searched
126  kdebug("_uid_ses %p", session_keyring_r)
127  如果session_keyring_r恒等于错误号
128  session_keyring等于Allocate a keyring and link into the destination keyring.
133  如果是错误
134  ret等于错误
135  转到:error_release
141  ret等于key_link - Link a key to a keyring*@keyring: The keyring to make the link in
142  如果ret小于0则转到:error_release_session
148  ret等于key_link - Link a key to a keyring*@keyring: The keyring to make the link in
149  如果ret小于0则转到:error_release_session
151  否则如果是错误
152  ret等于错误
153  转到:error_release
154  否则
155  session_keyring等于key_ref_to_ptr(session_keyring_r)
158  lease a write lock
160  如果_user_session_keyring_user_session_keyring等于session_keyring
162  否则key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
164  如果_user_keyring_user_keyring等于uid_keyring
166  否则key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
168  kleave(" = 0")
169  返回:0
171  error_release_session :
172  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
173  error_release :
174  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
175  error :
176  lease a write lock
177  kleave(" = %d", ret)
178  返回:ret
调用者
名称描述
lookup_user_keyLook up a key ID given us by userspace with a given permissions mask to get* the key it refers to.* Flags can be passed to request that special keyrings be created if referred* to directly, to permit partially constructed keys to be found and to skip
init_root_keyringMake sure that root's user and user-session keyrings exist.
call_sbin_request_keyRequest userspace finish the construction of a key* - execute "/sbin/request-key "
construct_get_dest_keyringGet the appropriate destination keyring for the request.* The keyring selected is returned with an extra reference upon it which the* caller must release.