详解SELinux SID

Intro

SID = Security Identifier (即Security ID)。其作用就是取代安全上下文,在权限匹配时,提升规则搜索速度,以及降低整个策略数据的空间复杂度,提升了整个SELinux特性的性能损耗。
例如一次权限匹配的函数调用原型如下:

int avc_has_perm(struct selinux_state *state, u32 ssid, u32 tsid, u16 tclass,
		 u32 requested, struct common_audit_data *auditdata)

其中ssid, tsid就代表了源(source)SID和目的(target)SID。在最终的av(access vector)计算中,SID被转化为context。

什么是context?
context,即安全上下文,是SELinux的核心概念。形如user_u:role_r:type_t:s0-s1:c0,c1-c255的就是context。其中user字段和role字段用于RBAC,type字段用于TEAC,后面的s0-s1,c1-c255用于mls/mcs。而所有的这些字段,都由策略编译工具生成了整数数据,在SELinux加载策略时一并加载到内存policydb中。

// context定义
struct context {
	u32 user;
	u32 role;
	u32 type;
	u32 len;        /* length of string in bytes */
	struct mls_range range;
	char *str;	/* string representation if context cannot be mapped. */
};
// context加载
static int context_read_and_validate(struct context *c,
				     struct policydb *p,
				     void *fp)
{
    ...
    c->user = le32_to_cpu(buf[0]);
    c->role = le32_to_cpu(buf[1]);
    c->type = le32_to_cpu(buf[2]);
    ...
}

在真正的权限匹配时,SELinux通过SID获取到对应的context,再通过context中的type属性,所搜policydb中相应的hash表找到对应的map array,并获取对应某个权限的一个bit位,来得到权限判定结果。

// 搜索sidtab获取SID对应的context,并用context数据结构来计算权限
void security_compute_av(struct selinux_state *state,
			 u32 ssid,
			 u32 tsid,
			 u16 orig_tclass,
			 struct av_decision *avd,
			 struct extended_perms *xperms)
{
    scontext = sidtab_search(sidtab, ssid);
    ...
    tcontext = sidtab_search(sidtab, tsid);
    ...
    context_struct_compute_av(policydb, scontext, tcontext, tclass, avd,
				  xperms);
    ...
}

// 通过context的type字段从policydb中获取权限数据
static void context_struct_compute_av(struct policydb *policydb,
				      struct context *scontext,
				      struct context *tcontext,
				      u16 tclass,
				      struct av_decision *avd,
				      struct extended_perms *xperms)
{
    ...
    sattr = flex_array_get(policydb->type_attr_map_array,
                   scontext->type - 1);
    tattr = flex_array_get(policydb->type_attr_map_array,
                   tcontext->type - 1);
    ebitmap_for_each_positive_bit(sattr, snode, i) {
        ebitmap_for_each_positive_bit(tattr, tnode, j) {
            ...
            for (node = avtab_search_node(&policydb->te_avtab,
                              &avkey);
                 node;
                 node = avtab_search_node_next(node, avkey.specified)) {
                // Get and assign perm data
            }
            ...
        }
    }
    ...
}

initial SID

initial SID是一种比较特殊的SID。他在策略编译和SELinux启动中都扮演了非常重要的角色。通常在编译policy的时候,需要一些flask文件,例如Fedora refpolicy:

> ls refpolicy-master/policy/flask/
access_vectors   initial_sids     security_classes

其中initial_sids就指定了policy二进制中所有的initial SID。内容如下:

# FLASK

#
# Define initial security identifiers
#

sid kernel
sid security
sid unlabeled
sid fs
sid file
sid file_labels
sid init
sid any_socket
sid port
sid netif
sid netmsg
sid node
sid igmp_packet
sid icmp_socket
sid tcp_socket
sid sysctl_modprobe
sid sysctl
sid sysctl_fs
sid sysctl_kernel
sid sysctl_net
sid sysctl_net_unix
sid sysctl_vm
sid sysctl_dev
sid kmod
sid policy
sid scmp_packet
sid devnull

# FLASK

参考《Building The Sample Policy》中的介绍,这些flask文件的内容将被写到最终的policy二进制文件中(即policy.conf),如下:

notebook-tools/build-sepolicy -o policy.conf -d ../../flask-files

build-sepolicy是一个python的示例程序,他是这样处理flask文件的:

try:
    f = Flask()
    f.parseSids(flask_dir + "/initial_sids")
    f.parseClasses(flask_dir + "/security_classes")
    f.parseVectors(flask_dir + "/access_vectors")

# Open the file and then create the requested policy source file
    of = open(outf, 'w')
    if include == 1:
        of.writelines(f.createPolicyHdr(mode))
        print("Output header file")
    elif cil == 1:
        of.writelines(f.createCilPolicy(mode))
        print("Output CIL policy")
    elif class_perm == 1:
        of.writelines(f.createCilClassPerms(mode))
        print("Output CIL class permission sets")
    elif sids == 1:
        of.writelines(f.createCilInitialSIDS(mode))
        print("Output CIL initial SIDs")
    else:
        of.writelines(f.createPolicy(mode))
        print("Output Kernel Language policy")
    of.close()

可见这些文件的内容,被写入到一个Flask对象中,而该对象的内容最终会被写入策略二进制数据。在后续的策略编译中,这些文件会被checkpolicy来处理。

initial SID的作用
from "SELinux by Example: Using Security Enhanced Linux"
Some objects are labeled via an initial SID early in system initialization, even before the policy is loaded. This labeling behavior is needed, for example, to label objects such as the kernel security server and the root filesystem, which are present in the system before the first policy load. When the policy is eventually loaded, the initial SIDs are then associated with the appropriate security context.
Initial SIDs are also used to prevent objects from having a missing or invalid security context, which would make it impossible for SELinux to correctly enforce access. Instead, SELinux associates these objects with the special unlabeled initial SID. The unlabeled initial SID should have a security context that allows only limited access, thereby preventing inappropriate access until the objects can be relabeled by the administrator or destroyed.
Invalid security contexts most commonly result from loading a new policy that removes users, roles, or types, or changes role or type authorizations. In this situation, the SIDs representing security contexts that use these invalid names or associations will become invalid and are mapped to the unlabeled SID at policy load. Invalid security contexts can also arise when transferring object instances between systems (for example, using removable media). Further, if the objects are created on a non-SELinux system, they will have no associated security context. Regardless of whether the security context is invalid or missing, SELinux will use the unlabeled initial SID on first access to the object as the security context.

总结一下,一共有这几点:

  • 系统启动时,policy尚未加载,也就是所有的context还没被抽象成SID,存储在内存中的policydb里。allow规则也还没加载,这时候,为了保证代码归一,所以需要这些unlabeled SID,在SELinux启动流程中,再具体介绍。
  • 当系统策略变化时,有些role,user或type被删除,导致一些安全上下文失效了,此时这些安全上下文,在策略加载时,会被映射到这些initial SID上。(这里还没找到具体的代码位置)

启动时的使用

init进程在加载策略之前,首先将SELinux的enforcing模式打开。其打开的方式就是往selinuxfs的enforce文件写1。注意此时策略未加载,初始化也未完成。所以策略判断直接取allow。

void security_compute_av(struct selinux_state *state,
			 u32 ssid,
			 u32 tsid,
			 u16 orig_tclass,
			 struct av_decision *avd,
			 struct extended_perms *xperms)
{
	...
	if (!state->initialized)
		goto allow;
    ...
allow:
	avd->allowed = 0xffffffff;
}

