4

问题描述:

我需要让 droidmon 使用预定义的参数处理特定的 android 图像。Xposed 框架在安装时显示错误,它需要 root 访问权限。

环境:

Google Android Emulator 运行自定义的根 Android 4.4.2 x86 映像,内核版本为 3.4.67+(但我对 3.10+ 有同样的问题)使用的参数(+ 与 android itslef 无关的额外参数):

  • -avd
  • -核心
  • -ramdisk
  • -无缓存
  • -selinux 许可
  • -无快照存储
  • -详细
  • -显示内核

SDK-工具-版本:25.2.2

SDK-平台-工具:24.0.3

Android 配置为允许 apk 的未知来源

已经尝试过:

  1. 重新安装 /system RW
  2. 禁用 -selinux(但 xposed 需要 -selinux 许可)
  3. 从 xposed 中提取更新二进制文件并使用 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

状态更新:

据我所知,图像没有正确植根。我使用 SuperSU-2.78 中打包的 su 二进制文件重新启动了图像。我通过将 system.img 挂载到我的 linux 机器上的文件夹来操作它,并将 su 和 daemonsu(基本上是 su 复制并重命名)添加到 /system/xbin/ 并将这两个文件的权限更改为 6755。另外现在我在 /etc/init.goldfish.sh 的末尾添加了 2 行

#remount /system rw
mount -o rw,remount /system

#start daemonsu as auto-daemon
/system/xbin/daemonsu --auto-daemon

从 SuperSU 安装 Superuser.apk 和合适的 Xposed-Version 后,Xposed 最初会安装,但重启后会导致 libdvm.so 中的段错误

4

1 回答 1

1

终于设法让这个工作(需要较旧的 sdk 版本(2016 年 11 月之前)

如上述问题所述,仍需要 SuperSU

低于 3.10 版本的内核映像(kernel-qemu 或引擎经典)

  1. 以详细模式启动模拟器
  2. 注意用于在 qemu 中挂载 /system 的临时文件
  3. 安装 Xposed 但取消重启
  4. 从 /tmp/android-{username}/emulator-{random chars} 复制临时 system.img 到你的主目录
  5. 关机模拟器
  6. 用你的主目录中的一个覆盖现有的 system.img
  7. 再次启动模拟器
  8. Xposed 现在应该可以运行了

内核版本 3.10+(kernel-ranchu 或真正的沙盒模拟器)

不幸的是,目前还没有从 ranchu 模拟器中修改 system.img 的已知方法,ranchu 似乎阻止了每个写操作。阻塞的操作让系统认为该分区已损坏,因此系统以只读方式重新挂载该分区作为安全后备。

两个找到的解决方法:

1.)启动模拟器时使用参数-engine classic(因此强制kernel-qemu)您可以使用上述步骤进行更改

2.) 使用 3.10 版本的内核映像来避免模拟器 ranchu。您可以使用上述步骤,并在应用更改后再次使用以前的内核映像

于 2017-04-02T11:47:25.963 回答