AndroidQ(10.0) system app 增加访问 sys/class/ 权限

简介: AndroidQ(10.0) system app 增加访问 sys/class/ 权限

问题由来


System app 需要读取网卡地址,而网卡地址存储在 sys/class/net/eth0/address


所以通过 cat sys/class/net/eth0/address 就能获取设备网卡地址


但是安全等级越来越高,


1|HTC5K:/ $ cat sys/class/net/eth0/address


cat: sys/class/net/eth0/address: Permission denied


HTC5K:/ $ ifconfig


ifconfig: ioctl 8927: Permission denied


avc: denied { search } for name=“net” dev=“sysfs” ino=12684 scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs_net:s0 tclass=dir permissive=0


avc: denied { read } for name=“address” dev=“sysfs” ino=25277 scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0


avc: denied { open } for path="/sys/devices/platform/1100a000.spi/spi_master/spi32766/spi32766.0/net/eth0/address" dev=“sysfs” ino=25277 scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0


增加权限


device/mediatek/sepolicy/basic/non_plat/system_app.te


 allow system_app self:netlink_kobject_uevent_socket {read bind create setopt };
 # system_app need to read from sysfs /sys/class/switch/hdmi/state
 r_dir_file(system_app, sysfs_switch);
+allow system_app sysfs_net:dir { search read };
+allow system_app sysfs:file { open read };

编译报错


libsepol.report_failure: neverallow on line 91 of system/sepolicy/private/coredomain.te (or line 32781 of policy.conf) violated by allow system_app sysfs:file { read open };

libsepol.check_assertions: 1 neverallow failures occurred

Error while expanding policy


修改忽略规则


system/sepolicy/private/coredomain.te

system/sepolicy/prebuilts/api/29.0/private/coredomain.te

@@ -102,6 +102,7 @@ full_treble_only(`
     -init
     -ueventd
     -vold
+    -system_app
   } sysfs:file no_rw_file_perms;
   # /dev


目录
相关文章
|
6月前
|
Java Linux
【Azure 应用服务】部署WAR包到App Service访问出现404错误的解决方式
【Azure 应用服务】部署WAR包到App Service访问出现404错误的解决方式
|
1月前
|
Windows
【Azure App Service】对App Service中CPU指标数据中系统占用部分(System CPU)的解释
在Azure App Service中,CPU占比可在App Service Plan级别查看整个实例的资源使用情况。具体应用中仅能查看CPU时间,需通过公式【CPU Time / (CPU核数 * 60)】估算占比。CPU百分比适用于可横向扩展的计划(Basic、Standard、Premium),而CPU时间适用于Free或Shared计划。然而,CPU Percentage包含所有应用及系统占用的CPU,高CPU指标可能由系统而非应用请求引起。详细分析每个进程的CPU占用需抓取Windows Performance Trace数据。
89 40
|
6月前
|
JSON API 开发工具
【Azure 应用服务】调用Azure REST API来获取 App Service的访问限制信息(Access Restrictions)以及修改
【Azure 应用服务】调用Azure REST API来获取 App Service的访问限制信息(Access Restrictions)以及修改
|
2月前
|
存储 监控 API
app开发之安卓Android+苹果ios打包所有权限对应解释列表【长期更新】-以及默认打包自动添加权限列表和简化后的基本打包权限列表以uniapp为例-优雅草央千澈
app开发之安卓Android+苹果ios打包所有权限对应解释列表【长期更新】-以及默认打包自动添加权限列表和简化后的基本打包权限列表以uniapp为例-优雅草央千澈
87 11
|
3月前
【Azure App Service】PowerShell脚本批量添加IP地址到Web App允许访问IP列表中
Web App取消公网访问后,只允许特定IP能访问Web App。需要写一下段PowerShell脚本,批量添加IP到Web App的允许访问IP列表里!
|
6月前
|
开发工具 git
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
|
6月前
|
开发框架 .NET Windows
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
【App Service】在App Service中配置Virtual applications and directories,访问目录中的静态文件报错404
|
6月前
|
域名解析 网络协议 网络安全
【App Service】遇见本地访问Azure App Service应用慢或者是调用第三方接口慢的调试小工具
【App Service】遇见本地访问Azure App Service应用慢或者是调用第三方接口慢的调试小工具
|
6月前
|
安全 网络安全 Windows
【Azure App Service】遇见az命令访问HTTPS App Service 时遇见SSL证书问题,暂时跳过证书检查的办法
【Azure App Service】遇见az命令访问HTTPS App Service 时遇见SSL证书问题,暂时跳过证书检查的办法
【Azure App Service】遇见az命令访问HTTPS App Service 时遇见SSL证书问题,暂时跳过证书检查的办法
|
6月前
|
存储 网络安全 数据中心
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)
100 0
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)

热门文章

最新文章

  • 1
    MNN-LLM App:在手机上离线运行大模型,阿里巴巴开源基于 MNN-LLM 框架开发的手机 AI 助手应用
  • 2
    【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
  • 3
    微信小程序 app.json 配置文件解析与应用
  • 4
    【Azure App Service】基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?
  • 5
    【05】flutter完成注册页面完善样式bug-增加自定义可复用组件widgets-严格规划文件和目录结构-规范入口文件-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草央千澈
  • 6
    【Azure Function】Function App出现System.IO.FileNotFoundException异常
  • 7
    原生鸿蒙版小艺APP接入DeepSeek-R1,为HarmonyOS应用开发注入新活力
  • 8
    【Azure Logic App】使用MySQL 新增行触发器遇见错误 :“Unknown column 'created_at' in 'order clause'”
  • 9
    【08】flutter完成屏幕适配-重建Android,增加GetX路由,屏幕适配,基础导航栏-多版本SDK以及gradle造成的关于fvm的使用(flutter version manage)-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
  • 10
    阿里云APP备案流程图以及备案所需材料整理,跟着教程一步步操作