From owner-freebsd-hackers Thu Jul 12 23:35:47 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from sneakerz.org (sneakerz.org [216.33.66.254]) by hub.freebsd.org (Postfix) with ESMTP id 84BA037B408 for ; Thu, 12 Jul 2001 23:35:44 -0700 (PDT) (envelope-from bright@sneakerz.org) Received: by sneakerz.org (Postfix, from userid 1092) id 626335D010; Fri, 13 Jul 2001 01:35:33 -0500 (CDT) Date: Fri, 13 Jul 2001 01:35:33 -0500 From: Alfred Perlstein To: "Eugene L. Vorokov" Cc: freebsd-hackers@freebsd.org Subject: Re: Some questions about kernel programming Message-ID: <20010713013533.L6664@sneakerz.org> References: <20010712212809.F6664@sneakerz.org> <200107130646.f6D6kPR01837@bugz.infotecs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200107130646.f6D6kPR01837@bugz.infotecs.ru>; from vel@bugz.infotecs.ru on Fri, Jul 13, 2001 at 10:46:25AM +0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Eugene L. Vorokov [010713 01:33] wrote: > Forgot to Cc: here: > > > You can't call kernel strlen on a userland address, you must do > > something like this: > > How so ? It seems to work for me. For instance, I used userland > address space buffer to simulate __getcwd() syscall on the current > process (I was hacking open() syscall and log full path of the file > to the syslog). I simulate mmap() with MAP_ANON and fd == -1 on > that process, then I do __getcwd() to the buffer allocated, and > then I'm very well able to call strlen() on that userland buffer, > as well as other str* functions. So generally I think it works. It may work on i386+freebsd right now, but if kernel address != user address it will break. Your code is wrong. -- -Alfred Perlstein [alfred@freebsd.org] Ok, who wrote this damn function called '??'? And why do my programs keep crashing in it? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message