Accessing address space of a process through kld!!

John Baldwin jhb at freebsd.org
Fri Mar 3 12:03:13 PST 2006


On Friday 03 March 2006 10:56, Tanmay wrote:
> On Tue, Feb 28, 2006 at 01:33:47PM -0500,
> John Baldwin wrote:
> >you can use the proc_rwmem() function (it takes a uio >and a struct proc)
> >to do the actual I/O portion.  You can see example use in >the ptrace()
> >syscall.
> 
> Thanks.The memory of the process could be read using the proc_rwmem function
> .
>     How can i access the stack segment of a process ? I tried knowing more
> about the stack allocation by running a small (user-level) program and
> observing its addresses using GDB.Then I printed the max VA address and
> stack size for that process from my KLD using  p->p_vmspace->vm_maxsaddr and
> p->p_vmspace->vm_ssize respectively.But i could not infer anything
> useful.Can you shed some light on this ? At what address does the stack
> segment start ? where can we get this address from for a running process ?

I don't know unfortunately.  Hopefully someone else on the list can help
you out with this.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-hackers mailing list