mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Leonidas ." <leonidas137@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Link time manipulation of kernel symbols like read/write
Date: Fri, 7 May 2010 23:21:00 +0530	[thread overview]
Message-ID: <y2gf22d86811005071051q28a4fa84g2a3ea1a7ff487934@mail.gmail.com> (raw)

Hi folks,

Is it possible to wrap module entry points like open/close during the
module compilation?
By wrapping, I mean interposing using linker --wrap option. This is
very much possible in
user space and is commonly used to interpose library functions.

E.g.

void *
__wrap_malloc (int c)
{
  printf ("malloc called with %ld\n", c);
  return __real_malloc (c);
}

int main()
{
    malloc(17);
    return 0;
}

Above works expected, can we wrap kmalloc this way?

-Leo.

             reply	other threads:[~2010-05-07 17:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 17:51 Leonidas . [this message]
2010-05-09  6:51 ` Leonidas .
2010-05-09 14:38   ` Arjan van de Ven
2010-05-09 15:19     ` Leonidas .

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=y2gf22d86811005071051q28a4fa84g2a3ea1a7ff487934@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®