Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\keyctl.c Create Date:2022-07-28 18:20:08
Last Modify:2020-03-18 07:59:52 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Read a key's payload

Proto:long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)

Type:long

Parameter:

TypeParameterName
key_serial_tkeyid
char __user *buffer
size_tbuflen
817  key_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
818  If IS_ERR(key_ref) Then
819  ret = -ENOKEY
820  Go to error
823  key = key_ref_to_ptr(key_ref)
825  ret = key_read_state(key)
826  If ret < 0 Then Go to error2
830  ret = Check to see whether permission is granted to use a key in the desired way.
831  If ret == 0 Then Go to can_read_key
833  If ret != -EACCES Then Go to error2
840  If Not is_key_possessed(key_ref) Then
841  ret = -EACCES
842  Go to error2
846  can_read_key :
847  ret = -EOPNOTSUPP
848  If read Then
852  lock for reading
853  ret = key_validate(key)
854  If ret == 0 Then ret = read(key, buffer, buflen)
856  lease a read lock
859  error2 :
860  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
861  error :
862  Return ret
Caller
NameDescribe
SYSCALL_DEFINE5The key control system call
COMPAT_SYSCALL_DEFINE5The key control system call, 32-bit compatibility version for 64-bit archs