From: "Dinesh K Subhraveti" <dinesh@cs.columbia.edu>
To: linux-newbie@vger.kernel.org
Subject: isn't wait4 amenable to interception?
Date: Fri, 9 Apr 1999 01:12:40 -0400 [thread overview]
Message-ID: <009b01be8247$97659b60$13123b80@endo> (raw)
hello,
i was trying to intercept various system calls and got stumped at wait4. the
new syscall routine just returns original sys_wait4. i am able to insert the
module. sytem works just fine after insertion. but when i rmmod the module,
kernel 'oops'es with "bad eip" message and the shell gets killed. am just
not able to figure why. i'd greatly appreciate any insight on this. am
attaching the code below.
thanks in advance
-----------------------------------------------
#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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next reply other threads:[~1999-04-09 5:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-09 5:12 Dinesh K Subhraveti [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-04-09 6:10 Isn't wait4 amenable to interception? Dinesh K Subhraveti
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='009b01be8247$97659b60$13123b80@endo' \
--to=dinesh@cs.columbia.edu \
--cc=linux-newbie@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 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.