Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2002 04:10:16 +0200
From:      Pawel Jakub Dawidek <nick@garage.freebsd.pl>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Replacing kernel functions.
Message-ID:  <20020828021016.GB31943@garage.freebsd.pl>

next in thread | raw e-mail | index | archive | help

--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020828021016.GB31943>