I read some documents that share library comiled with -fPIC argument, the .text seqment of the .so will be shared at process fork's dynamic linking stage (eq. the process will map the .so to the same physical address)
i am interested in who (the kernel or ld.so ) and how to accomplish this? maybe i should trace the code, but i dont know where to start it.
Nevertheless, i try to verify the statement.
I decide to check the function address like printf which is in the libc.so that all c program will link.
I get the printf virtual address of the process and need to get the physical address. Tried to write a kernel module and pass the address value to kernel, then call virt_to_phys. But it did not work cause the virt_to_phys only works for kmalloc address.
So, process page table look-at might be the solution to find the virtual address map to physical address. Were there any ways to do page table look-at? Or othere ways can fit the verify experiment?
thanks in advance!