All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Query regarding kernel modules intercepting system call.
Date: Sat, 8 Jul 2017 17:20:39 +0200	[thread overview]
Message-ID: <20170708152039.GA16796@kroah.com> (raw)
In-Reply-To: <CANoRqo=eDAJaojtQLQS4L4s9WBGM4AUkYtWK7vWNQVFHvrG4mQ@mail.gmail.com>

On Sat, Jul 08, 2017 at 07:53:31PM +0530, Ajinkya Surnis wrote:
> Actually, I've been given an assignment to write a kernel module such that
> whenever a certain system call (e.g. open()) is executed, the control should
> come to my new module; then it will do some processing on the parameters and
> then call the actual syscall function (sys_open()).

Horrible assignment, please pass along my regards to the professor that
this is not anything that should ever be assigned.  Seriously, do you
want me to email them this?

> I only found the way of intercepting 'sys_call_table'. I know this kind of
> hacking is probably not a good idea.
> Can you suggest any alternative way?
> I would really appreciate.

Don't do it.

Really, this is not a valid thing to do in Linux.

Feel free to quote me.

Also, the assignment said nothing about 2 modules, so are you sure you
are even doing this right?  :)

thanks,

greg k-h

  reply	other threads:[~2017-07-08 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-08 14:08 Query regarding kernel modules intercepting system call Ajinkya Surnis
2017-07-08 14:13 ` Greg KH
2017-07-08 14:23   ` Ajinkya Surnis
2017-07-08 15:20     ` Greg KH [this message]
2017-07-08 15:38       ` Ajinkya Surnis
2017-07-08 16:04         ` Greg KH
2017-07-08 16:08           ` Ajinkya Surnis
2017-07-08 16:14             ` Greg KH
2017-07-08 18:06               ` Aruna Hewapathirane
2017-07-08 18:19                 ` Ajinkya Surnis
2017-07-08 19:36                   ` Aruna Hewapathirane
2017-07-09  1:06         ` valdis.kletnieks at vt.edu
2017-07-09 10:06         ` Lino Sanfilippo
2017-07-09 10:18           ` Lino Sanfilippo

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=20170708152039.GA16796@kroah.com \
    --to=greg@kroah.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 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.