Hello,
My goal is to give each process an identifier/hash value when the process is created. I ammended the "struct proc" from (sys/sys/proc.h) with a hash field, which I am planning to set at the end of the "do_fork" function (from sys/kern/kern_fork.c).
My plan is to create a hash based on the content of the ".text" segment of the binary file of the process (not the whole content, just few selected values from it).
The problem is that I don't know how to read a process memory from the kernel. Is there some kind of function that would translate the process address to the kernel address?
It seems that using the thread pointer from the "do_fork" I could access the "proc" structure, along with "vmspace", "vm_map" and "vm_map_entry" (all from sys/vm/vm_map.h file). It seems the vmspace has "vm_taddr" and "vm_tsize" which I think could be helpful.
I tried using chatgpt and github-copilot but both are useless in this case, any help would be appreciated.
My goal is to give each process an identifier/hash value when the process is created. I ammended the "struct proc" from (sys/sys/proc.h) with a hash field, which I am planning to set at the end of the "do_fork" function (from sys/kern/kern_fork.c).
My plan is to create a hash based on the content of the ".text" segment of the binary file of the process (not the whole content, just few selected values from it).
The problem is that I don't know how to read a process memory from the kernel. Is there some kind of function that would translate the process address to the kernel address?
It seems that using the thread pointer from the "do_fork" I could access the "proc" structure, along with "vmspace", "vm_map" and "vm_map_entry" (all from sys/vm/vm_map.h file). It seems the vmspace has "vm_taddr" and "vm_tsize" which I think could be helpful.
I tried using chatgpt and github-copilot but both are useless in this case, any help would be appreciated.