Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Instantiate a key with the specified payload and link the key into the* destination keyring if one is given.* The caller must have the appropriate instantiation permit set for this to* work (see keyctl_assume_authority). No other permissions are required.

Proto:long keyctl_instantiate_key_common(key_serial_t id, struct iov_iter *from, key_serial_t ringid)

Type:long

Parameter:

TypeParameterName
key_serial_tid
struct iov_iter *from
key_serial_tringid
1100  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.()
1103  plen = If from Then iov_iter_count(from) Else 0
1107  kenter("%d,,%zu,%d", id, plen, ringid)
1109  If Not plen Then from = NULL
1112  ret = -EINVAL
1113  If plen > 1024 * 1024 - 1 Then Go to error
1118  ret = -EPERM
1119  instkey = assumed request_key authority
1120  If Not instkey Then Go to error
1123  rka = data[0]
1124  If key serial number != id Then Go to error
1128  payload = NULL
1130  If from Then
1131  ret = -ENOMEM
1132  payload = kvmalloc(plen, GFP_KERNEL)
1133  If Not payload Then Go to error
1136  ret = -EFAULT
1137  If Not copy_from_iter_full(payload, plen, from) Then Go to error2
1143  ret = Get the destination keyring for instantiation and check that the caller has* Write permission on it.
1144  If ret < 0 Then Go to error2
1148  ret = key_instantiate_and_link - Instantiate a key and link it into the keyring.*@key: The key to instantiate.*@data: The data to use to instantiate the keyring.*@datalen: The length of @data.*@keyring: Keyring to create a link in on success (or NULL).
1151  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
1155  If ret == 0 Then Change the request_key authorisation key on the current process.
1158  error2 :
1159  If payload Then
1160  memzero_explicit - Fill a region of memory (e
1161  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
1163  error :
1164  Return ret
Caller
NameDescribe
keyctl_instantiate_keyInstantiate a key with the specified payload and link the key into the* destination keyring if one is given.* The caller must have the appropriate instantiation permit set for this to* work (see keyctl_assume_authority). No other permissions are required.
keyctl_instantiate_key_iovInstantiate a key with the specified multipart payload and link the key into* the destination keyring if one is given.* The caller must have the appropriate instantiation permit set for this to* work (see keyctl_assume_authority)
compat_keyctl_instantiate_key_iovInstantiate a key with the specified compatibility multipart payload and* link the key into the destination keyring if one is given.* The caller must have the appropriate instantiation permit set for this to* work (see keyctl_assume_authority)