您的位置:首页 > 移动开发 > Android开发

SEAndroid中sepolicy/adbd.te策略文件分析

2015-09-18 17:04 567 查看
在adbd.te策略文件中,很明显,定义了一些关于adbd,也就是adb守护进程的一些策略.下面我们先来看一下这个策略源码:

# adbd seclabel is specified in init.rc since
# adbd安全标签是在init.rc中被指定的

# it lives in the rootfs and has no unique file type.
# 他存在于根文件系统中,没有唯一的文件类型。
type adbd, domain;    # 定义adbd类型标识符,其属性集合为domain

permissive adbd;      # 将adbd设置为permissive运行方式,也就是即使出现问题,也不会影响正常的运行,仅仅就是把错误发送给dmesg

unconfined_domain(adbd) # 无约束的域

# 直接调用宏,后面讲解;
# 在这里的作用是:通过执行一个被贴上标志符的文件来自动从旧域转到新域
domain_auto_trans(adbd, shell_exec, shell)

# this is an entrypoint
# 这是一个入口点
allow adbd rootfs:file entrypoint;

# Read /data/misc/adb/adb_keys.
# 读取 /data/misc/adb/adb_keys文件
allow adbd adb_keys_file:dir search;
allow adbd adb_keys_file:file r_file_perms;

# Allow access in case /data/misc/adb still has the old type.
# 当/data/misc/adb依然有旧域的话,也允许访问
allow adbd system_data_file:dir search;
allow adbd system_data_file:file r_file_perms;


总的来说,这里首先是定义了一个域标识符adbd,同时,设置了他的运行模式,也为该域定义了一些策略,允许其自动转换成新域,并且无论是新标志符还是旧标志符都可以访问/data/misc/adb下的文件.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: