From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 1 17:17:41 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 21D8E16A420 for ; Wed, 1 Mar 2006 17:17:41 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3BA843D46 for ; Wed, 1 Mar 2006 17:17:39 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k21HHUDa026430; Wed, 1 Mar 2006 12:17:32 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Andrey Simonenko Date: Wed, 1 Mar 2006 10:54:49 -0500 User-Agent: KMail/1.9.1 References: <200602281333.49277.jhb@freebsd.org> <20060301140635.GA669@pm513-1.comsys.ntu-kpi.kiev.ua> In-Reply-To: <20060301140635.GA669@pm513-1.comsys.ntu-kpi.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603011054.50628.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1308/Wed Mar 1 05:13:39 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED,AWL autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: Accessing address space of a process through kld!! X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2006 17:17:41 -0000 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 <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org