public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dinesh K Subhraveti" <dinesh@cs.columbia.edu>
To: <linux-kernel@vger.kernel.org>
Subject: Isn't wait4 amenable to interception?
Date: Fri, 9 Apr 1999 02:10:35 -0400	[thread overview]
Message-ID: <00bb01be824f$af09b9b0$13123b80@endo> (raw)

Hello,

I am trying to intercept wait4 and having problems with it. Does wait4
differ from other system calls in any peculiar way? The new system call
routine just returns original sys_wait4. After inserting the module, system
works just fine. But rmmod causes a kernel oops with "Bad EIP" message and
shell gets killed. After kernel oops everything seems just fine too. I'd
greatly appreciate any insight on this. Am attaching the code below. Please
reply to dinesh@cs.columbia.edu.

Thanks in advance,
Dinesh

-----------------------------------------------
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/resource.h>
#include <sys/syscall.h>

extern void *sys_call_table[];

static int (*original_sys_wait4) (pid_t, int*, int, struct rusage*);

asmlinkage int my_wait4 (pid_t a, int *b, int c, struct rusage *d)
{
   return original_sys_wait4 (a, b, c, d);
}

int init_module()
{
   original_sys_wait4 = sys_call_table[__NR_wait4];
   sys_call_table[__NR_wait4] = my_wait4;
   return 0;
}

void cleanup_module()
{
   sys_call_table[__NR_wait4] = original_sys_wait4;
}



                 reply	other threads:[~2002-04-09  6:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='00bb01be824f$af09b9b0$13123b80@endo' \
    --to=dinesh@cs.columbia.edu \
    --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