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

HOOK正在使用的接口,还是会CRASH #5

Closed
clarkehe opened this issue Oct 10, 2016 · 4 comments
Closed

HOOK正在使用的接口,还是会CRASH #5

clarkehe opened this issue Oct 10, 2016 · 4 comments

Comments

@clarkehe
Copy link

clarkehe commented Oct 10, 2016

HOOK了系统进程的一个接口,触发该接口频繁调用时HOOK, 会CRASH, 被HOOK的接口在子线程中被调用的。 测试机型Nexus 5 4.4系统。

@ele7enxxh
Copy link
Owner

有例子吗?

@clarkehe
Copy link
Author

clarkehe commented Oct 11, 2016

有,必现的。你QQ多少,我加下你。我的QQ 2711983007

@clarkehe
Copy link
Author

已经解决,是程序逻辑上的问题。
当inlineHook返回时,子线程已经开始执行了,由于在inlineHook返回后才更新程序的返回地址(初始为空),子线程中会执行HOOK替换函数,HOOK替换函数会调用返回地址,返回地址没有更新,为NULL, 就CRASH了。

一定要将你本地保存的返回地址作为引用传给registerInlineHook(第三个参数),我是传了一局部变量,在inlineHook返回后,再将局部变量赋给本地保存地址的变量。

@ele7enxxh
Copy link
Owner

good job~

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