From owner-freebsd-hackers Tue Aug 27 19: 7:49 2002 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 6EB4B37B400 for ; Tue, 27 Aug 2002 19:07:45 -0700 (PDT) Received: from milla.ask33.net (milla.ask33.net [217.197.166.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDD4043E6E for ; Tue, 27 Aug 2002 19:07:44 -0700 (PDT) (envelope-from nick@milla.ask33.net) Received: by milla.ask33.net (Postfix, from userid 1001) id 429493ABD43; Wed, 28 Aug 2002 04:10:16 +0200 (CEST) Date: Wed, 28 Aug 2002 04:10:16 +0200 From: Pawel Jakub Dawidek To: freebsd-hackers@freebsd.org Subject: Re: Replacing kernel functions. Message-ID: <20020828021016.GB31943@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="aVD9QWMuhilNxW9f" Content-Disposition: inline X-PGP-Key-URL: http://garage.freebsd.pl/jules.pgp X-OS: FreeBSD 4.6-STABLE i386 User-Agent: Mutt/1.5.1i 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 --aVD9QWMuhilNxW9f Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 27, 2002 at 06:49:51PM -0700, Terry Lambert wrote: +> For example, I notice you are not locking the symbol before +> replacing it, to ensure that there is not another CPU in the +> code with an instruction counter somewhere in the region +> being replaced. +> +> There's also no accessor/mutator hooks: this is basically a +> data interface, and data interfaces are evil, too (e.g. "proc +> size mismatch"). As I see problem is much more complicated. +> Probably this is an OK thing to do for in-house applications, +> on UP machines, but a really, really bad thing to do as a +> general interface. But there is no way to do what I want to do. I need to write something that give me filename of open file when I gave an descriptor. So I cache all open() calls. But there is a problem how to clean up on close. When descriptors are closed by syscalls (close(), sys_exit()) there is no problem to catch it, by what when process will be killed by signal from kernel? So I'm replacing ffree() function from /sys/kern/kern_descrip.c in my evil way:) I know that this way is fucked up, but I have no idea how to made this in diffrent (nice) way. +> Personally, I've used this technique myself, for the purposes +> of code instrumentation for profiling on an OD for which I +> lacked source code, but I would *never* consider exporting +> this as a general API. So when all kernel functions addresses will be in some tab just like syscalls addresses?:) --=20 Pawel Jakub Dawidek UNIX Systems Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am. --aVD9QWMuhilNxW9f Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iQCVAwUBPWwxCD/PhmMH/Mf1AQE2AAP9Emz0pL0qC7UhzhJIPHOYUmHOOd6Mr1+q OS5A2H9kLvqOrThPjiD8V+HGFMEdnSlnlHJlfusLOIe+f4v9HL+Xpsic+MA9RFqb bilGDpZ9dDqfo5fKgojHPxzEYpWTVJNIp+riiM24zqDelE5JgJHnzMoYemt3zzxw a7JkND/6OfQ= =SYga -----END PGP SIGNATURE----- --aVD9QWMuhilNxW9f-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message