我一直在关注SEAndroid,并且一直试图了解进程域是如何给出的。
到目前为止,我得到的是,在init.rc文件中,在一些服务声明下,有一个名为seclabel的令牌:
service adbd /sbin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0稍后在init.c中,setexeccon将其设置为所编写的上下文:
if (svc->seclabel) {
if (is_selinux_enabled() > 0 && setexeccon(svc->seclabel) < 0) {
ERROR("cannot setexeccon('%s'): %s\n", svc->seclabel, strerror(errno));
_exit(127);
}
}在上面的例子中,域将是adbd。
但是,当服务声明中没有分段标记时,我没有发现会发生什么。在init.c中发生的事情是它不会调用setexeccon,意思是..保留父母的域名?
打电话给:
ps -Z在显示所有进程及其域的亚行shell中,则显示为相反。
For example, the servicemanager in init.rc:
class core
user system
group system
critical
onrestart restart healthd
onrestart restart zygote
onrestart restart media
onrestart restart surfaceflinger
onrestart restart drm但是,调用ps -Z显示:
u:r:servicemanager:s0 system 53 1 /system/bin/servicemanager怎么回事?!
发布于 2014-12-01 07:08:13
好的,我看了代码,终于得到了答案!
在android映像中的根文件系统上找到的文件:/外部/sepolicy/seapp_ root包含以下内容:
isSystemServer=true domain=system_server
user=system domain=system_app type=system_app_data_file
user=bluetooth domain=bluetooth type=bluetooth_data_file
user=nfc domain=nfc type=nfc_data_file
user=radio domain=radio type=radio_data_file
user=shared_relro domain=shared_relro
user=shell domain=shell type=shell_data_file
user=_isolated domain=isolated_app levelFrom=user
user=_app seinfo=platform domain=platform_app type=app_data_file levelFrom=user
user=_app domain=untrusted_app type=app_data_file levelFrom=user这根据一些输入定义每个进程的安全设置(输出)。在这个例子中,我们可以在第一行看到:
如果是系统服务器,则其域为system_server。
或者在最后一行:
_app关键字代表每个没有关联规则的应用程序。因此,默认情况下,应用程序域将是untrusted_app,属于它的文件标签将是app_data_file。
有关文件语法的更多文档可以在文件中找到。
https://stackoverflow.com/questions/26846452
复制相似问题