0

I have cross-compiled GCC to run on Android arm64 device and i can run it on emulator with "adb shell":

130|generic_arm64:/data/data/com.mycompany.myproject/files/sdk/hardware/tools/avr/bin # ./avr-g++ -v
Using built-in specs.
COLLECT_GCC=./avr-g++
Target: avr
Configured with: ...
Thread model: single
gcc version 7.3.0 (crosstool-NG 1.28.0.1_403899e) 

But if i run it from the app with Runtime.getRuntime().exec() (or using ProcessBuilder). it's killed by Android and return code is 159.

I've straced it and i can clearly see it's killed by Android:

[pid 18202] chdir("/data/app/com.mycompany.myproject-MofhdxOiFns4__o-Osu8rw==/lib/arm64") = 0
[pid 18202] execve("/data/user/0/com.mycompany.myproject/files/sdk/hardware/tools/avr/bin/avr-g++", ["/data/user/0/com.mycompany.mypr"..., "-v"], [/* 14 vars */]) = 0
[pid 18202] --- SIGSYS {si_signo=SIGSYS, si_code=SYS_SECCOMP, si_call_addr=0x4d186c, si_syscall=__NR_set_robust_list, si_arch=AUDIT_ARCH_AARCH64} ---
[pid 18202] +++ killed by SIGSYS +++
[pid 18201] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=18202, si_uid=10100, si_status=SIGSYS, si_utime=0, si_stime=0} ---

What could be the reason? I've tried to avoid passing current dir and environment variables to .exec() and no luck.

PS. It seems si_syscall=__NR_set_robust_list is the issue. The AVR-GCC was cross-compiled using "aarch64-linux-gnu", not "aarch64-linux-android" toolchain. Will it help? It seems there is a blocker for this. Also it's unclear how it works from "adb shell"..

PPS. Same for binutils executables, f.e. 'avr-ar --version' also returns with error code 159 and the same seccomp reason.

7

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.