【问题标题】:Android, start valgrind permission denied when launched under logwrapperAndroid,在 logwrapper 下启动时启动 valgrind 权限被拒绝
【发布时间】:2018-05-27 07:42:08
【问题描述】:

我正在尝试在 android 上使用 valgrind,但遇到了一些问题。当我在valgrind 下启动应用程序时,出现以下错误(在 logcat 中):

         logwrapper  W  type=1400 audit(0.0:73): avc: denied { execute } for name="start_valgrind.sh" dev="dm-1" ino=654102 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:system_data_file:s0 tcla ss=file permissive=0

                     E  executing /data/local/start_valgrind.sh failed: Permission denied
  start_valgrind.sh  I  executing /data/local/start_valgrind.sh failed: Permission denied
                     I  start_valgrind.sh terminated by exit(255)

前提条件:

  1. 我在我的机器上构建了 valgring valgrind-3.13.0 并推动它 根系 6P,8.1.0 操作系统。 (我也使用了模拟器 8.0 + valgrind-3.11.0 - 效果一样)
  2. 我设置了 prop adb shell setprop wrap.$PACKAGE \"logwrapper /data/local/start_valgrind.sh\" (start_valgrinds.sh 脚本 从下面的链接)
  3. 我使用了这里的指令 https://stackoverflow.com/a/19235439/313113
  4. 我做了chmod -R 777 /data/local/Inst/(valgrind bin 的位置)。
  5. 我做了chmod 777 /data/local/start_valgrind.sh(启动脚本,见2项)
  6. 我启动了这样的应用程序:adb shell am start -a android.intent.action.MAIN -n $PACKAGE/.MainActivity
  7. 我使用 Hello world 原生 JNI 应用。

可能是logwrapper 无法启动脚本/data/local/start_valgrind.sh 的问题,因为它没有足够的权限,但是如何添加这些权限。?

【问题讨论】:

  • 你找到解决办法了吗?
  • @ArturLatoszewski 还没有,等到更好的时候再说吧。
  • 你一直在 OSX 上构建 valgrind 吗?你用过哪个版本的NDK?
  • OSX,ndk 版本很可能是 r12b,不过不确定是否重要。

标签: android shell adb native valgrind


【解决方案1】:

尝试将 start_valgrind.sh 移动到 /system/bin 并设置模式 755

【讨论】:

    【解决方案2】:

    logwrapper 无法执行 shell 脚本,因为它有 SELinux 权限问题。尝试使用以下命令禁用 SELinux 强制执行 setenforce 0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-03
      • 2020-08-09
      • 1970-01-01
      • 2020-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-19
      相关资源
      最近更新 更多