How to place `intercept_hook_point*` pointers on thread local storge and actually use it?
I want to make these hooking function pointers to be placed on thread local storage, in order to selectively disable and enable hooking on individual thread. But change definition of these variables with __attribute((tls_model("initial-exec"))) _Thread_local leads to having uninitialized (NULL) value on child threads. Is it related to the disassembly process? Is there a known way to put instruction address to jump for syscall instruction wrapper?
Also, assigning function address to intercept_hook_point_clone_child seems to not call hooked function at clone() at all with or without __attribute((tls_model("initial-exec"))) _Thread_local. Is it normal behavior?
Hello, hurryman2212, I have the same question as you。Does your question has been solved ? Do you can write your solution if question get answer. Any help will be apreciated !
TLS is reset to zero after clone. You have to set the variables manually every time you create a new thread. The result is that intercept_hook_point_clone_child will never work and intercept_hook_point will only work after you assign it from the new thread.
TLS is reset to zero after
clone. You have to set the variables manually every time you create a new thread. The result is thatintercept_hook_point_clone_childwill never work andintercept_hook_pointwill only work after you assign it from the new thread.
Back then, I didn't know about it. So this issue (question) should be closed now. Like he said, intercept_hook_point_clone_child cannot be modified after clone, so if someone wants this, they should implement a 'trampoline' procedure.