Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Get a key's the LSM security label.* The key must grant the caller View permission for this to work.* If there's a buffer, then up to buflen bytes of data will be placed into it.* If successful, the amount of information available will be returned,

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

Type:long

Parameter:

TypeParameterName
key_serial_tkeyid
char __user *buffer
size_tbuflen
1495  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
1496  If IS_ERR(key_ref) Then
1497  If PTR_ERR(key_ref) != -EACCES Then Return PTR_ERR(key_ref)
1502  instkey = Search the current process's keyrings for the authorisation key for* instantiation of a key.
1503  If IS_ERR(instkey) Then Return PTR_ERR(instkey)
1505  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
1507  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
1508  If IS_ERR(key_ref) Then Return PTR_ERR(key_ref)
1512  key = key_ref_to_ptr(key_ref)
1513  ret = security_key_getsecurity(key, & context)
1514  If ret == 0 Then
1517  ret = 1
1518  If buffer && buflen > 0 && copy_to_user(buffer, "", 1) != 0 Then ret = -EFAULT
1521  Else if ret > 0 Then
1523  If buffer && buflen > 0 Then
1524  If buflen > ret Then buflen = ret
1527  If copy_to_user(buffer, context, buflen) != 0 Then ret = -EFAULT
1531  kfree(context)
1534  key_ref_put(key_ref)
1535  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