Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\smack\smack_lsm.c Create Date:2022-07-28 19:24:24
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:smack_key_permission - Smack access on a key*@key_ref: gets to the object*@cred: the credentials to use*@perm: requested key permissions* Return 0 if the task has read and write to the object,* an error code otherwise

Proto:static int smack_key_permission(key_ref_t key_ref, const struct cred *cred, unsigned perm)

Type:int

Parameter:

TypeParameterName
key_ref_tkey_ref
const struct cred *cred
unsignedperm
4248  tkp = Present a pointer to the smack label entry in an task blob.
4249  request = 0
4255  If perm & ~All the above permissions Then Return -EINVAL
4258  keyp = key_ref_to_ptr(key_ref)
4259  If (keyp == NULL) Then Return -EINVAL
4265  If ( security data for this key == NULL) Then Return 0
4270  If (tkp == NULL) Then Return -EACCES
4273  If smack_privileged_cred - are all privilege requirements met by cred*@cap: The requested capability*@cred: the credential to use* Is the task privileged and allowed to be privileged* by the onlycap rule. Then Return 0
4277  some inline functions to set up audit data* they do nothing if CONFIG_AUDIT is not set
4278  key = key serial number
4279  key_desc = description
4281  If perm & ( Require permission to read content | Require permission to search (keyring) or find (key) | Require permission to view attributes ) Then request |= MAY_READ
4283  If perm & ( Require permission to update / modify | Require permission to link | Require permission to change attributes ) Then request |= MAY_WRITE
4285  rc = smk_access(tkp, security data for this key , request, & ad)
4286  rc = smk_bu_note("key access", tkp, security data for this key , request, rc)
4287  Return rc