问题描述
我正在开发 aosp android 8.1。我在 init.rc 中启动 mydaemon,如果我在 sepolicy 的 priave 文件夹中添加 mydaemon.te,它工作正常。但是当我在公共文件夹中定义 mydaemon 类型时(即在 sepolicy 的公共文件夹中添加 mydaemon.te),它无法进入系统。在 fastboot flash 和重新启动之后。一会儿就会回到恢复模式。
工作很好:/aosp/system/sepolicy/private/mydaemon.te
/aosp/system/sepolicy/prebuilts/api/26.0/private/mydaemon.te
type mydaemon,domain;
type mydaemon_exec,exec_type,file_type;
typeattribute mydaemon coredomain;
typeattribute mydaemon domain_deprecated;
init_daemon_domain(mydaemon)
domain_auto_trans(init,shell_exec,mydaemon)
allow mydaemon tmpfs:fifo_file rw_file_perms;
allow mydaemon tmpfs:fifo_file create_file_perms;
allow mydaemon tmpfs:dir rw_dir_perms;
allow mydaemon tmpfs:dir create_dir_perms;
allow mydaemon self:capability { sys_admin sys_ptrace };
allow mydaemon selinuxfs:file { getattr open read };
/system/sepolicy/private/file_contexts
/system/bin/mydaemon u:object_r:mydaemon_exec:s0
/system/core/rootdir/init.rc
service mydaemon /system/bin/mydaemon
class main
seclabel u:r:mydaemon:s0
restorecon mydaemon
不起作用:/aosp/system/sepolicy/public/mydeamon.te
/aosp/system/sepolicy/prebuilts/api/26.0/public/mydeamon.te
type mydaemon,file_type;
/aosp/system/sepolicy/private/mydaemon.te
/aosp/system/sepolicy/prebuilts/api/26.0/private/mydaemon.te
typeattribute mydaemon coredomain;
typeattribute mydaemon domain_deprecated;
init_daemon_domain(mydaemon)
domain_auto_trans(init,mydaemon)
allow mydaemon tmpfs:fifo_file rw_file_perms;
allow mydaemon tmpfs:fifo_file create_file_perms;
allow mydaemon tmpfs:dir rw_dir_perms;
allow mydaemon tmpfs:dir create_dir_perms;
allow mydaemon self:capability { sys_admin sys_ptrace };
allow mydaemon selinuxfs:file { getattr open read };
/system/sepolicy/private/file_contexts
/system/bin/mydaemon u:object_r:mydaemon_exec:s0
/system/core/rootdir/init.rc
service mydaemon /system/bin/mydaemon
class main
seclabel u:r:mydaemon:s0
restorecon mydaemon
每次,我都会重建 vbMeta.img、system.img 并使用 fastboot flash。
那么,如何在公用文件夹中正确添加 mydeamon.te?谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)