X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgears%2Fext_execve_hook.c;h=501b992504472171d08b72d2e78f0d571731af97;hb=4b7f19c51325601d7e7569e6101c7bfcdf984ef7;hp=c7307ab16b816a5d189cb2a5406be602eace65e0;hpb=b7093fd3602ef2c796a1f8a0daded9d6aad0b756;p=palacios.git diff --git a/palacios/src/gears/ext_execve_hook.c b/palacios/src/gears/ext_execve_hook.c index c7307ab..501b992 100644 --- a/palacios/src/gears/ext_execve_hook.c +++ b/palacios/src/gears/ext_execve_hook.c @@ -56,27 +56,27 @@ static int init_exec_hooks (struct v3_vm_info * vm, v3_cfg_tree_t * cfg, void ** return 0; } -static int init_exec_hooks_core (struct guest_info * core, void * priv_data) { +static int init_exec_hooks_core (struct guest_info * core, void * priv_data, void ** core_data) { struct v3_exec_hooks * hooks = &exec_hooks; INIT_LIST_HEAD(&(hooks->hook_list)); hooks->bin_table = v3_create_htable(0, exec_hash_fn, exec_eq_fn); if (hooks->bin_table == NULL) { - PrintError("Problem creating execve hash table\n"); + PrintError(core->vm_info, core, "Problem creating execve hash table\n"); return -1; } if (core->cpu_mode == LONG || core->cpu_mode == LONG_32_COMPAT) { - PrintDebug("Hooking execve 64\n"); + PrintDebug(core->vm_info, core, "Hooking execve 64\n"); v3_hook_syscall(core, SYS64_EXECVE, v3_execve_handler, NULL); } else { - PrintDebug("Hooking execve, cpu mode: %x\n", core->cpu_mode); + PrintDebug(core->vm_info, core, "Hooking execve, cpu mode: %x\n", core->cpu_mode); v3_hook_syscall(core, SYS32_EXECVE, v3_execve_handler, NULL); } return 0; } -static int deinit_exec_hooks_core (struct guest_info * core, void * priv_data) { +static int deinit_exec_hooks_core (struct guest_info * core, void * priv_data, void * core_data) { struct v3_exec_hooks * hooks = &exec_hooks; struct exec_hook * hook = NULL; struct exec_hook * tmp = NULL; @@ -101,7 +101,7 @@ int v3_hook_executable (struct v3_vm_info * vm, addr_t key; if (!hook) { - PrintError("Cannot allocate in hooking exec\n"); + PrintError(vm, VCORE_NONE, "Cannot allocate in hooking exec\n"); return -1; } @@ -129,12 +129,12 @@ int v3_unhook_executable (struct v3_vm_info * vm, const uchar_t * binfile) { if ((hook = (struct exec_hook*)v3_htable_search(hooks->bin_table, key)) != NULL) { free_hook(vm, hook); } else { - PrintError("Could not unhook executable '%s'\n", binfile); + PrintError(vm, VCORE_NONE, "Could not unhook executable '%s'\n", binfile); return -1; } if (v3_htable_remove(hooks->bin_table, key, 0) == (addr_t)NULL) { - PrintError("Error trying to remove key from htable: v3_unhook_executable\n"); + PrintError(vm, VCORE_NONE, "Error trying to remove key from htable: v3_unhook_executable\n"); return -1; } @@ -143,8 +143,8 @@ int v3_unhook_executable (struct v3_vm_info * vm, const uchar_t * binfile) { static struct v3_extension_impl execve_impl = { .name = "execve_intercept", - .init = init_exec_hooks, - .deinit = NULL, + .vm_init = init_exec_hooks, + .vm_deinit = NULL, .core_init = init_exec_hooks_core, .core_deinit = deinit_exec_hooks_core, .on_entry = NULL, @@ -169,7 +169,7 @@ int v3_execve_handler (struct guest_info * core, uint_t syscall_nr, void * priv_ } if (ret == -1) { - PrintError("Error translating file path in sysexecve handler\n"); + PrintError(core->vm_info, core, "Error translating file path in sysexecve handler\n"); return 0; } @@ -178,7 +178,7 @@ int v3_execve_handler (struct guest_info * core, uint_t syscall_nr, void * priv_ ret = hook->handler(core, hook->priv_data); if (ret == -1) { - PrintDebug("Error handling execve hook\n"); + PrintDebug(core->vm_info, core, "Error handling execve hook\n"); return -1; }