From owner-freebsd-hackers Tue Aug 27 18:52:43 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 8A4E637B400 for ; Tue, 27 Aug 2002 18:52:40 -0700 (PDT) Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33DA543E42 for ; Tue, 27 Aug 2002 18:52:40 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0268.cvx40-bradley.dialup.earthlink.net ([216.244.43.13] helo=mindspring.com) by gull.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17js0U-0000RG-00; Tue, 27 Aug 2002 18:52:31 -0700 Message-ID: <3D6C2C3F.6FF99F86@mindspring.com> Date: Tue, 27 Aug 2002 18:49:51 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Pawel Jakub Dawidek Cc: freebsd-hackers@freebsd.org Subject: Re: Replacing kernel functions. References: <20020828012917.GH22722@garage.freebsd.pl> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Pawel Jakub Dawidek wrote: > Hello hackers... > > I've wrote two functions to replace kernel functions. [ ... functions to replace functions with stub calls to other functions, so as to avoid the symbol fixup problem for already linked code ... ] > Ok... And now what I want from You. > This works of course only on i386 arch and I need version of those functions > for the rest of archs supported by FreeBSD. > So if You know how to port them, fell free to send me Your version:) This is evil. [ ... ] > Pawel Jakub Dawidek > UNIX Systems Administrator > http://garage.freebsd.pl > Am I Evil? Yes, I Am. But you appear to know that already. 8-). I think it's pretty much the general consensus that turning every kernel symbol into an interface is an inherently bad idea. It's much better to control interfaces. 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"). 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. 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. I wouldn't object to seeing it in a "ports/devel" library at some point, though... ;^). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message