Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Aug 2002 18:49:51 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Pawel Jakub Dawidek <nick@garage.freebsd.pl>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Replacing kernel functions.
Message-ID:  <3D6C2C3F.6FF99F86@mindspring.com>
References:  <20020828012917.GH22722@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D6C2C3F.6FF99F86>