androidselinuxchroot

Proot in android. Program execution error "permission denied"


The executables and libraries of my program are installed in the directory BinDir=/data/app/ru.testapp/lib/x86_64/, this directory has execute permission in SELinux. The rest of the program (additional files) is installed in the Enviroment= /data/user/0/ru.testapp/files/enviroment directory: bin dev etc lib proc root run sys system usr var. The Enviroment directory does not have execute rights in SELinux. I am trying to run the application using proot:

proot\
  --link2symlink\
  -w /root\
  -r $Environment \
  -b $BinDir:/bin\
  -b $BinDir:/lib \
  -b /sys\
  -b /system/ \
  -b /apex\
  -b /proc/ \
  -b /dev\
      /bin/test

As you can see I "bind" $BinDir to $Enviroment/lib and $Enviroment/bin. In this case, the right to execute SELinux is lost in these directories and I get a "permisiion denied" error. There are definitely no other errors, since under su this whole mechanism works.

What can be done in this situation?


Solution

  • My problem was solved by building proot with the PROOT_UNBUNDLE_LOADER environment variable set so that the loader is in the $BinDir location where SELinux allows execution. In general, the error was with the proot loader. (Android 10)