Android Selinux详解[五]--新增hal服务标签相关

在工作过程中,SElinux常用的有以下几个文件可用于新增标签

可用于加标签的文件名含义对应的声明文件名(一般会声明的地方,根本上放哪里都可以)
file_contexts给 文件/目录/节点 新增标签file.te
genfs_contexts给节点新增标签,与上一个不同的是,不用执行restorecon操作file.te
hwservice_contexts给hal服务新增标签hwservice.te
property_contexts给属性新增标签property.te
seapp_contexts给APP新增标签untrusted_app.te app.te...等等
service_contexts给系统服务新增标签service.te

hwservice在源码中可以看看,主要有如下几种声明类型

hwservice.te - OpenGrok cross reference for /system/sepolicy/public/hwservice.te

type default_android_hwservice, hwservice_manager_type, protected_hwservice;
type fwk_camera_hwservice, hwservice_manager_type, coredomain_hwservice, protected_hwservice;
type fwk_bufferhub_hwservice, hwservice_manager_type, coredomain_hwservice;
type hal_codec2_hwservice, hwservice_manager_type;
type hal_graphics_mapper_hwservice, hwservice_manager_type, same_process_hwservice;

在sepolicy/public/service.te中还有一个neverallow,此neverallow意思为不允许domain对非hwservice_manager_type的hal service进行add find权限

neverallow domain ~hwservice_manager_type:hwservice_manager { add find };

 hwservice用到的几种type解释如下:

type声明类型解释
hwservice_manager_type所有hal服务都需要加此声明
same_process_hwserviceAll HwBinder services guaranteed to be passthrough. These services always run in the process of their clients, and thus operate with the same access as their clients.
 
coredomain_hwserviceAll HwBinder services guaranteed to be offered only by core domain components
protected_hwserviceAll HwBinder services that untrusted apps can't directly access

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值