Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Mar 2006 10:54:49 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Accessing address space of a process through kld!!
Message-ID:  <200603011054.50628.jhb@freebsd.org>
In-Reply-To: <20060301140635.GA669@pm513-1.comsys.ntu-kpi.kiev.ua>
References:  <cdc1d1310602270026o6b17101et14ddf301269edc37@mail.gmail.com> <200602281333.49277.jhb@freebsd.org> <20060301140635.GA669@pm513-1.comsys.ntu-kpi.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 01 March 2006 09:06, Andrey Simonenko wrote:
> On Tue, Feb 28, 2006 at 01:33:47PM -0500, John Baldwin wrote:
> > On Monday 27 February 2006 13:31, John-Mark Gurney wrote:
> > > Tanmay wrote this message on Mon, Feb 27, 2006 at 13:56 +0530:
> > > > How do I access the address space ie text,data and stack of a (user
> > > > level)process whose pid I know from my kld. for eg: Suppose 'vi' is running
> > > > and I want to access its address space through my kld, then how do I do it?
> > > 
> > > You look up the process with pfind(9), and then you can use uio(9) to
> > > transfer data into kernel space...  Don't forget to PROC_UNLOCK the
> > > struct once you are done referencing it.
> > 
> > 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.
> 
> I have two questions about this function:
> 
> 1.	vm_fault() does not guarantee, that (possibly) faulted in page
> 	will be in the object or in one of backing objects when
> 	vm_fault() returns, because a page can become not resident
> 	again.  Why not to wire needed page in vm_fault() (by giving
> 	a special flag to vm_fault() function)?
> 
> 2.	When the object which owns the page is unlocked, which lock
> 	guarantees, then m will point to a page?  I mean m, which is
> 	used in vm_page_hold(m), which is called after VM_OBJECT_UNLOCK()
> 	(I mean a gap of time between VM_OBJECT_UNLOCK() and
> 	vm_page_lock_queues() function calls).
> 
> Can you answer these two question?  Thanks.

Those are outside of my realm of knowledge unfortunately, but there are
some other folks you can ask including probably truckman@ and alc@.
> 

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603011054.50628.jhb>