【QCM6125】Android12 selinux权限修改及快速调试

【背景】:
在调试的过程中需要修改selinux权限,并快速验证修改是否有效或者修改后可以构建成功,以及常见问题处理
【快速调试验证】:
可以通过以下命令快速构建确认修改的selinux是否能够构建通过,以及验证:

$make selinux_policy	//构建selinux规则

验证:

adb push out\target\product\sc138\system\etc\selinux /system/etc/
adb push out\target\product\sc138\vendor\etc\selinux /vendor/etc/

有的规则push无效,需要整编版本验证。

【常见错误】:
错误1:“neverallow check failed at out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil:22906 from system/sepolicy/private/property.te:47”

FAILED: out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil
out/soong/host/linux-x86/bin/checkpolicy -C -M -c 30 -o out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.conf/android_common/conf && cat system/sepolicy/private/technical_debt.cil >>  out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil && out/soong/host/linux-x86/bin/secilc -m -M true -G -c 30 out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil -o /dev/null -f /dev/null # hash of input list: d6ecc2c4e157ea76b3d37465aa507252a4901a59eb2d9f9a33d3c2a8d1c7f7be
neverallow check failed at out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil:22906 from system/sepolicy/private/property.te:47
  (neverallow base_typeattr_223 base_typeattr_751 (file (ioctl read write create setattr lock relabelfrom append unlink link rename open watch watch_mount watch_sb watch_with_perm watch_reads)))
    <root>
    allow at out/soong/.intermediates/system/sepolicy/userdebug_plat_sepolicy.cil/android_common/userdebug_plat_sepolicy.cil:26253
      (allow vendor_init init_service_status_private_prop (file (read)))

Failed to generate binary

可以看到system/sepolicy/private/property.te文件47行的权限和自己新增的权限冲突,所以需要根据冲突原因修改对应的te文件限制。

-neverallow { domain -coredomain } {
+neverallow { domain -coredomain -vendor_init } {
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值