I am trying to locate the address of task_struct
of a thread. First of all, I need to get the address of task_struct
of the init_task
, then I iterate the whole list and finally get the task_struct
of a specific thread. The task_struct
of the init_task
can be easily obtained from /proc/kallsyms
by the command
grep "\<init_task\>" /proc/kallsyms
.
This worked when I use older kernel version (3.12). But when I switched to newer version (4.5), this idea failed at the very beginning. Because the symbol init_task
disappears from /proc/kallsyms
. But when I checked the source code, I can see that the symbol init_task
is exported (http://lxr.free-electrons.com/source/init/init_task.c?v=4.5#L18). Why it doesn't show up in the /proc/kallsyms
? Or is there any other approach to get the address of init_task
from user space programs?