Linux中国论坛's Archiver

ygmok8088 发表于 2008-8-27 10:42

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

把write换成mkdir就一切正常,且mkdir就成了空操作
源码:
#ifndef MODULE
  #define MODULE
#endif
#ifndef __KERNEL__
  #define __KERNEL__
#endif
#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/unistd.h>
#include <sys/syscall.h>
#include <linux/types.h>
#include <linux/dirent.h>
#include <linux/string.h>
#include <linux/fs.h>

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*/
}

chrislena 发表于 2008-9-4 01:19

不错的文章

不错的天气,很好的文章,精彩的回复 [url=http://www.mmovp.com/buy-maple-story-maple-story-items-c-136_1326.html]maplestory item[/url],还有我喜欢的[url=http://www.mmovp.com/buy-cd-key-nexon-game-card-c-1268_1273.html]nexon cash[/url] [url=http://www.mmovp.com/buy-maple-story-c-136.html]maplestory mesos[/url] [url=http://www.mmovp.com/buy-maple-story-c-136.html]MS mesos[/url]

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.