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

可以钩取到系统库调用的函数吗(strdup中调用的malloc)? #18

Closed
UhlanZW opened this issue Sep 1, 2018 · 2 comments
Closed

Comments

@UhlanZW
Copy link

UhlanZW commented Sep 1, 2018

我需要钩取内存分配函数进行内存解析,所以钩取了malloc,new函数,但是如果调用strdup()函数,无法进入我自定义的malloc,请问这种情况是不是原理上的问题,应该换用inline-hook?
谢谢!

@caikelun
Copy link
Collaborator

caikelun commented Sep 6, 2018

你的需求,我觉得增加hook strdup是不是就可以了?

libc(bionic)内部strdup调用malloc的情况,具体还是看strdup的反编译,也许各版本的实现存在差异,总之是没有保证的。也可能和编译优化选项也有关系,原理上strdup中调用点和malloc函数起始位置的偏移是固定的,因此也不一定要走PLT/GOT。

@UhlanZW
Copy link
Author

UhlanZW commented Sep 18, 2018

谢谢。我只是举个例子,我可能需要勾取所有类似的strdup的会调用malloc,free的库函数,所以可能还是需要用Inlinehook完成勾取。

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