All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Leonidas ." <leonidas137@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Replacing kernel functions - kernel symtab
Date: Wed, 3 Mar 2010 22:41:22 +0530	[thread overview]
Message-ID: <f22d86811003030911s3d857c8do58f2c8e904ac4eac@mail.gmail.com> (raw)

Hi

I am working on a module which provides dynamic instrumentation for
some of the kernel
functions. My module is not ready yet from dynamic instrumentation perspective.

In order to test basic functionality, I am planning to hijack calls
like kmalloc in order to provide
some profiling information. I was thinking of replacing the symbols in
the kernel symbol table
just for testing purposes. I know this is not a clean approach.

Would it possible to replace kmalloc with my_kmalloc in my modules
init function? This way, after
my module is loaded all mallocs are routed to my module. What could go
wrong here? Logically,
this is just point replacement in symtab which should be atomic, right?

Is there any other way to trap calls like kmalloc without making
changes in mm subsystem or compiling
kernel/rebooting? In user space we have multiple options like usage of
LD_PRELOAD etc, are there
any loading time tricks which we can use in kernel space?



-Leo.

                 reply	other threads:[~2010-03-03 17:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f22d86811003030911s3d857c8do58f2c8e904ac4eac@mail.gmail.com \
    --to=leonidas137@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.