kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: fjohnber@zoho.com (Fredrick)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Hooking a system call.
Date: Mon, 26 Mar 2012 13:22:34 -0700	[thread overview]
Message-ID: <4F70D00A.3010001@zoho.com> (raw)
In-Reply-To: <CA+CftcGKroq9U2CU6YwQGGFRhd6s99-AhpGmz9JTm+C=VkuhVw@mail.gmail.com>

On 03/26/2012 01:14 AM, V.Ravikumar wrote:
>
>
> On Mon, Mar 26, 2012 at 1:18 PM, Mulyadi Santosa
> <mulyadi.santosa at gmail.com <mailto:mulyadi.santosa@gmail.com>> wrote:
>
>     Hi...
>
>     On Mon, Mar 26, 2012 at 11:45, V.Ravikumar
>     <ravikumar.vallabhu at gmail.com <mailto:ravikumar.vallabhu@gmail.com>>
>     wrote:
>      > As part of auditing purpose I need to intercept/hook
>     open/read/write system
>      > calls.
>      >
>      > As I was lack of knowledge into kernel development.Could somebody
>     help me
>      > out here ?
>      > I'm working on RHEL-5 machine with Linux kernel version 2.6.18
>      > Thanks & Regards,
>      > Ravi
>
>     IMHO you better use SystemTap, which is based on Kprobes. It can be
>     used to hook into almost every part of kernel system, with very less
>     overhead.
>
> Ok I'll also look into System Tap.
>
> But in my sample module example code for  intercepting system call. how
> can I make system_call_table address to writable so that one can change
> to customized system call.
>
> Thanks & Regards,
> Ravi
>


You could use tracepoints,

register_trace_sys_enter
register_trace_sys_exit

as used by ftrace in
kernel/trace/trace_syscalls.c

-Fredrick

  parent reply	other threads:[~2012-03-26 20:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  4:45 Hooking a system call V.Ravikumar
2012-03-26  7:48 ` Mulyadi Santosa
2012-03-26  8:14   ` V.Ravikumar
2012-03-26  8:27     ` Mulyadi Santosa
2012-03-26 13:04       ` Peter Senna Tschudin
2012-03-26 13:43     ` Javier Martinez Canillas
2012-03-26 15:30     ` Ravishankar
2012-03-26 19:33       ` richard -rw- weinberger
2012-03-26 20:22     ` Fredrick [this message]
2012-03-28  3:46   ` V.Ravikumar
2012-03-28  6:10     ` rohan puri

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=4F70D00A.3010001@zoho.com \
    --to=fjohnber@zoho.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).