Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Return a description of a key to userspace

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

Type:long

Parameter:

TypeParameterName
key_serial_tkeyid
char __user *buffer
size_tbuflen
654  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
655  If IS_ERR(key_ref) Then
658  If PTR_ERR(key_ref) == -EACCES Then
660  If Not IS_ERR(instkey) Then
670  ret = PTR_ERR(key_ref)
671  Go to error
674  okay :
675  key = key_ref_to_ptr(key_ref)
676  desclen = strlen - Find the length of a string*@s: The string to be sized
679  ret = -ENOMEM
680  infobuf = kasprintf(GFP_KERNEL, "%s;%d;%d;%08x;", name, from_kuid_munged(current_user_ns(), uid), from_kgid_munged(current_user_ns(), gid), access permissions )
686  If Not infobuf Then Go to error2
688  infolen = strlen - Find the length of a string*@s: The string to be sized
689  ret = infolen + desclen + 1
692  If buffer && buflen >= ret Then
693  If copy_to_user(buffer, infobuf, infolen) != 0 || copy_to_user(buffer + infolen, description, desclen + 1) != 0 Then ret = -EFAULT
699  kfree(infobuf)
700  error2 :
701  key_ref_put(key_ref)
702  error :
703  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