* isn't wait4 amenable to interception?
@ 1999-04-09 5:12 Dinesh K Subhraveti
0 siblings, 0 replies; 2+ messages in thread
From: Dinesh K Subhraveti @ 1999-04-09 5:12 UTC (permalink / raw)
To: linux-newbie
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Isn't wait4 amenable to interception?
@ 1999-04-09 6:10 Dinesh K Subhraveti
0 siblings, 0 replies; 2+ messages in thread
From: Dinesh K Subhraveti @ 1999-04-09 6:10 UTC (permalink / raw)
To: linux-kernel
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-09 6:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-04-09 5:12 isn't wait4 amenable to interception? Dinesh K Subhraveti
-- strict thread matches above, loose matches on Subject: below --
1999-04-09 6:10 Isn't " Dinesh K Subhraveti
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.