- 论坛徽章:
- 0
|
把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*/
}
改成sys_call_table[__NR_write] 也不行 |
|