System call interception in linux-kernel module (kernel 3.5)
问题 I need to replace a standard system call (e.g. SYS_mkdir) with my own implementation. As I read in some sources, including this question on Stackoverflow, the sys_call_table is not exported symbol since kernel version 2.6 . I tried the following code: #include <linux/module.h> #include <linux/kernel.h> #include <linux/unistd.h> #include <asm/syscall.h> int (*orig_mkdir)(const char *path); .... int init_module(void) { orig_mkdir=sys_call_table[__NR_mkdir]; sys_call_table[__NR_mkdir]=own_mkdir;