From: rohan.puri15@gmail.com (rohan puri)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Hooking a system call.
Date: Wed, 28 Mar 2012 11:40:25 +0530 [thread overview]
Message-ID: <CALJfu6MfhHMbep-RL5kLPFaKXGZ=RXd1Mt37YAZADTqndVzrCQ@mail.gmail.com> (raw)
In-Reply-To: <CA+CftcHAg2Ay7q0JYUwDtkmiA_DOCPL7g3rX2+e_rPJGbuoNxw@mail.gmail.com>
On Wed, Mar 28, 2012 at 9:16 AM, V.Ravikumar
<ravikumar.vallabhu@gmail.com>wrote:
>
>
> On Mon, Mar 26, 2012 at 1:18 PM, Mulyadi Santosa <
> mulyadi.santosa at gmail.com> wrote:
>
>> Hi...
>>
>> On Mon, Mar 26, 2012 at 11:45, V.Ravikumar <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.
>>
>>
> Yes SystemTap is one of the elegant way to hook system calls.
>
> But I need one help while hooking write system call. I need to print the
> file name also, but file name is not passed to write system call. How can I
> get the file for write (or sys_write ) system call.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
Hi,
One way to do this is to map the physical page to new virtual page and make
that page RW and then replace with ur handlers. Refer vmap()
-Rohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120328/40422c82/attachment.html
prev parent reply other threads:[~2012-03-28 6:10 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
2012-03-28 3:46 ` V.Ravikumar
2012-03-28 6:10 ` rohan puri [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='CALJfu6MfhHMbep-RL5kLPFaKXGZ=RXd1Mt37YAZADTqndVzrCQ@mail.gmail.com' \
--to=rohan.puri15@gmail.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).