Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Check whether a task can link, unlink, or rmdir a file/directory.

Proto:static int may_link(struct inode *dir, struct dentry *dentry, int kind)

Type:int

Parameter:

TypeParameterName
struct inode *dir
struct dentry *dentry
intkind
1864  sid = get the subjective security ID of the current task
1868  dsec = Get the security label of an inode.
1869  isec = Get the security label of a dentry's backing inode.
1871  type = LSM_AUDIT_DATA_DENTRY
1872  dentry = dentry
1874  av = DIR__SEARCH
1875  av |= If kind Then DIR__REMOVE_NAME Else DIR__ADD_NAME
1876  rc = avc_has_perm - Check permissions and perform any appropriate auditing
1878  If rc Then Return rc
1882  Case kind == MAY_LINK
1883  av = FILE__LINK
1884  Break
1885  Case kind == MAY_UNLINK
1886  av = FILE__UNLINK
1887  Break
1888  Case kind == MAY_RMDIR
1889  av = DIR__RMDIR
1890  Break
1891  Default
1892  pr_warn("SELinux: %s: unrecognized kind %d\n", __func__, kind)
1894  Return 0
1897  rc = avc_has_perm - Check permissions and perform any appropriate auditing
1899  Return rc
Caller
NameDescribe
selinux_inode_link
selinux_inode_unlink
selinux_inode_rmdir