我有一个自定义的 A10 存储库,我正在尝试创建一个能够读取的应用程序/proc/[pid]/some-file
文件例如stat
and status
, 就像ps
does.
读完这篇文章后answer https://android.stackexchange.com/a/207115/很明显,AID_READPROC
应该添加我使用自定义权限完成的操作。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.poke.mon"
android:sharedUserId="android.uid.system">
<!-- More stuff -->
<uses-permission android:name="com.poke.READPROC_PERM" />
<!-- More stuff -->
</application>
</manifest>
我已经添加了com.poke.READPROC_PERM
通过编辑适当的platform.xml
, AndroidManifest.xml
and sytem-current.txt
文件并允许该权限privapp-permissions
file
我已验证cat
-ing 的status
我的应用程序进程的文件并验证 gid 3009 确实存在。
但是,我仍然被 sepolicy 阻止(禁用强制执行后,代码可以访问文件)。
Adding r_dir_file(priv_app, proc)
to the priv_app.te
导致错误。
编译器给出的原因是这样的line https://cs.android.com/android/platform/superproject/+/android-10.0.0_r30:system/sepolicy/private/coredomain.te;l=91 in coredomain.te
:
# Core domains are not permitted to use kernel interfaces which are not
# explicitly labeled.
# TODO(b/65643247): Apply these neverallow rules to all coredomain.
full_treble_only(`
# /proc
neverallow {
coredomain
-init
-vold
} proc:file no_rw_file_perms;
创建自定义域会导致类似的错误,正如我可能想要的那样
typeattribute my_apps_domain coredomain;
为了避免大量的复杂性和重复(我需要与其他服务等进行通信)。
有没有办法解决这个限制? (例如,看着genfscon
它似乎不支持通配符映射,例如/proc/\d+/some-file
)
这似乎也很奇怪shell
能够做到ps
很好,但也还好coredomain
定义为第一行 https://cs.android.com/android/platform/superproject/+/android-10.0.0_r30:system/sepolicy/private/shell.te;l=1 of shell.te
:
typeattribute shell coredomain;
那么也许我还缺少其他一些神奇的安全门?