From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 29 08:56:20 2003 Return-Path: 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 9562016A4BF for ; Mon, 29 Sep 2003 08:56:20 -0700 (PDT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id EFAA744005 for ; Mon, 29 Sep 2003 08:56:17 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 31593 invoked from network); 29 Sep 2003 15:48:07 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 29 Sep 2003 15:48:06 -0000 Received: (qmail 88214 invoked by uid 1000); 29 Sep 2003 15:56:13 -0000 Date: Mon, 29 Sep 2003 18:56:13 +0300 From: Peter Pentchev To: Pawel Jakub Dawidek Message-ID: <20030929155613.GB551@straylight.oblivion.bg> Mail-Followup-To: Pawel Jakub Dawidek , earthman , freebsd-hackers@freebsd.org References: <16244.53594.942762.784390@canoe.dclg.ca> <20030927115306.R34638@woozle.rinet.ru> <3F759589.9070700@mindspring.com> <811112091.20030929172247@inbox.ru> <20030929154741.GB520@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rS8CxjVDS/+yyDmU" Content-Disposition: inline In-Reply-To: <20030929154741.GB520@garage.freebsd.pl> User-Agent: Mutt/1.5.4i cc: freebsd-hackers@freebsd.org cc: earthman Subject: Re: user malloc from kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Sep 2003 15:56:20 -0000 --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 29, 2003 at 05:47:41PM +0200, Pawel Jakub Dawidek wrote: > On Mon, Sep 29, 2003 at 05:22:47PM +0300, earthman wrote: > +> how to allocate some memory chunk > +> in user space memory from kernel code? > +> how to do it correctly? >=20 > Here you got sample kernel module which do this: >=20 > http://garage.freebsd.pl/usmalloc.tgz > http://garage.freebsd.pl/usmalloc.README Errrr... but won't this interfere *badly* with userland programs which attempt to allocate memory after making the syscall in question? I mean, won't the application's memory manager attempt to allocate the next chunk of memory right over the region that you have stolen with this brk(2) invocation? Thus, when the application tries to write into its newly-allocated memory, it will overwrite the data that the kernel has placed there, and any attempt to access the kernel's data later will fail in wonderfully unpredictable ways :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 No language can express every thought unambiguously, least of all this one. --rS8CxjVDS/+yyDmU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/eFYd7Ri2jRYZRVMRApIGAKCPKZ14wKikyHlUiogxyO3fmJ7vIgCgpuhO huiKdRC5rGXNtxTwkpwiBqI= =1m0S -----END PGP SIGNATURE----- --rS8CxjVDS/+yyDmU--