-
Notifications
You must be signed in to change notification settings - Fork 213
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
rwx size is too small to hold 56 bytes backup instructions #28
Comments
Yes, it may require more room if there are too many pc-relative instructions (e.g, mixed adr/adrp) that need to be relocated and aligned. |
Update: same device, more functions
|
After inspecting the attached So I am guessing the errors are caused by I'm really not sure what can be done here... |
Hi, @axnsan12, I have just released the v3.5.0, could you have a try? |
Hello and thanks a lot! Will have a look in a day or two 😄 |
So I tried it, and I have both good and bad news. Good news is the original error doesn't happen any more and I can hook adjacent functions without crashing the program when they're called! Yay! 😄 Bad news is that I now sometimes see crashes when calling the original function. For example, if I hook only if (fork() == 0) {
system("ps");
} I can actually see my hook function being executed, and log its arguments:
However as soon as I try to execute the original function, the process crashes:
The same test worked on the previous version. |
Thanks for Your Feedback! |
It crashes only for For example, here is a sample program where I hooked system("pwd");
if (fork() == 0) {
AKLog("child");
char *argv[] = {NULL};
execv("su", argv);
AKLog("exec failed... %d", errno);
exit(1);
}
else {
AKLog("parent");
char *argv[] = {NULL};
execv("lsof", argv);
AKLog("exec failed... %d", errno);
exit(1);
} You can see that the The same code with the same hooks executes sucesfully with the old version of the library. Here is the log, annotated with my comments on the right
|
It seems that the crash happened only with Android 8.0 and was caused simply by a misspelling, sorry for the inconvenience. |
Yep, seems to be working now! And thank YOU, you're doing this for free 😄 |
Well I'm pleased to hear that😄. Close it. |
When trying to hook some system functions (e.g.
fork
,execve
), I see an error in logcat that readsrwx size is too small to hold 56 bytes backup instructions
, and hooking fails. Looking at https://github.com/rrrfff/And64InlineHook/blob/master/And64InlineHook.cpp the hook trampoline size seems to be limited to 50 bytes, hence the error.Call site looks like so:
My system is a OnePlus 3 running OxygenOS - Android 8.0.0, arm64-v8a.
I seem to have gotten it working by copying the
A64HookFunction
as a wrapper around theAKHookFunctionV
exported from the.so
files here, and increasing the trampoline size to 70 from 50.Attached is
libc.so
pulled from my device:libc.so.zip
The text was updated successfully, but these errors were encountered: