红联Linux门户
Linux帮助

截获linux 2.4.20-8 系统调用函数write时死机,高手请帮忙解决一下

发布时间:2008-08-27 10:06:33来源:红联作者:ygmok8088
把write换成mkdir就一切正常,且mkdir就成了空操作
源码:
#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*/
}
文章评论

共有 0 条评论