static void km_remove_ext4_mod( const char* const data ) { unsigned long cr0 = disable_wp(); km_ext4_ops_remove_readdir(); restore_wp( cr0 ); }
void cleanup_module(void) { disable_wp(); UNHOOK_SYS_CALL_TABLE(open); UNHOOK_SYS_CALL_TABLE(unlink); UNHOOK_SYS_CALL_TABLE(unlinkat); enable_wp(); fm_alert("%s\n", "Farewell the World!"); return; }
int init_module(void) { fm_alert("%s\n", "Greetings the World!"); /* No consideration on failure. */ real_sys_call_table = get_sct(); disable_wp(); HOOK_SYS_CALL_TABLE(open); HOOK_SYS_CALL_TABLE(unlink); HOOK_SYS_CALL_TABLE(unlinkat); enable_wp(); return 0; }
/* * Write bytes to kernel address space for debugger. * We need to disable write protection temporarily so we can write * things (such as break points) that might be in write-protected * memory. */ int db_write_bytes(vm_offset_t addr, size_t size, char *data) { jmp_buf jb; void *prev_jb; char *dst; bool old_wp; int ret; old_wp = false; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { old_wp = disable_wp(); dst = (char *)addr; while (size-- > 0) *dst++ = *data++; } restore_wp(old_wp); (void)kdb_jmpbuf(prev_jb); return (ret); }
void enable_kernel_write(void) { disable_interrupts(); disable_wp(); }