From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 28 19:19:11 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 E0C3416A456 for ; Tue, 28 Feb 2006 19:19:10 +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 AB18C43D94 for ; Tue, 28 Feb 2006 19:18:54 +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 k1SJIlmg019026; Tue, 28 Feb 2006 14:18:52 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org, John-Mark Gurney Date: Tue, 28 Feb 2006 13:33:47 -0500 User-Agent: KMail/1.9.1 References: <20060227183142.GJ840@funkthat.com> In-Reply-To: <20060227183142.GJ840@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200602281333.49277.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1306/Tue Feb 28 04:50:04 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Tanmay 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: Tue, 28 Feb 2006 19:19:11 -0000 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. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org