All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Bonekeeper <thehazard@gmail.com>
To: S <talk2sumit@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: LKM function call on kernel function call?
Date: Thu, 14 Jul 2005 09:59:01 -0700	[thread overview]
Message-ID: <e1e1d5f405071409592890b1d7@mail.gmail.com> (raw)
In-Reply-To: <1458d9610507050123124d6cb@mail.gmail.com>

You can also look about some methods of "function redirection
hooks"... add some opcodes at the start of the "hooked function"
(something like to add a CALL or JMP pointing to the address of your
function). There are docs about this subject, but unfortunately I
couldn't find anything now (http://www.ouah.org/p59-0x08.txt is not
exactly what I'm talking about, it's talking about ELF redirection).
It's a dirty thing to do, and it's not intended to be done in any
production thing (in fact, it's a *hack*).

On 7/5/05, S <talk2sumit@gmail.com> wrote:
> Is it possible to code a loadable module having function1(), which
> would be called, everytime a particular function of the kernel is
> called? If not, atleast a way this could be done without re-compiling
> the whole kernel and rebooting the system?
> 
> Example:
> 
> My LKM:
> -------------
> 
> init_module() {
> ...
> }
> 
> function1() {
> ...
> }
> 
> cleanup_module() {
> ...
> }
> 
> 
> I want function1() to be called, everytime the function
> ide_do_rw_disk() of ide-disk.c is called. I do not want to re-compile
> the complete kernel to do this.
> 
> Thanks in advance,
> 
> Regards,
> S
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
# (perl -e "while (1) { print "\x90"; }") | dd of=/dev/evil

      parent reply	other threads:[~2005-07-14 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-05  8:23 LKM function call on kernel function call? S
2005-07-05  8:38 ` Arjan van de Ven
2005-07-05  8:38 ` Frederik Deweerdt
2005-07-05  8:38   ` Frederik Deweerdt
2005-07-14 16:59 ` Daniel Bonekeeper [this message]

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=e1e1d5f405071409592890b1d7@mail.gmail.com \
    --to=thehazard@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=talk2sumit@gmail.com \
    /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.