hacking functions
Hello friends
friends i need ur help .
In the below mentioned program i
am intercepting makedir system call so that user would not be able to make
any directories . But i am getting " unresolved sysmbol sys_call_table "
error while inserting the module .Plz help me 2 resolve it .
Thanks a lot .
My kernel version is 2.4.18.14 .
gcc -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.18-14/include -Wall -O2 -c nodir.c -o
nodir.o
/* program nodir.c */
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/smp_lock.h>
#include <linux/sched.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/file.h>
#include <asm/uaccess.h>
#include <linux/proc_fs.h>
#include <asm/errno.h>
#include <asm/io.h>
#include <sys/syscall.h>
extern void* sys_call_table[]; /*sys_call_table is exported, so we
can access it*/
int (*orig_mkdir)(const char *path); /*the original systemcall*/
int hacked_mkdir(const char *path)
{
return 0; /*everything is ok, but he new systemcall
does nothing*/
}
int init_module(void) /*module setup*/
{
orig_mkdir=sys_call_table[__NR_mkdir];
sys_call_table[__NR_mkdir]=hacked_mkdir;
return 0;
}
void cleanup_module(void) /*module shutdown*/
{
sys_call_table[__NR_mkdir]=orig_mkdir; /*set mkdir syscall to the origal
one*/
}
MODULE_LICENSE("GPL");
=====
shallinvites@rediffmail.com
We all have ability. The difference is how we use it.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
Reply to: