进程的安全上下文----SEAndroid in android 5.x

SEAndroid使用两种方式为进程设置安全上下文
1.为独立进程静态的设置安全上下文
            这和传统的LInux系统很像。android系统中的每个独立进程都对应着一个可执行文件。

            以init为例,查看init进程的启动脚本system/core/rootdir/init.rc,部分内容如下:
on early-init
      ...........
      # Set thesecurity context for the init process.
      # Thisshould occur before anything else (e.g. ueventd) is started.
      setconu:r:init:s0
这一行的作用是让init进程将自己的安全上下文设为u:r:init:s0。
查看external/sepolicy/init.te中,init这个domain的规则:
# init switches to init domain (via init.rc).
type init, domain;
# init is unconfined.
unconfined_domain(init)
tmpfs_domain(init)

allow init self:capability { sys_rawio mknod };
.........
domain_trans(init, rootfs, adbd)
.........
neverallow { domain -kernel} init:process dyntransition;
..........
首先(除注释以外)第一行,type init, domain;声明init具有domain的属性。这样它就可以和u,r一起,组成合法的安全上下文。
第二行unconfined_domain(init)  unconfined_domain是一个宏,定义在external/sepolicy/te_macros文件中,声明init是一个不受限制的domain,它可以访问系统中的大部分资源。宏定义如下:
#####################################
# unconfined_domain(domain)
# Allow the specified domain to perform more privilegedoperations
# than would be typically allowed. Please see the comments atthe
# top of unconfined.te.
#
define(`unconfined_domain', `
typeattribute $1 mlstrustedsubject;
typeattribute $1 unconfineddomain;
')
第三行tmpfs_domain(
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值