Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Apply a restriction to a given keyring.* The caller must have Setattr permission to change keyring restrictions.* The requested type name may be a NULL pointer to reject all attempts* to link to the keyring. In this case, _restriction must also be NULL.

Proto:long keyctl_restrict_keyring(key_serial_t id, const char __user *_type, const char __user *_restriction)

Type:long

Parameter:

TypeParameterName
key_serial_tid
const char __user *_type
const char __user *_restriction
1658  char * restriction = NULL
1661  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
1662  If IS_ERR(key_ref) Then Return PTR_ERR(key_ref)
1665  ret = -EINVAL
1666  If _type Then
1667  If Not _restriction Then Go to error
1670  ret = key_get_type_from_user(type, _type, size of type )
1671  If ret < 0 Then Go to error
1674  restriction = 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
1675  If IS_ERR(restriction) Then
1676  ret = PTR_ERR(restriction)
1677  Go to error
1679  Else
1680  If _restriction Then Go to error
1684  ret = keyring_restrict - Look up and apply a restriction to a keyring*@keyring_ref: The keyring to be restricted*@type: The key type that will provide the restriction checker.*@restriction: The restriction options to apply to the keyring
1685  kfree(restriction)
1686  error :
1687  key_ref_put(key_ref)
1688  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