但由于用户态的入口是一致的,即启动完成后,用户态可以写同样的enforce文件完成SELinux状态的切换,所以为了判断此时用户态进程是否具有设置的权限,在enforce文件的入口处,对用户态进程权限进行了判定:

length = avc_has_perm(&selinux_state,
                  current_sid(), SECINITSID_SECURITY,
                  SECCLASS_SECURITY, SECURITY__SETENFORCE,
                  NULL);

这里就用到了initial SID - SECINITSID_SECURITY。这里其实已经可以使用selinuxfs的inode.i_security.sid,但由于selinuxfs未通过系统的file open调用,所以无法使用到inode下的SID标签。

系统标签无效时

以socket bind时,对IP地址进行权限判断为例。该权限判断流程大致如下:

PHN2ZyBpZD0iZHdmaXRrZHZ0NGsiIHdpZHRoPSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJtYXgtd2lkdGg6IDI0OS4wNjI1cHg7IiB2aWV3Qm94PSIwIDAgMjQ5LjA2MjUgMzExLjEyNSI+PHN0eWxlPgoKCiNkd2ZpdGtkdnQ0ayAubGFiZWwgewogIGZvbnQtZmFtaWx5OiAndHJlYnVjaGV0IG1zJywgdmVyZGFuYSwgYXJpYWw7CiAgY29sb3I6ICMzMzM7IH0KCiNkd2ZpdGtkdnQ0ayAubm9kZSByZWN0LAojZHdmaXRrZHZ0NGsgLm5vZGUgY2lyY2xlLAojZHdmaXRrZHZ0NGsgLm5vZGUgZWxsaXBzZSwKI2R3Zml0a2R2dDRrIC5ub2RlIHBvbHlnb24gewogIGZpbGw6ICNFQ0VDRkY7CiAgc3Ryb2tlOiAjOTM3MERCOwogIHN0cm9rZS13aWR0aDogMXB4OyB9CgojZHdmaXRrZHZ0NGsgLm5vZGUuY2xpY2thYmxlIHsKICBjdXJzb3I6IHBvaW50ZXI7IH0KCiNkd2ZpdGtkdnQ0ayAuYXJyb3doZWFkUGF0aCB7CiAgZmlsbDogIzMzMzMzMzsgfQoKI2R3Zml0a2R2dDRrIC5lZGdlUGF0aCAucGF0aCB7CiAgc3Ryb2tlOiAjMzMzMzMzOwogIHN0cm9rZS13aWR0aDogMS41cHg7IH0KCiNkd2ZpdGtkdnQ0ayAuZWRnZUxh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zNi41MzEyNSwyOTYuOTg0Mzc1KSI+PHJlY3Qgcng9IjAiIHJ5PSIwIiB4PSItNDkuNTM5MDYyNSIgeT0iLTE4LjE0MDYyNSIgd2lkdGg9Ijk5LjA3ODEyNSIgaGVpZ2h0PSIzNi4yODEyNSI+PC9yZWN0PjxnIGNsYXNzPSJsYWJlbCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwwKSI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM5LjUzOTA2MjUsLTguMTQwNjI1KSI+PHRleHQ+PHRzcGFuIHhtbDpzcGFjZT0icHJlc2VydmUiIGR5PSIxZW0iIHg9IjEiPmF2X2hhc19wZXJtPC90c3Bhbj48L3RleHQ+PC9nPjwvZz48L2c+PC9nPjwvZz48L2c+PC9zdmc+

security_node_sid会从policydb->ocontexts[OCON_NODE]中搜索policydb中关于该IP地址的nodecon定义,如果找不着,说明此IP相关的nodecon无效(未定义),则会走默认的initial SID。

if (c) {
    if (!c->sid[0]) {
        rc = sidtab_context_to_sid(sidtab,
                       &c->context[0],
                       &c->sid[0]);
        if (rc)
            goto out;
    }
    *out_sid = c->sid[0];
} else {
    *out_sid = SECINITSID_NODE; // <===== intial SID
}

其他SID

除了initial SID由内核直接加载生成,其他的SID则由对应的打标签流程生成。例如:文件的SID则由setfiles/restorecon工具打入文件系统的扩展属性上,socket则由socket系统调用创建时生成。
以socket bind为例,因为比较简单。当socket bind系统调用被执行时,一个socket object被绑定到一个node上。而此时该node的SID才被写入policydb中。

int sel_netnode_sid(void *addr, u16 family, u32 *sid)
{
	struct sel_netnode *node;

	rcu_read_lock();
	node = sel_netnode_find(addr, family);
	if (node != NULL) {
		*sid = node->nsec.sid;
		rcu_read_unlock();
		return 0;
	}
	rcu_read_unlock();

	return sel_netnode_sid_slow(addr, family, sid);
}

sel_netnode_sid_slow调用security_node_sid,并最终调用sidtab_context_to_sid将相关的SID以及对应的context数据结构插入到表中。

PHN2ZyBpZD0iZGtkdGdndWVvN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JsYWJlbCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCwwKSI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTQ4LjY0ODQzNzUsLTguMTQwNjI1KSI+PHRleHQ+PHRzcGFuIHhtbDpzcGFjZT0icHJlc2VydmUiIGR5PSIxZW0iIHg9IjEiPnNldCBhbiBpbml0aWFsIFNJRDwvdHNwYW4+PC90ZXh0PjwvZz48L2c+PC9nPjwvZz48L2c+PC9nPjwvc3ZnPg==
  • security_node_sid使用传入的IP地址在policydb中匹配查找context,如果找到则进行下一步,匹配或生成SID,找不到,则直接使用initial SID。
  • sidtab_context_to_sid将context写入sidtab,并获取返回的SID记入policydb中,后续通过context找SID,直接匹配policydb->ocontexts[OCON_NODE];即可。对于SID本身的生成也很简单,就是一个单向增长的整形数字,在sidtab_context_to_sid中。
sid = sidtab_search_context(s, context);
if (sid)
    goto unlock_out;
...
sid = s->next_sid++;
..
ret = sidtab_insert(s, sid, context);

先尝试在sidtab中查找,如果找不到就加一条记录,并为sid赋值。

总结

SID在整个SELinux子系统中的作用就是提升匹配性能(从安全上下文的字符串匹配,降低到整数匹配),所以在整个SELinux子系统生命周期内,SID总是与安全上下文(context)一一对应的。在一次权限匹配过程中,SID的使用如下:

u32 sid;
struct context {
	u32 user;
	u32 role;
	u32 type;
	u32 len;        /* length of string in bytes */
	struct mls_range range;
	char *str;	/* string representation if context cannot be mapped. */
};

相关工具

没有一个专门的工具用来转换SID与context。但libselinux提供了相应的接口,参考sidget(3) - Linux man page

int avc_context_to_sid(security_context_t ctx, security_id_t *sid);
int avc_sid_to_context(security_id_t sid, security_context_t *ctx);

seinfo

  1. 打印所有initial SID
[ben@localhost ~]$ seinfo --initialsid

Initial SIDs: 27
   any_socket
   devnull
   file
   file_labels
   fs
   icmp_socket
   igmp_packet
   init
   kernel
...
  1. 打印selinuxfs context
[ben@localhost ~]$ seinfo --genfscon|grep selinux
   genfscon selinuxfs /  system_u:object_r:security_t:s0

initial_contexts

策略加载后,每个initial SID都有一个对应的context。这些context在各策略模块中定义。这些context在selinuxfs可以查看:

