Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can sloth support arm32 programs compiled by ndk? #2

Closed
Po1lux opened this issue Aug 6, 2021 · 7 comments
Closed

Can sloth support arm32 programs compiled by ndk? #2

Po1lux opened this issue Aug 6, 2021 · 7 comments

Comments

@Po1lux
Copy link

Po1lux commented Aug 6, 2021

Hi,I want to modify your project to test the arm32 program, I copy the /system/ from a rooted Android device into resources/rootfs directory as you mentioned in the usage, but I got the error as blow:
libc: error getting old personality value: Operation not permitted.

I used the unmodified qemu to test and the same error occurred. So the error comes from qemu-arm. I searched for this error and found that the error was in the linker:
http://androidxref.com/6.0.0_r1/xref/bionic/libc/bionic/libc_init_common.cpp#__initialize_personality

personality(0xffffffff); probability means to get the current process execution domain value, it seems that in the qemu-arm it returns -1. So I debug the qemu-arm, the relevant value in qemu is stored in info->personality, but until it runs to cpu_loop, this value is all 0. It may also be that the linker from the mobile phone does not have permission to obtain the value in qemu-arm.

I am confused why the aarch64 program compiled by ndk can be run directly in qemu-aarch, but the arm program compiled by ndk cannot be run in qemu-arm.

would you mind to give me some ideals? This problem has bothered me for a long time.

@ant4g0nist
Copy link
Owner

Hey!
Looks like the personality syscall is failing.

  1. Are you running inside Docker?
  2. If so, could you please try running docker with --privileged

Also, could you share on which host you are trying to do this?

@Po1lux
Copy link
Author

Po1lux commented Aug 6, 2021

All operations are done in the docker environment you provide: ubuntu 20.04 x86_64

@ant4g0nist
Copy link
Owner

okay, can you try running docker with --privileged?

@Po1lux
Copy link
Author

Po1lux commented Aug 9, 2021

Yes, it works! Thanks! I'm just trying to figure out why it works in aarch64 directly. I replied via email, but it doesn’t seem to be displayed here

@ant4g0nist
Copy link
Owner

ant4g0nist commented Aug 9, 2021

Perfect!

So, personality is blocked as part of the seccomp profile! the execution might fail for 64-bit also, if some binary executes that syscall!

Check the section Significant syscalls blocked by the default profile here https://docs.docker.com/engine/security/seccomp/

@Po1lux
Copy link
Author

Po1lux commented Aug 9, 2021

thanks! so nice you are :)

@ant4g0nist
Copy link
Owner

haha thank you :) let me know how it goes. all the best \m/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants