Suppose we want to intercept the exit system call and print a message to the console when any process calls it. To do this, we must write our own fake exit system call, and then force the kernel to call our fake exit function instead of the original exit call. At the end of our fake exit call, we can call the original exit call. To do this, we must manipulate the array of system call tables (sys_call_table). Armed with the sys_call_table array, we can manipulate it to make the sys_exit entry point into our new fake exit call. We must save the pointer to the original sys_exit call and call it when we finish printing our message to the console. Source:
#include <linux/kernel.h>
When I compile this program, I got a warning:
WARNING: "sys_call_table" [/home/roiht/driver/one.ko] undefined!
As I did the search, I found that the kernel version after 2.5 changed the concept of the sys_call table. So my question is, is this an alternative method for this in the new kernel version?
c linux kernel
Rohit
source share