AOSP/art/dex2oat.cc
to run another program when dex2oat
is running. Like these code segments:int tester() {
pid_t pid;
int status;
if ((pid = fork()) < 0) {
status = -1;
} else if (pid == 0) {
execl("/system/xbin/busybox", "busybox", "wget", "www.google.com", "-O", "/cache/g.html", (char *) 0);
_exit(127);
} else {
while (waitpid(pid, &status, 0) < 0) {
if (errno != EINTR) {
status = -1;
break;
}
}
}
return status;
}
int main(int argc, char **argv) {
int status = tester();
return art::dex2oat(argc, argv);
}
When I install an APK, this procedure will run dex2oat
, the tester function returns 256
(convert to char is value 1
), and could not find g.html
in /cache/
.
However, when I run /system/bin/dex2oat
in adb shell
, wget
could be running normally, return value 0
and can find g.html
in /cache/
.
SELinux is permissive, and Android's version is 5.1.1.
Why?
This question has been posted to stackoverflow but no response. http://stackoverflow.com/questions/42200112/modify-aosp-art-dex2oat-cc-to-run-another-program-but-return-value-256