Function report |
Source Code:security\selinux\hooks.c |
Create Date:2022-07-28 18:53:41 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Allow filesystems with binary mount data to explicitly set mount point* labeling information.
Proto:static int selinux_set_mnt_opts(struct super_block *sb, void *mnt_opts, unsigned long kern_flags, unsigned long *set_kern_flags)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct super_block * | sb | |
void * | mnt_opts | |
unsigned long | kern_flags | |
unsigned long * | set_kern_flags |
651 | cred = current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.() |
652 | sbsec = s_security |
656 | fscontext_sid = 0 , context_sid = 0 , rootcontext_sid = 0 |
657 | defcontext_sid = 0 |
658 | rc = 0 |
660 | mutex_lock( & lock) |
662 | If Not initialized Then |
663 | If Not opts Then |
667 | Go to out |
670 | pr_warn("SELinux: Unable to set superblock options before the security server is initialized\n") |
672 | Go to out |
674 | If kern_flags && Not set_kern_flags Then |
692 | If which mount options were specified & Non-mount related flags && fs_flags & FS_BINARY_MOUNTDATA && Not opts Then Go to out |
703 | If opts Then |
704 | If fscontext Then |
705 | rc = parse_sid(sb, fscontext, & fscontext_sid) |
708 | If bad_option(sbsec, FSCONTEXT_MNT, SID of file system superblock , fscontext_sid) Then Go to out_double_mount |
713 | If context Then |
714 | rc = parse_sid(sb, context, & context_sid) |
722 | If rootcontext Then |
723 | rc = parse_sid(sb, rootcontext, & rootcontext_sid) |
726 | If bad_option(sbsec, ROOTCONTEXT_MNT, SID of this object , rootcontext_sid) Then Go to out_double_mount |
731 | If defcontext Then |
732 | rc = parse_sid(sb, defcontext, & defcontext_sid) |
735 | If bad_option(sbsec, DEFCONTEXT_MNT, default SID for labeling , defcontext_sid) Then Go to out_double_mount |
742 | If which mount options were specified & Non-mount related flags Then |
744 | If which mount options were specified & Mask for just the mount related flags && Not opts Then Go to out_double_mount |
746 | rc = 0 |
747 | Go to out |
750 | If strcmp(name, "proc") == 0 Then which mount options were specified |= SE_SBPROC | SE_SBGENFS |
753 | If Not strcmp(name, "debugfs") || Not strcmp(name, "tracefs") || Not strcmp(name, "pstore") Then which mount options were specified |= SE_SBGENFS |
758 | If Not strcmp(name, "sysfs") || Not strcmp(name, "cgroup") || Not strcmp(name, "cgroup2") Then which mount options were specified |= SE_SBGENFS | SE_SBGENFS_XATTR |
763 | If Not labeling behavior Then |
768 | rc = security_fs_use( & selinux_state, sb) |
769 | If rc Then |
781 | If * Owning user namespace and default context in which to * interpret filesystem uids, gids, quotas, device nodes, * xattrs and security labels. != userns count is 1 for root user, 1 for init_uts_ns,* and 1 for... ? && strcmp(name, "tmpfs") && strcmp(name, "ramfs") && strcmp(name, "devpts") Then |
785 | If context_sid || fscontext_sid || rootcontext_sid || defcontext_sid Then |
790 | If labeling behavior == use xattr Then |
800 | Go to out_set_opts |
804 | If fscontext_sid Then |
805 | rc = may_context_mount_sb_relabel(fscontext_sid, sbsec, cred) |
817 | If kern_flags & LSM Agnostic defines for fs_context::lsm_flags && Not context_sid Then |
822 | If context_sid Then |
823 | If Not fscontext_sid Then |
824 | rc = may_context_mount_sb_relabel(context_sid, sbsec, cred) |
829 | Else |
835 | If Not rootcontext_sid Then rootcontext_sid = context_sid |
842 | If rootcontext_sid Then |
852 | If defcontext_sid Then |
853 | If labeling behavior != use xattr && labeling behavior != use native label support Then |
861 | If defcontext_sid != default SID for labeling Then |
871 | out_set_opts : |
872 | rc = sb_finish_set_opts(sb) |
873 | out : |
875 | Return rc |
876 | out_double_mount : |
878 | pr_warn("SELinux: mount invalid. Same superblock, different security settings for (dev %s, type %s)\n", Informational name , name) |
881 | Go to out |
Name | Describe |
---|---|
delayed_superblock_init |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |