Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:selinux_sb_clone_mnt_opts

Proto:static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb, struct super_block *newsb, unsigned long kern_flags, unsigned long *set_kern_flags)

Type:int

Parameter:

TypeParameterName
const struct super_block *oldsb
struct super_block *newsb
unsigned longkern_flags
unsigned long *set_kern_flags
919  rc = 0
920  oldsbsec = s_security
921  newsbsec = s_security
923  set_fscontext = which mount options were specified & FSCONTEXT_MNT
924  set_context = which mount options were specified & BE CAREFUL, these need to be the low order bits for selinux_get_mnt_opts
925  set_rootcontext = which mount options were specified & ROOTCONTEXT_MNT
931  If Not initialized Then Return 0
938  If kern_flags && Not set_kern_flags Then Return -EINVAL
942  BUG_ON(!( which mount options were specified & Non-mount related flags ))
945  If which mount options were specified & Non-mount related flags Then
946  If kern_flags & LSM Agnostic defines for fs_context::lsm_flags && Not set_context Then set_kern_flags |= LSM Agnostic defines for fs_context::lsm_flags
948  Return selinux_cmp_sb_context(oldsb, newsb)
951  mutex_lock( & lock)
953  which mount options were specified = which mount options were specified
955  SID of file system superblock = SID of file system superblock
956  default SID for labeling = default SID for labeling
957  labeling behavior = labeling behavior
959  If labeling behavior == use native label support && Not (kern_flags & LSM Agnostic defines for fs_context::lsm_flags ) && Not set_context Then
961  rc = security_fs_use( & selinux_state, newsb)
962  If rc Then Go to out
966  If kern_flags & LSM Agnostic defines for fs_context::lsm_flags && Not set_context Then
967  labeling behavior = use native label support
968  set_kern_flags |= LSM Agnostic defines for fs_context::lsm_flags
971  If set_context Then
972  sid = SECURITY_FS_USE_MNTPOINT context for files
974  If Not set_fscontext Then SID of file system superblock = sid
976  If Not set_rootcontext Then
980  SECURITY_FS_USE_MNTPOINT context for files = sid
982  If set_rootcontext Then
983  oldisec = Get the security label of a dentry's backing inode.
984  newisec = Get the security label of a dentry's backing inode.
986  SID of this object = SID of this object
989  sb_finish_set_opts(newsb)
990  out :
991  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
992  Return rc