Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:inode_doinit_use_xattr

Proto:static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry, unsigned int def_sid, unsigned int *sid)

Type:int

Parameter:

TypeParameterName
struct inode *inode
struct dentry *dentry
unsigned intdef_sid
unsigned int *sid
1377  len = INITCONTEXTLEN
1378  context = Allocation memory
1379  If Not context Then Return -ENOMEM
1382  context[len] = '\0'
1383  rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len)
1384  If rc == -ERANGE Then
1385  kfree(context)
1388  rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, NULL, 0)
1389  If rc < 0 Then Return rc
1392  len = rc
1393  context = Allocation memory
1394  If Not context Then Return -ENOMEM
1397  context[len] = '\0'
1398  rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len)
1401  If rc < 0 Then
1402  kfree(context)
1403  If rc != -ENODATA Then
1404  pr_warn("SELinux: %s: getxattr returned %d for dev=%s ino=%ld\n", __func__, - rc, s_id, Stat data, not accessed from path walking )
1406  Return rc
1408  sid = def_sid
1409  Return 0
1412  rc = security_context_to_sid_default( & selinux_state, context, rc, sid, def_sid, GFP_NOFS)
1414  If rc Then
1415  dev = s_id
1416  ino = Stat data, not accessed from path walking
1418  If rc == -EINVAL Then
1419  pr_notice_ratelimited("SELinux: inode=%lu on dev=%s was found to have an invalid context=%s. This indicates you may need to relabel the inode or the filesystem in question.\n", ino, dev, context)
1421  Else
1422  pr_warn("SELinux: %s: context_to_sid(%s) returned %d for dev=%s ino=%ld\n", __func__, context, - rc, dev, ino)
1426  kfree(context)
1427  Return 0
Caller
NameDescribe
inode_doinit_with_dentry