Categories
adb android native shell valgrind

Android, start valgrind permission denied when launched under logwrapper

I’m trying to use valgrind on android, and have some problems. When I launch app under valgrind I got following errors(in 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)

Preconditions:

  1. I builded valgring valgrind-3.13.0 on my machine and push it on
    rooted nexus 6P, 8.1.0 OS. (I also used emulator 8.0 +
    valgrind-3.11.0 – same effect)
  2. I set prop adb shell setprop wrap.$PACKAGE \"logwrapper /data/local/start_valgrind.sh\" (start_valgrinds.sh script
    from below link)
  3. I used instructions from here
    https://stackoverflow.com/a/19235439/313113 .
  4. I did chmod -R 777 /data/local/Inst/ (location for valgrind bin).
  5. I did chmod 777 /data/local/start_valgrind.sh (start script, see 2 item)
  6. I launched app like that: adb shell am start -a android.intent.action.MAIN -n $PACKAGE/.MainActivity
  7. I use Hello world native JNI app.

Maybe problem that logwrapper can not start script /data/local/start_valgrind.sh due to that fact that it does not have enouph permissions, but how to add those permissions.?