[ben@localhost ~]$ sudo cat /sys/fs/selinux/initial_contexts/kernel
system_u:system_r:kernel_t:s0

参考文献

%5BTOC%5D%0A%23%20Intro%0ASID%20%3D%20Security%20Identifier%20(%E5%8D%B3Security%20ID)%E3%80%82%E5%85%B6%E4%BD%9C%E7%94%A8%E5%B0%B1%E6%98%AF%E5%8F%96%E4%BB%A3%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%8C%E5%9C%A8%E6%9D%83%E9%99%90%E5%8C%B9%E9%85%8D%E6%97%B6%EF%BC%8C%E6%8F%90%E5%8D%87%E8%A7%84%E5%88%99%E6%90%9C%E7%B4%A2%E9%80%9F%E5%BA%A6%EF%BC%8C%E4%BB%A5%E5%8F%8A%E9%99%8D%E4%BD%8E%E6%95%B4%E4%B8%AA%E7%AD%96%E7%95%A5%E6%95%B0%E6%8D%AE%E7%9A%84%E7%A9%BA%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%EF%BC%8C%E6%8F%90%E5%8D%87%E4%BA%86%E6%95%B4%E4%B8%AASELinux%E7%89%B9%E6%80%A7%E7%9A%84%E6%80%A7%E8%83%BD%E6%8D%9F%E8%80%97%E3%80%82%0A%E4%BE%8B%E5%A6%82%E4%B8%80%E6%AC%A1%E6%9D%83%E9%99%90%E5%8C%B9%E9%85%8D%E7%9A%84%E5%87%BD%E6%95%B0%E8%B0%83%E7%94%A8%E5%8E%9F%E5%9E%8B%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%60%60%60c%0Aint%20avc_has_perm(struct%20selinux_state%20*state%2C%20u32%20ssid%2C%20u32%20tsid%2C%20u16%20tclass%2C%0A%09%09%20u32%20requested%2C%20struct%20common_audit_data%20*auditdata)%0A%60%60%60%0A%0A%E5%85%B6%E4%B8%ADssid%2C%20tsid%E5%B0%B1%E4%BB%A3%E8%A1%A8%E4%BA%86%E6%BA%90(source)SID%E5%92%8C%E7%9B%AE%E7%9A%84(target)SID%E3%80%82%E5%9C%A8%E6%9C%80%E7%BB%88%E7%9A%84av(access%20vector)%E8%AE%A1%E7%AE%97%E4%B8%AD%EF%BC%8CSID%E8%A2%AB%E8%BD%AC%E5%8C%96%E4%B8%BAcontext%E3%80%82%0A%3E%20%E4%BB%80%E4%B9%88%E6%98%AFcontext%EF%BC%9F%0A%3E%20context%EF%BC%8C%E5%8D%B3%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%8C%E6%98%AFSELinux%E7%9A%84%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%E3%80%82%E5%BD%A2%E5%A6%82%60user_u%3Arole_r%3Atype_t%3As0-s1%3Ac0%2Cc1-c255%60%E7%9A%84%E5%B0%B1%E6%98%AFcontext%E3%80%82%E5%85%B6%E4%B8%ADuser%E5%AD%97%E6%AE%B5%E5%92%8Crole%E5%AD%97%E6%AE%B5%E7%94%A8%E4%BA%8ERBAC%EF%BC%8Ctype%E5%AD%97%E6%AE%B5%E7%94%A8%E4%BA%8ETEAC%EF%BC%8C%E5%90%8E%E9%9D%A2%E7%9A%84s0-s1%2Cc1-c255%E7%94%A8%E4%BA%8Emls%2Fmcs%E3%80%82%E8%80%8C%E6%89%80%E6%9C%89%E7%9A%84%E8%BF%99%E4%BA%9B%E5%AD%97%E6%AE%B5%EF%BC%8C%E9%83%BD%E7%94%B1%E7%AD%96%E7%95%A5%E7%BC%96%E8%AF%91%E5%B7%A5%E5%85%B7%E7%94%9F%E6%88%90%E4%BA%86%E6%95%B4%E6%95%B0%E6%95%B0%E6%8D%AE%EF%BC%8C%E5%9C%A8SELinux%E5%8A%A0%E8%BD%BD%E7%AD%96%E7%95%A5%E6%97%B6%E4%B8%80%E5%B9%B6%E5%8A%A0%E8%BD%BD%E5%88%B0%E5%86%85%E5%AD%98policydb%E4%B8%AD%E3%80%82%0A%60%60%60c%0A%2F%2F%20context%E5%AE%9A%E4%B9%89%0Astruct%20context%20%7B%0A%09u32%20user%3B%0A%09u32%20role%3B%0A%09u32%20type%3B%0A%09u32%20len%3B%20%20%20%20%20%20%20%20%2F*%20length%20of%20string%20in%20bytes%20*%2F%0A%09struct%20mls_range%20range%3B%0A%09char%20*str%3B%09%2F*%20string%20representation%20if%20context%20cannot%20be%20mapped.%20*%2F%0A%7D%3B%0A%2F%2F%20context%E5%8A%A0%E8%BD%BD%0Astatic%20int%20context_read_and_validate(struct%20context%20*c%2C%0A%09%09%09%09%20%20%20%20%20struct%20policydb%20*p%2C%0A%09%09%09%09%20%20%20%20%20void%20*fp)%0A%7B%0A%20%20%20%20...%0A%20%20%20%20c-%3Euser%20%3D%20le32_to_cpu(buf%5B0%5D)%3B%0A%20%20%20%20c-%3Erole%20%3D%20le32_to_cpu(buf%5B1%5D)%3B%0A%20%20%20%20c-%3Etype%20%3D%20le32_to_cpu(buf%5B2%5D)%3B%0A%20%20%20%20...%0A%7D%0A%60%60%60%0A%0A%E5%9C%A8%E7%9C%9F%E6%AD%A3%E7%9A%84%E6%9D%83%E9%99%90%E5%8C%B9%E9%85%8D%E6%97%B6%EF%BC%8CSELinux%E9%80%9A%E8%BF%87SID%E8%8E%B7%E5%8F%96%E5%88%B0%E5%AF%B9%E5%BA%94%E7%9A%84context%EF%BC%8C%E5%86%8D%E9%80%9A%E8%BF%87context%E4%B8%AD%E7%9A%84type%E5%B1%9E%E6%80%A7%EF%BC%8C%E6%89%80%E6%90%9Cpolicydb%E4%B8%AD%E7%9B%B8%E5%BA%94%E7%9A%84hash%E8%A1%A8%E6%89%BE%E5%88%B0%E5%AF%B9%E5%BA%94%E7%9A%84map%20array%EF%BC%8C%E5%B9%B6%E8%8E%B7%E5%8F%96%E5%AF%B9%E5%BA%94%E6%9F%90%E4%B8%AA%E6%9D%83%E9%99%90%E7%9A%84%E4%B8%80%E4%B8%AAbit%E4%BD%8D%EF%BC%8C%E6%9D%A5%E5%BE%97%E5%88%B0%E6%9D%83%E9%99%90%E5%88%A4%E5%AE%9A%E7%BB%93%E6%9E%9C%E3%80%82%0A%0A%60%60%60c%0A%2F%2F%20%E6%90%9C%E7%B4%A2sidtab%E8%8E%B7%E5%8F%96SID%E5%AF%B9%E5%BA%94%E7%9A%84context%EF%BC%8C%E5%B9%B6%E7%94%A8context%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E6%9D%A5%E8%AE%A1%E7%AE%97%E6%9D%83%E9%99%90%0Avoid%20security_compute_av(struct%20selinux_state%20*state%2C%0A%09%09%09%20u32%20ssid%2C%0A%09%09%09%20u32%20tsid%2C%0A%09%09%09%20u16%20orig_tclass%2C%0A%09%09%09%20struct%20av_decision%20*avd%2C%0A%09%09%09%20struct%20extended_perms%20*xperms)%0A%7B%0A%20%20%20%20scontext%20%3D%20sidtab_search(sidtab%2C%20ssid)%3B%0A%20%20%20%20...%0A%20%20%20%20tcontext%20%3D%20sidtab_search(sidtab%2C%20tsid)%3B%0A%20%20%20%20...%0A%20%20%20%20context_struct_compute_av(policydb%2C%20scontext%2C%20tcontext%2C%20tclass%2C%20avd%2C%0A%09%09%09%09%20%20xperms)%3B%0A%20%20%20%20...%0A%7D%0A%0A%2F%2F%20%E9%80%9A%E8%BF%87context%E7%9A%84type%E5%AD%97%E6%AE%B5%E4%BB%8Epolicydb%E4%B8%AD%E8%8E%B7%E5%8F%96%E6%9D%83%E9%99%90%E6%95%B0%E6%8D%AE%0Astatic%20void%20context_struct_compute_av(struct%20policydb%20*policydb%2C%0A%09%09%09%09%20%20%20%20%20%20struct%20context%20*scontext%2C%0A%09%09%09%09%20%20%20%20%20%20struct%20context%20*tcontext%2C%0A%09%09%09%09%20%20%20%20%20%20u16%20tclass%2C%0A%09%09%09%09%20%20%20%20%20%20struct%20av_decision%20*avd%2C%0A%09%09%09%09%20%20%20%20%20%20struct%20extended_perms%20*xperms)%0A%7B%0A%20%20%20%20...%0A%20%20%20%20sattr%20%3D%20flex_array_get(policydb-%3Etype_attr_map_array%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20scontext-%3Etype%20-%201)%3B%0A%20%20%20%20tattr%20%3D%20flex_array_get(policydb-%3Etype_attr_map_array%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tcontext-%3Etype%20-%201)%3B%0A%20%20%20%20ebitmap_for_each_positive_bit(sattr%2C%20snode%2C%20i)%20%7B%0A%20%20%20%20%20%20%20%20ebitmap_for_each_positive_bit(tattr%2C%20tnode%2C%20j)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20...%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20(node%20%3D%20avtab_search_node(%26policydb-%3Ete_avtab%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26avkey)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20node%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20node%20%3D%20avtab_search_node_next(node%2C%20avkey.specified))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Get%20and%20assign%20perm%20data%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20...%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20...%0A%7D%0A%60%60%60%0A%0A%23%20initial%20SID%0Ainitial%20SID%E6%98%AF%E4%B8%80%E7%A7%8D%E6%AF%94%E8%BE%83%E7%89%B9%E6%AE%8A%E7%9A%84SID%E3%80%82%E4%BB%96%E5%9C%A8%E7%AD%96%E7%95%A5%E7%BC%96%E8%AF%91%E5%92%8CSELinux%E5%90%AF%E5%8A%A8%E4%B8%AD%E9%83%BD%E6%89%AE%E6%BC%94%E4%BA%86%E9%9D%9E%E5%B8%B8%E9%87%8D%E8%A6%81%E7%9A%84%E8%A7%92%E8%89%B2%E3%80%82%E9%80%9A%E5%B8%B8%E5%9C%A8%E7%BC%96%E8%AF%91policy%E7%9A%84%E6%97%B6%E5%80%99%EF%BC%8C%E9%9C%80%E8%A6%81%E4%B8%80%E4%BA%9Bflask%E6%96%87%E4%BB%B6%EF%BC%8C%E4%BE%8B%E5%A6%82Fedora%20refpolicy%EF%BC%9A%0A%0A%60%60%60shell%0A%3E%20ls%20refpolicy-master%2Fpolicy%2Fflask%2F%0Aaccess_vectors%20%20%20initial_sids%20%20%20%20%20security_classes%0A%60%60%60%0A%0A%E5%85%B6%E4%B8%ADinitial_sids%E5%B0%B1%E6%8C%87%E5%AE%9A%E4%BA%86policy%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%AD%E6%89%80%E6%9C%89%E7%9A%84initial%20SID%E3%80%82%E5%86%85%E5%AE%B9%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%0A%60%60%60%0A%23%20FLASK%0A%0A%23%0A%23%20Define%20initial%20security%20identifiers%0A%23%0A%0Asid%20kernel%0Asid%20security%0Asid%20unlabeled%0Asid%20fs%0Asid%20file%0Asid%20file_labels%0Asid%20init%0Asid%20any_socket%0Asid%20port%0Asid%20netif%0Asid%20netmsg%0Asid%20node%0Asid%20igmp_packet%0Asid%20icmp_socket%0Asid%20tcp_socket%0Asid%20sysctl_modprobe%0Asid%20sysctl%0Asid%20sysctl_fs%0Asid%20sysctl_kernel%0Asid%20sysctl_net%0Asid%20sysctl_net_unix%0Asid%20sysctl_vm%0Asid%20sysctl_dev%0Asid%20kmod%0Asid%20policy%0Asid%20scmp_packet%0Asid%20devnull%0A%0A%23%20FLASK%0A%60%60%60%0A%E5%8F%82%E8%80%83%E3%80%8ABuilding%20The%20Sample%20Policy%E3%80%8B%E4%B8%AD%E7%9A%84%E4%BB%8B%E7%BB%8D%EF%BC%8C%E8%BF%99%E4%BA%9Bflask%E6%96%87%E4%BB%B6%E7%9A%84%E5%86%85%E5%AE%B9%E5%B0%86%E8%A2%AB%E5%86%99%E5%88%B0%E6%9C%80%E7%BB%88%E7%9A%84policy%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%96%87%E4%BB%B6%E4%B8%AD%EF%BC%88%E5%8D%B3policy.conf)%2C%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%60%60%60shell%0Anotebook-tools%2Fbuild-sepolicy%20-o%20policy.conf%20-d%20..%2F..%2Fflask-files%0A%60%60%60%0Abuild-sepolicy%E6%98%AF%E4%B8%80%E4%B8%AApython%E7%9A%84%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F%EF%BC%8C%E4%BB%96%E6%98%AF%E8%BF%99%E6%A0%B7%E5%A4%84%E7%90%86flask%E6%96%87%E4%BB%B6%E7%9A%84%3A%0A%60%60%60python%0Atry%3A%0A%20%20%20%20f%20%3D%20Flask()%0A%20%20%20%20f.parseSids(flask_dir%20%2B%20%22%2Finitial_sids%22)%0A%20%20%20%20f.parseClasses(flask_dir%20%2B%20%22%2Fsecurity_classes%22)%0A%20%20%20%20f.parseVectors(flask_dir%20%2B%20%22%2Faccess_vectors%22)%0A%0A%23%20Open%20the%20file%20and%20then%20create%20the%20requested%20policy%20source%20file%0A%20%20%20%20of%20%3D%20open(outf%2C%20'w')%0A%20%20%20%20if%20include%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20of.writelines(f.createPolicyHdr(mode))%0A%20%20%20%20%20%20%20%20print(%22Output%20header%20file%22)%0A%20%20%20%20elif%20cil%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20of.writelines(f.createCilPolicy(mode))%0A%20%20%20%20%20%20%20%20print(%22Output%20CIL%20policy%22)%0A%20%20%20%20elif%20class_perm%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20of.writelines(f.createCilClassPerms(mode))%0A%20%20%20%20%20%20%20%20print(%22Output%20CIL%20class%20permission%20sets%22)%0A%20%20%20%20elif%20sids%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20of.writelines(f.createCilInitialSIDS(mode))%0A%20%20%20%20%20%20%20%20print(%22Output%20CIL%20initial%20SIDs%22)%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20of.writelines(f.createPolicy(mode))%0A%20%20%20%20%20%20%20%20print(%22Output%20Kernel%20Language%20policy%22)%0A%20%20%20%20of.close()%0A%60%60%60%0A%E5%8F%AF%E8%A7%81%E8%BF%99%E4%BA%9B%E6%96%87%E4%BB%B6%E7%9A%84%E5%86%85%E5%AE%B9%EF%BC%8C%E8%A2%AB%E5%86%99%E5%85%A5%E5%88%B0%E4%B8%80%E4%B8%AAFlask%E5%AF%B9%E8%B1%A1%E4%B8%AD%EF%BC%8C%E8%80%8C%E8%AF%A5%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%86%85%E5%AE%B9%E6%9C%80%E7%BB%88%E4%BC%9A%E8%A2%AB%E5%86%99%E5%85%A5%E7%AD%96%E7%95%A5%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%95%B0%E6%8D%AE%E3%80%82%E5%9C%A8%E5%90%8E%E7%BB%AD%E7%9A%84%E7%AD%96%E7%95%A5%E7%BC%96%E8%AF%91%E4%B8%AD%EF%BC%8C%E8%BF%99%E4%BA%9B%E6%96%87%E4%BB%B6%E4%BC%9A%E8%A2%ABcheckpolicy%E6%9D%A5%E5%A4%84%E7%90%86%E3%80%82%0A%3E%20**initial%20SID%E7%9A%84%E4%BD%9C%E7%94%A8**%0A%3E%20*from%20%22SELinux%20by%20Example%3A%20Using%20Security%20Enhanced%20Linux%22*%0A%3E%20Some%20objects%20are%20labeled%20via%20an%20initial%20SID%20early%20in%20system%20initialization%2C%20***even%20before%20the%20policy%20is%20loaded***.%20This%20labeling%20behavior%20is%20needed%2C%20for%20example%2C%20to%20label%20objects%20such%20as%20the%20kernel%20security%20server%20and%20the%20root%20filesystem%2C%20which%20are%20present%20in%20the%20system%20before%20the%20first%20policy%20load.%20***When%20the%20policy%20is%20eventually%20loaded%2C%20the%20initial%20SIDs%20are%20then%20associated%20with%20the%20appropriate%20security%20context***.%0A***Initial%20SIDs%20are%20also%20used%20to%20prevent%20objects%20from%20having%20a%20missing%20or%20invalid%20security%20context%2C%20which%20would%20make%20it%20impossible%20for%20SELinux%20to%20correctly%20enforce%20access***.%20Instead%2C%20SELinux%20associates%20these%20objects%20with%20the%20special%C2%A0unlabeled%C2%A0initial%20SID.%20The%C2%A0unlabeled%C2%A0initial%20SID%20should%20have%20a%20security%20context%20that%20allows%20only%20limited%20access%2C%20thereby%20preventing%20inappropriate%20access%20until%20the%20objects%20can%20be%20relabeled%20by%20the%20administrator%20or%20destroyed.%0AInvalid%20security%20contexts%20most%20commonly%20result%20from%20loading%20a%20new%20policy%20that%20removes%20users%2C%20roles%2C%20or%20types%2C%20or%20changes%20role%20or%20type%20authorizations.%20In%20this%20situation%2C%20the%20***SIDs%20representing%20security%20contexts%20that%20use%20these%20invalid%20names%20or%20associations%20will%20become%20invalid%20and%20are%20mapped%20to%20the%C2%A0unlabeled%C2%A0SID%20at%20policy%20load***.%20Invalid%20security%20contexts%20can%20also%20arise%20when%20transferring%20object%20instances%20between%20systems%20(for%20example%2C%20using%20removable%20media).%20Further%2C%20if%20the%20objects%20are%20created%20on%20a%20non-SELinux%20system%2C%20they%20will%20have%20no%20associated%20security%20context.%20Regardless%20of%20whether%20the%20security%20context%20is%20invalid%20or%20missing%2C%20SELinux%20will%20use%20the%C2%A0unlabeled%C2%A0initial%20SID%20on%20first%20access%20to%20the%20object%20as%20the%20security%20context.%0A%0A%E6%80%BB%E7%BB%93%E4%B8%80%E4%B8%8B%EF%BC%8C%E4%B8%80%E5%85%B1%E6%9C%89%E8%BF%99%E5%87%A0%E7%82%B9%EF%BC%9A%0A-%20%E7%B3%BB%E7%BB%9F%E5%90%AF%E5%8A%A8%E6%97%B6%EF%BC%8Cpolicy%E5%B0%9A%E6%9C%AA%E5%8A%A0%E8%BD%BD%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E6%89%80%E6%9C%89%E7%9A%84context%E8%BF%98%E6%B2%A1%E8%A2%AB%E6%8A%BD%E8%B1%A1%E6%88%90SID%EF%BC%8C%E5%AD%98%E5%82%A8%E5%9C%A8%E5%86%85%E5%AD%98%E4%B8%AD%E7%9A%84policydb%E9%87%8C%E3%80%82allow%E8%A7%84%E5%88%99%E4%B9%9F%E8%BF%98%E6%B2%A1%E5%8A%A0%E8%BD%BD%EF%BC%8C%E8%BF%99%E6%97%B6%E5%80%99%EF%BC%8C%E4%B8%BA%E4%BA%86%E4%BF%9D%E8%AF%81%E4%BB%A3%E7%A0%81%E5%BD%92%E4%B8%80%EF%BC%8C%E6%89%80%E4%BB%A5%E9%9C%80%E8%A6%81%E8%BF%99%E4%BA%9Bunlabeled%20SID%EF%BC%8C%E5%9C%A8SELinux%E5%90%AF%E5%8A%A8%E6%B5%81%E7%A8%8B%E4%B8%AD%EF%BC%8C%E5%86%8D%E5%85%B7%E4%BD%93%E4%BB%8B%E7%BB%8D%E3%80%82%0A-%20%E5%BD%93%E7%B3%BB%E7%BB%9F%E7%AD%96%E7%95%A5%E5%8F%98%E5%8C%96%E6%97%B6%EF%BC%8C%E6%9C%89%E4%BA%9Brole%EF%BC%8Cuser%E6%88%96type%E8%A2%AB%E5%88%A0%E9%99%A4%EF%BC%8C%E5%AF%BC%E8%87%B4%E4%B8%80%E4%BA%9B%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%E5%A4%B1%E6%95%88%E4%BA%86%EF%BC%8C%E6%AD%A4%E6%97%B6%E8%BF%99%E4%BA%9B%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%8C%E5%9C%A8%E7%AD%96%E7%95%A5%E5%8A%A0%E8%BD%BD%E6%97%B6%EF%BC%8C%E4%BC%9A%E8%A2%AB%E6%98%A0%E5%B0%84%E5%88%B0%E8%BF%99%E4%BA%9Binitial%20SID%E4%B8%8A%E3%80%82%EF%BC%88%E8%BF%99%E9%87%8C%E8%BF%98%E6%B2%A1%E6%89%BE%E5%88%B0%E5%85%B7%E4%BD%93%E7%9A%84%E4%BB%A3%E7%A0%81%E4%BD%8D%E7%BD%AE%EF%BC%89%0A%0A%23%23%20%E5%90%AF%E5%8A%A8%E6%97%B6%E7%9A%84%E4%BD%BF%E7%94%A8%0Ainit%E8%BF%9B%E7%A8%8B%E5%9C%A8%E5%8A%A0%E8%BD%BD%E7%AD%96%E7%95%A5%E4%B9%8B%E5%89%8D%EF%BC%8C%E9%A6%96%E5%85%88%E5%B0%86SELinux%E7%9A%84enforcing%E6%A8%A1%E5%BC%8F%E6%89%93%E5%BC%80%E3%80%82%E5%85%B6%E6%89%93%E5%BC%80%E7%9A%84%E6%96%B9%E5%BC%8F%E5%B0%B1%E6%98%AF%E5%BE%80selinuxfs%E7%9A%84enforce%E6%96%87%E4%BB%B6%E5%86%991%E3%80%82%E6%B3%A8%E6%84%8F%E6%AD%A4%E6%97%B6%E7%AD%96%E7%95%A5%E6%9C%AA%E5%8A%A0%E8%BD%BD%EF%BC%8C%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B9%9F%E6%9C%AA%E5%AE%8C%E6%88%90%E3%80%82%E6%89%80%E4%BB%A5%E7%AD%96%E7%95%A5%E5%88%A4%E6%96%AD%E7%9B%B4%E6%8E%A5%E5%8F%96allow%E3%80%82%0A%60%60%60c%0Avoid%20security_compute_av(struct%20selinux_state%20*state%2C%0A%09%09%09%20u32%20ssid%2C%0A%09%09%09%20u32%20tsid%2C%0A%09%09%09%20u16%20orig_tclass%2C%0A%09%09%09%20struct%20av_decision%20*avd%2C%0A%09%09%09%20struct%20extended_perms%20*xperms)%0A%7B%0A%09...%0A%09if%20(!state-%3Einitialized)%0A%09%09goto%20allow%3B%0A%20%20%20%20...%0Aallow%3A%0A%09avd-%3Eallowed%20%3D%200xffffffff%3B%0A%7D%0A%60%60%60%0A%E4%BD%86%E7%94%B1%E4%BA%8E%E7%94%A8%E6%88%B7%E6%80%81%E7%9A%84%E5%85%A5%E5%8F%A3%E6%98%AF%E4%B8%80%E8%87%B4%E7%9A%84%EF%BC%8C%E5%8D%B3%E5%90%AF%E5%8A%A8%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E7%94%A8%E6%88%B7%E6%80%81%E5%8F%AF%E4%BB%A5%E5%86%99%E5%90%8C%E6%A0%B7%E7%9A%84enforce%E6%96%87%E4%BB%B6%E5%AE%8C%E6%88%90SELinux%E7%8A%B6%E6%80%81%E7%9A%84%E5%88%87%E6%8D%A2%EF%BC%8C%E6%89%80%E4%BB%A5%E4%B8%BA%E4%BA%86%E5%88%A4%E6%96%AD%E6%AD%A4%E6%97%B6%E7%94%A8%E6%88%B7%E6%80%81%E8%BF%9B%E7%A8%8B%E6%98%AF%E5%90%A6%E5%85%B7%E6%9C%89%E8%AE%BE%E7%BD%AE%E7%9A%84%E6%9D%83%E9%99%90%EF%BC%8C%E5%9C%A8enforce%E6%96%87%E4%BB%B6%E7%9A%84%E5%85%A5%E5%8F%A3%E5%A4%84%EF%BC%8C%E5%AF%B9%E7%94%A8%E6%88%B7%E6%80%81%E8%BF%9B%E7%A8%8B%E6%9D%83%E9%99%90%E8%BF%9B%E8%A1%8C%E4%BA%86%E5%88%A4%E5%AE%9A%EF%BC%9A%0A%60%60%60c%0Alength%20%3D%20avc_has_perm(%26selinux_state%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20current_sid()%2C%20SECINITSID_SECURITY%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20SECCLASS_SECURITY%2C%20SECURITY__SETENFORCE%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20NULL)%3B%0A%60%60%60%0A%E8%BF%99%E9%87%8C%E5%B0%B1%E7%94%A8%E5%88%B0%E4%BA%86initial%20SID%20-%20%60SECINITSID_SECURITY%60%E3%80%82%E8%BF%99%E9%87%8C%E5%85%B6%E5%AE%9E%E5%B7%B2%E7%BB%8F%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8selinuxfs%E7%9A%84inode.i_security.sid%EF%BC%8C%E4%BD%86%E7%94%B1%E4%BA%8Eselinuxfs%E6%9C%AA%E9%80%9A%E8%BF%87%E7%B3%BB%E7%BB%9F%E7%9A%84file%20open%E8%B0%83%E7%94%A8%EF%BC%8C%E6%89%80%E4%BB%A5%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E5%88%B0inode%E4%B8%8B%E7%9A%84SID%E6%A0%87%E7%AD%BE%E3%80%82%0A%23%23%20%E7%B3%BB%E7%BB%9F%E6%A0%87%E7%AD%BE%E6%97%A0%E6%95%88%E6%97%B6%0A%E4%BB%A5socket%20bind%E6%97%B6%EF%BC%8C%E5%AF%B9IP%E5%9C%B0%E5%9D%80%E8%BF%9B%E8%A1%8C%E6%9D%83%E9%99%90%E5%88%A4%E6%96%AD%E4%B8%BA%E4%BE%8B%E3%80%82%E8%AF%A5%E6%9D%83%E9%99%90%E5%88%A4%E6%96%AD%E6%B5%81%E7%A8%8B%E5%A4%A7%E8%87%B4%E5%A6%82%E4%B8%8B%EF%BC%9A%0A%60%60%60mermaid%0Agraph%20TD%0AA%5B%22selinux_socket_bind%22%5D%0AA%20--%3E%20B%5B%22sock_has_perm(SOCKET__BIND)%22%5D%0AB%20--%3E%20C%5B%22get%20nodecon%20sid%20by%20sel_netnode_sid%22%5D%0AC%20--%3E%20D%5B%22av_has_perm%22%5D%0A%60%60%60%0A%60security_node_sid%60%E4%BC%9A%E4%BB%8E%60policydb-%3Eocontexts%5BOCON_NODE%5D%60%E4%B8%AD%E6%90%9C%E7%B4%A2policydb%E4%B8%AD%E5%85%B3%E4%BA%8E%E8%AF%A5IP%E5%9C%B0%E5%9D%80%E7%9A%84nodecon%E5%AE%9A%E4%B9%89%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%89%BE%E4%B8%8D%E7%9D%80%EF%BC%8C%E8%AF%B4%E6%98%8E%E6%AD%A4IP%E7%9B%B8%E5%85%B3%E7%9A%84nodecon%E6%97%A0%E6%95%88%EF%BC%88%E6%9C%AA%E5%AE%9A%E4%B9%89%EF%BC%89%EF%BC%8C%E5%88%99%E4%BC%9A%E8%B5%B0%E9%BB%98%E8%AE%A4%E7%9A%84initial%20SID%E3%80%82%0A%60%60%60c%0Aif%20(c)%20%7B%0A%20%20%20%20if%20(!c-%3Esid%5B0%5D)%20%7B%0A%20%20%20%20%20%20%20%20rc%20%3D%20sidtab_context_to_sid(sidtab%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26c-%3Econtext%5B0%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26c-%3Esid%5B0%5D)%3B%0A%20%20%20%20%20%20%20%20if%20(rc)%0A%20%20%20%20%20%20%20%20%20%20%20%20goto%20out%3B%0A%20%20%20%20%7D%0A%20%20%20%20*out_sid%20%3D%20c-%3Esid%5B0%5D%3B%0A%7D%20else%20%7B%0A%20%20%20%20*out_sid%20%3D%20SECINITSID_NODE%3B%20%2F%2F%20%3C%3D%3D%3D%3D%3D%20intial%20SID%0A%7D%0A%60%60%60%0A%23%20%E5%85%B6%E4%BB%96SID%0A%E9%99%A4%E4%BA%86initial%20SID%E7%94%B1%E5%86%85%E6%A0%B8%E7%9B%B4%E6%8E%A5%E5%8A%A0%E8%BD%BD%E7%94%9F%E6%88%90%EF%BC%8C%E5%85%B6%E4%BB%96%E7%9A%84SID%E5%88%99%E7%94%B1%E5%AF%B9%E5%BA%94%E7%9A%84%E6%89%93%E6%A0%87%E7%AD%BE%E6%B5%81%E7%A8%8B%E7%94%9F%E6%88%90%E3%80%82%E4%BE%8B%E5%A6%82%EF%BC%9A%E6%96%87%E4%BB%B6%E7%9A%84SID%E5%88%99%E7%94%B1setfiles%2Frestorecon%E5%B7%A5%E5%85%B7%E6%89%93%E5%85%A5%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E7%9A%84%E6%89%A9%E5%B1%95%E5%B1%9E%E6%80%A7%E4%B8%8A%EF%BC%8Csocket%E5%88%99%E7%94%B1socket%E7%B3%BB%E7%BB%9F%E8%B0%83%E7%94%A8%E5%88%9B%E5%BB%BA%E6%97%B6%E7%94%9F%E6%88%90%E3%80%82%0A%E4%BB%A5socket%20bind%E4%B8%BA%E4%BE%8B%EF%BC%8C%E5%9B%A0%E4%B8%BA%E6%AF%94%E8%BE%83%E7%AE%80%E5%8D%95%E3%80%82%E5%BD%93socket%20bind%E7%B3%BB%E7%BB%9F%E8%B0%83%E7%94%A8%E8%A2%AB%E6%89%A7%E8%A1%8C%E6%97%B6%EF%BC%8C%E4%B8%80%E4%B8%AAsocket%20object%E8%A2%AB%E7%BB%91%E5%AE%9A%E5%88%B0%E4%B8%80%E4%B8%AAnode%E4%B8%8A%E3%80%82%E8%80%8C%E6%AD%A4%E6%97%B6%E8%AF%A5node%E7%9A%84SID%E6%89%8D%E8%A2%AB%E5%86%99%E5%85%A5policydb%E4%B8%AD%E3%80%82%0A%60%60%60c%0Aint%20sel_netnode_sid(void%20*addr%2C%20u16%20family%2C%20u32%20*sid)%0A%7B%0A%09struct%20sel_netnode%20*node%3B%0A%0A%09rcu_read_lock()%3B%0A%09node%20%3D%20sel_netnode_find(addr%2C%20family)%3B%0A%09if%20(node%20!%3D%20NULL)%20%7B%0A%09%09*sid%20%3D%20node-%3Ensec.sid%3B%0A%09%09rcu_read_unlock()%3B%0A%09%09return%200%3B%0A%09%7D%0A%09rcu_read_unlock()%3B%0A%0A%09return%20sel_netnode_sid_slow(addr%2C%20family%2C%20sid)%3B%0A%7D%0A%60%60%60%0A%60sel_netnode_sid_slow%60%E8%B0%83%E7%94%A8%60security_node_sid%60%2C%E5%B9%B6%E6%9C%80%E7%BB%88%E8%B0%83%E7%94%A8%60sidtab_context_to_sid%60%E5%B0%86%E7%9B%B8%E5%85%B3%E7%9A%84SID%E4%BB%A5%E5%8F%8A%E5%AF%B9%E5%BA%94%E7%9A%84context%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E6%8F%92%E5%85%A5%E5%88%B0%E8%A1%A8%E4%B8%AD%E3%80%82%0A%60%60%60mermaid%0Agraph%20TD%0AA%5B%22security_node_sid%22%5D%0AA%20--%3E%20B%5B%22search%20policydb-%3Eocontexts%5BOCON_NODE%5D%22%5D%0AB%20--%3E%20C%7B%22find%3F%22%7D%0AC%20--%3E%20%7CN%7C%20B%0AC%20--%3E%20%7CY%7C%20D%5B%22sidtab_context_to_sid(context%EF%BC%8C%26sid)%22%5D%0AD%20--%3E%20E(%22end%22)%0AC%20--%3E%20%7CNever%20find%7C%20F%5B%22set%20an%20initial%20SID%22%5D%0AF%20--%3E%20E%0A%60%60%60%0A-%20%60security_node_sid%60%E4%BD%BF%E7%94%A8%E4%BC%A0%E5%85%A5%E7%9A%84IP%E5%9C%B0%E5%9D%80%E5%9C%A8policydb%E4%B8%AD%E5%8C%B9%E9%85%8D%E6%9F%A5%E6%89%BEcontext%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%89%BE%E5%88%B0%E5%88%99%E8%BF%9B%E8%A1%8C%E4%B8%8B%E4%B8%80%E6%AD%A5%EF%BC%8C%E5%8C%B9%E9%85%8D%E6%88%96%E7%94%9F%E6%88%90SID%EF%BC%8C%E6%89%BE%E4%B8%8D%E5%88%B0%EF%BC%8C%E5%88%99%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8initial%20SID%E3%80%82%0A-%20%60sidtab_context_to_sid%60%E5%B0%86context%E5%86%99%E5%85%A5sidtab%EF%BC%8C%E5%B9%B6%E8%8E%B7%E5%8F%96%E8%BF%94%E5%9B%9E%E7%9A%84SID%E8%AE%B0%E5%85%A5policydb%E4%B8%AD%EF%BC%8C%E5%90%8E%E7%BB%AD%E9%80%9A%E8%BF%87context%E6%89%BESID%EF%BC%8C%E7%9B%B4%E6%8E%A5%E5%8C%B9%E9%85%8D%60policydb-%3Eocontexts%5BOCON_NODE%5D%3B%60%E5%8D%B3%E5%8F%AF%E3%80%82%E5%AF%B9%E4%BA%8ESID%E6%9C%AC%E8%BA%AB%E7%9A%84%E7%94%9F%E6%88%90%E4%B9%9F%E5%BE%88%E7%AE%80%E5%8D%95%EF%BC%8C%E5%B0%B1%E6%98%AF%E4%B8%80%E4%B8%AA%E5%8D%95%E5%90%91%E5%A2%9E%E9%95%BF%E7%9A%84%E6%95%B4%E5%BD%A2%E6%95%B0%E5%AD%97%EF%BC%8C%E5%9C%A8%60sidtab_context_to_sid%60%E4%B8%AD%E3%80%82%0A%60%60%60c%0Asid%20%3D%20sidtab_search_context(s%2C%20context)%3B%0Aif%20(sid)%0A%20%20%20%20goto%20unlock_out%3B%0A...%0Asid%20%3D%20s-%3Enext_sid%2B%2B%3B%0A..%0Aret%20%3D%20sidtab_insert(s%2C%20sid%2C%20context)%3B%0A%60%60%60%0A%E5%85%88%E5%B0%9D%E8%AF%95%E5%9C%A8sidtab%E4%B8%AD%E6%9F%A5%E6%89%BE%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%89%BE%E4%B8%8D%E5%88%B0%E5%B0%B1%E5%8A%A0%E4%B8%80%E6%9D%A1%E8%AE%B0%E5%BD%95%EF%BC%8C%E5%B9%B6%E4%B8%BAsid%E8%B5%8B%E5%80%BC%E3%80%82%0A%23%20%E6%80%BB%E7%BB%93%0ASID%E5%9C%A8%E6%95%B4%E4%B8%AASELinux%E5%AD%90%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84%E4%BD%9C%E7%94%A8%E5%B0%B1%E6%98%AF%E6%8F%90%E5%8D%87%E5%8C%B9%E9%85%8D%E6%80%A7%E8%83%BD%EF%BC%88%E4%BB%8E%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%8C%B9%E9%85%8D%EF%BC%8C%E9%99%8D%E4%BD%8E%E5%88%B0%E6%95%B4%E6%95%B0%E5%8C%B9%E9%85%8D%EF%BC%89%2C%E6%89%80%E4%BB%A5%E5%9C%A8%E6%95%B4%E4%B8%AASELinux%E5%AD%90%E7%B3%BB%E7%BB%9F%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E5%86%85%EF%BC%8CSID%E6%80%BB%E6%98%AF%E4%B8%8E%E5%AE%89%E5%85%A8%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%88context%EF%BC%89%E4%B8%80%E4%B8%80%E5%AF%B9%E5%BA%94%E7%9A%84%E3%80%82%E5%9C%A8%E4%B8%80%E6%AC%A1%E6%9D%83%E9%99%90%E5%8C%B9%E9%85%8D%E8%BF%87%E7%A8%8B%E4%B8%AD%EF%BC%8CSID%E7%9A%84%E4%BD%BF%E7%94%A8%E5%A6%82%E4%B8%8B%EF%BC%9A%0A!%5B7fe0cdf2b84938b1e0610fe99bd3c917.png%5D(evernotecid%3A%2F%2F22617523-9521-4D00-B771-5F27B85F00EB%2Fappyinxiangcom%2F161681%2FENResource%2Fp6448)%0Acontext%E5%92%8CSID%E7%9A%84%E5%AE%9A%E4%B9%89%E5%88%86%E5%88%AB%E4%B8%BA%EF%BC%9A%0A%60%60%60c%0Au32%20sid%3B%0Astruct%20context%20%7B%0A%09u32%20user%3B%0A%09u32%20role%3B%0A%09u32%20type%3B%0A%09u32%20len%3B%20%20%20%20%20%20%20%20%2F*%20length%20of%20string%20in%20bytes%20*%2F%0A%09struct%20mls_range%20range%3B%0A%09char%20*str%3B%09%2F*%20string%20representation%20if%20context%20cannot%20be%20mapped.%20*%2F%0A%7D%3B%0A%0A%60%60%60%0A%23%20%E7%9B%B8%E5%85%B3%E5%B7%A5%E5%85%B7%0A%E6%B2%A1%E6%9C%89%E4%B8%80%E4%B8%AA%E4%B8%93%E9%97%A8%E7%9A%84%E5%B7%A5%E5%85%B7%E7%94%A8%E6%9D%A5%E8%BD%AC%E6%8D%A2SID%E4%B8%8Econtext%E3%80%82%E4%BD%86libselinux%E6%8F%90%E4%BE%9B%E4%BA%86%E7%9B%B8%E5%BA%94%E7%9A%84%E6%8E%A5%E5%8F%A3%EF%BC%8C%E5%8F%82%E8%80%83%5Bsidget(3)%20-%20Linux%20man%20page%5D(https%3A%2F%2Flinux.die.net%2Fman%2F3%2Fsidget)%E3%80%82%0A%60%60%60c%0Aint%20avc_context_to_sid(security_context_t%20ctx%2C%20security_id_t%20*sid)%3B%0Aint%20avc_sid_to_context(security_id_t%20sid%2C%20security_context_t%20*ctx)%3B%0A%60%60%60%0A%23%23%20seinfo%0A1.%20%E6%89%93%E5%8D%B0%E6%89%80%E6%9C%89initial%20SID%0A%60%60%60shell%0A%5Bben%40localhost%20~%5D%24%20seinfo%20--initialsid%0A%0AInitial%20SIDs%3A%2027%0A%20%20%20any_socket%0A%20%20%20devnull%0A%20%20%20file%0A%20%20%20file_labels%0A%20%20%20fs%0A%20%20%20icmp_socket%0A%20%20%20igmp_packet%0A%20%20%20init%0A%20%20%20kernel%0A...%0A%60%60%60%0A2.%20%E6%89%93%E5%8D%B0selinuxfs%20context%0A%60%60%60shell%0A%5Bben%40localhost%20~%5D%24%20seinfo%20--genfscon%7Cgrep%20selinux%0A%20%20%20genfscon%20selinuxfs%20%2F%20%20system_u%3Aobject_r%3Asecurity_t%3As0%0A%60%60%60%0A%23%23%20initial_contexts%0A%E7%AD%96%E7%95%A5%E5%8A%A0%E8%BD%BD%E5%90%8E%EF%BC%8C%E6%AF%8F%E4%B8%AAinitial%20SID%E9%83%BD%E6%9C%89%E4%B8%80%E4%B8%AA%E5%AF%B9%E5%BA%94%E7%9A%84context%E3%80%82%E8%BF%99%E4%BA%9Bcontext%E5%9C%A8%E5%90%84%E7%AD%96%E7%95%A5%E6%A8%A1%E5%9D%97%E4%B8%AD%E5%AE%9A%E4%B9%89%E3%80%82%E8%BF%99%E4%BA%9Bcontext%E5%9C%A8selinuxfs%E5%8F%AF%E4%BB%A5%E6%9F%A5%E7%9C%8B%EF%BC%9A%0A%60%60%60shell%0A%5Bben%40localhost%20~%5D%24%20sudo%20cat%20%2Fsys%2Ffs%2Fselinux%2Finitial_contexts%2Fkernel%0Asystem_u%3Asystem_r%3Akernel_t%3As0%0A%60%60%60%0A%23%20%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%0A-%20%5BFedora%20refpolicy%5D(https%3A%2F%2Fgithub.com%2Ffedora-selinux%2Fselinux-policy)%0A-%20Frank%20Mayer%2C%20Karl%20MacMillan%2C%20David%20Caplan%EF%BC%8C%20July%2027%2C%202006-%20%E2%80%9CSELinux%20by%20Example%3A%20Using%20Security%20Enhanced%20Linux%E2%80%9D%0A-%20SELinux%E5%AE%98%E6%96%B9%E6%95%99%E6%9D%90%EF%BC%8C%22%5BThe%20SELinux%20Notebook%5D(https%3A%2F%2Fgithub.com%2FSELinuxProject%2Fselinux-notebook)%22%20Volume%20II%2C%20Building%20The%20Sample%20Policy%0A-%20SELinux%E5%AE%98%E6%96%B9%E6%95%99%E6%9D%90%EF%BC%8C%22%5BThe%20SELinux%20Notebook%204th%20Edition%5D(https%3A%2F%2Fgithub.com%2FSELinuxProject%2Fselinux-notebook)%22