问题描述:
我需要在预定义参数的特定Android镜像上使droidmon工作。安装Xposed框架时出现错误,要求获得root权限。
环境:
Google Android模拟器运行自定义的已Root的Android 4.4.2 x86镜像,内核版本为3.4.67+(但是我在3.10+上也遇到了同样的问题)使用的参数(+与Android无关的额外参数):
- -avd
- -kernel
- -ramdisk
- -no-cache
- -selinux permissive
- -no-snapstorage
- -verbose
- -show-kernel
SDK-Tools-Version: 25.2.2
SDK-Platform-Tools: 24.0.3
Android已配置允许未知来源的APK
已尝试:
- 重新挂载/system RW
- 使用-selinux disabled(但是xposed要求-selinux permissive)
- 从xposed中提取update-binary并使用su运行脚本
当前状态:
如果我尝试安装Xposed,则模拟器会显示以下日志消息:
[ 355.372965] type=1400 audit(1477138733.355:23): avc: denied { execute } for pid=2796 comm="posed.installer" name="app_process" dev="mtdblock1" ino=7847 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:app_data_file:s0 tclass=file permissive=1
[ 355.372984] type=1400 audit(1477138733.355:24): avc: denied { execute_no_trans } for pid=2796 comm="posed.installer" path="/data/data/de.robv.android.xposed.installer/cache/app_process" dev="mtdblock1" ino=7847 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:app_data_file:s0 tclass=file permissive=1
[ 355.440354] type=1400 audit(1477138733.415:25): avc: denied { read } for pid=2769 comm="posed.installer" name="app_process" dev="mtdblock0" ino=96 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
[ 355.440410] type=1400 audit(1477138733.415:26): avc: denied { open } for pid=2769 comm="posed.installer" name="app_process" dev="mtdblock0" ino=96 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
[ 355.440450] type=1400 audit(1477138733.415:27): avc: denied { getattr } for pid=2769 comm="posed.installer" path="/system/bin/app_process" dev="mtdblock0" ino=96 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
[ 365.476143] type=1400 audit(1477138743.455:28): avc: denied { execute } for pid=2805 comm="Thread-110" name="su" dev="mtdblock0" ino=972 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
[ 365.476280] type=1400 audit(1477138743.455:29): avc: denied { read open } for pid=2805 comm="Thread-110" name="su" dev="mtdblock0" ino=972 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
[ 365.476371] type=1400 audit(1477138743.455:30): avc: denied { execute_no_trans } for pid=2805 comm="Thread-110" path="/system/xbin/su" dev="mtdblock0" ino=972 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
状态更新:
据我所知,镜像没有被正确地root。我使用SuperSU-2.78中打包的su二进制文件重新root了这个镜像。我将system.img挂载到我的Linux机器上的一个文件夹并添加了su和daemonsu(基本上是复制并重命名的su)到/system/xbin/,并将两个文件的权限改为6755。此外,我还在/etc/init.goldfish.sh的末尾添加了两行代码。
#remount /system rw
mount -o rw,remount /system
#start daemonsu as auto-daemon
/system/xbin/daemonsu --auto-daemon
在安装了SuperSU的Superuser.apk和合适的Xposed版本之后,Xposed首先会安装,但重新启动后会导致libdvm.so中的segfaults。