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内核sys_xxx系统调用函数 #327

Open
shiyiyuedeyu opened this issue Jun 2, 2023 · 0 comments
Open

请教关于hook内核sys_xxx系统调用函数 #327

shiyiyuedeyu opened this issue Jun 2, 2023 · 0 comments

Comments

@shiyiyuedeyu
Copy link

shiyiyuedeyu commented Jun 2, 2023

看了下coost文档注意到有hook 机制,便想了解下hook机制,文档中没有详细的hook的内容,便看了下源码。
用户态的函数如malloc之类被hook掉能理解,但是内核的函数是如何被自定义的hook函数hook掉没太搞明白,google搜出来的有点乱。
#define _hook(f) f
#define _hook_api(f)
if (!__sys_api(f)) atomic_store(&__sys_api(f), dlsym(RTLD_NEXT, #f), mo_relaxed)
#define hook_api(f) _hook_api(f)
通过dlsym找到内核符号后就能直接hook内核的函数了吗?
如果有时间的话,望不吝赐教。

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

1 participant