Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\xattr.c Create Date:2022-07-28 20:09:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Check permissions for extended attribute access. This is a bit complicated* because different namespaces have very different rules.

Proto:static int xattr_permission(struct inode *inode, const char *name, int mask)

Type:int

Parameter:

TypeParameterName
struct inode *inode
const char *name
intmask
92  If mask & MAY_WRITE Then
93  If IS_IMMUTABLE(inode) || IS_APPEND(inode) Then Return -EPERM
100  If HAS_UNMAPPED_ID(inode) Then Return -EPERM
108  If Not strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) || Not strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) Then Return 0
115  If Not strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) Then
116  If Not Check operation authority Then Return If mask & MAY_WRITE Then -EPERM Else -ENODATA
118  Return 0
126  If Not strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) Then
127  If Not S_ISREG(i_mode) && Not S_ISDIR(i_mode) Then Return If mask & MAY_WRITE Then -EPERM Else -ENODATA
129  If S_ISDIR(i_mode) && i_mode & S_ISVTX && mask & MAY_WRITE && Not de_owner_or_capable - check current task permissions to inode*@inode: inode being checked* Return true if current either has CAP_FOWNER in a namespace with the* inode owner uid mapped, or owns the file. Then Return -EPERM
134  Return de_permission - Check for access rights to a given inode*@inode: Inode to check permission on*@mask: Right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)* Check for read/write/execute permissions on an inode
Caller
NameDescribe
vfs_setxattr
vfs_getxattr_allocvfs_getxattr_alloc - allocate memory, if necessary, before calling getxattr* Allocate memory, if not already allocated, or re-allocate correct size,* before retrieving the extended attribute.
vfs_getxattr
vfs_removexattr