Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:inode_doinit_with_dentry

Proto:static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry)

Type:int

Parameter:

TypeParameterName
struct inode *inode
struct dentry *opt_dentry
1433  struct superblock_security_struct * sbsec = NULL
1434  isec = selinux_inode(inode)
1435  sid = 0
1438  rc = 0
1440  If initialization flag == initialized Then Return 0
1443  spin_lock( & lock)
1444  If initialization flag == initialized Then Go to out_unlock
1447  If security class of this object == SECCLASS_FILE Then security class of this object = inode_mode_to_security_class(i_mode)
1450  sbsec = s_security
1451  If Not ( which mount options were specified & Non-mount related flags ) Then
1455  spin_lock( & isec_lock)
1456  If list_empty - tests whether a list is empty*@head: the list to test. Then list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1458  spin_unlock( & isec_lock)
1459  Go to out_unlock
1462  sclass = security class of this object
1463  task_sid = SID of creating task
1464  sid = SID of this object
1465  initialization flag = LABEL_PENDING
1466  spin_unlock( & lock)
1469  Case labeling behavior == use native label support
1470  Break
1471  Case labeling behavior == use xattr
1472  If Not (i_opflags & IOP_XATTR) Then
1474  Break
1478  If opt_dentry Then
1481  Else
1489  If Not dentry Then dentry = d_find_any_alias(inode)
1492  If Not dentry Then
1502  Go to out
1505  rc = inode_doinit_use_xattr(inode, dentry, default SID for labeling , & sid)
1507  dput(dentry)
1508  If rc Then Go to out
1510  Break
1511  Case labeling behavior == use task SIDs, e.g. pipefs/sockfs
1512  sid = task_sid
1513  Break
1514  Case labeling behavior == use transition SIDs, e.g. devpts/tmpfs
1516  sid = SID of file system superblock
1519  rc = security_transition_sid( & selinux_state, task_sid, sid, sclass, NULL, & sid)
1521  If rc Then Go to out
1523  Break
1524  Case labeling behavior == use mountpoint labeling
1525  sid = SECURITY_FS_USE_MNTPOINT context for files
1526  Break
1527  Default
1529  sid = SID of file system superblock
1534  If opt_dentry Then
1538  Else
1556  If Not dentry Then Go to out
1560  If rc Then
1561  dput(dentry)
1562  Go to out
1569  If rc Then
1570  dput(dentry)
1571  Go to out
1574  dput(dentry)
1576  Break
1579  out :
1580  spin_lock( & lock)
1581  If initialization flag == LABEL_PENDING Then
1582  If Not sid || rc Then
1584  Go to out_unlock
1587  initialization flag = initialized
1588  SID of this object = sid
1591  out_unlock :
1592  spin_unlock( & lock)
1593  Return rc
Caller
NameDescribe
__inode_security_revalidateTry reloading inode security labels that have been marked as invalid. The*@may_sleep parameter indicates when sleeping and thus reloading labels is* allowed; when set to false, returns -ECHILD when the label is* invalid
inode_doinit
sb_finish_set_opts
selinux_d_instantiate