函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\keyctl.c Create Date:2022-07-27 19:54:42
Last Modify:2020-03-18 07:59:52 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Search the specified keyring and any keyrings it links to for a matching* key

函数原型:long keyctl_keyring_search(key_serial_t ringid, const char __user *_type, const char __user *_description, key_serial_t destringid)

返回类型:long

参数:

类型参数名称
key_serial_tringid
const char __user *_type
const char __user *_description
key_serial_tdestringid
727  ret等于key_get_type_from_user(type, _type, type的长度)
728  如果ret小于0则转到:error
731  description等于strndup_user - duplicate an existing string from user space*@s: The string to duplicate*@n: Maximum number of bytes to copy, including the trailing NUL.* Return: newly allocated copy of @s or an ERR_PTR() in case of error
732  如果是错误
733  ret等于错误
734  转到:error
738  keyring_ref等于Look 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
739  如果是错误
740  ret等于错误
741  转到:error2
745  dest_ref = NULL
746  如果destringid
747  dest_ref等于Look 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
749  如果是错误
750  ret等于错误
751  转到:error3
756  ktype等于Find and lock the specified key type against removal.* We return with the sem read-locked if successful. If the type wasn't* available -ENOKEY is returned instead.
757  如果是错误
758  ret等于错误
759  转到:error4
763  key_ref等于keyring_search - Search the supplied keyring tree for a matching key*@keyring: The root of the keyring tree to be searched
764  如果是错误
765  ret等于错误
768  如果ret恒等于负EAGAINret等于负ENOKEY
770  转到:error5
774  如果dest_ref
775  ret等于Check to see whether permission is granted to use a key in the desired way.
776  如果ret小于0则转到:error6
779  ret等于key_link - Link a key to a keyring*@keyring: The keyring to make the link in
780  如果ret小于0则转到:error6
784  ret等于 key serial number
786  error6 :
787  key_ref_put(key_ref)
788  error5 :
789  Unlock a key type locked by key_type_lookup().
790  error4 :
791  key_ref_put(dest_ref)
792  error3 :
793  key_ref_put(keyring_ref)
794  error2 :
795  释放内存
796  error :
797  返回:ret
调用者
名称描述
SYSCALL_DEFINE5The key control system call
COMPAT_SYSCALL_DEFINE5The key control system call, 32-bit compatibility version for 64-bit archs