From f42bfd607a328675e350a857518af2fdd544f481 Mon Sep 17 00:00:00 2001 From: Tamas K Lengyel Date: Thu, 15 Apr 2021 07:54:33 -0400 Subject: [PATCH] Misc fixes (#1206) * Add explicit 'no' to libhooktest in configure.ac * Zero-init class-member traps in plugins --- configure.ac | 2 +- src/libhook/hooks/return.hpp | 2 +- src/libhook/hooks/syscall.hpp | 2 +- src/plugins/cpuidmon/cpuidmon.h | 2 +- src/plugins/debugmon/debugmon.h | 2 +- src/plugins/exploitmon/exploitmon.cpp | 2 +- src/plugins/plugins_ex.h | 2 +- src/plugins/poolmon/poolmon.h | 2 +- src/plugins/ssdtmon/ssdtmon.h | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index c1180f833..e9a9716ae 100644 --- a/configure.ac +++ b/configure.ac @@ -422,7 +422,7 @@ AC_ARG_ENABLE([plugin_libhooktest], [AS_HELP_STRING([--enable-plugin-libhooktest], [Enable libhooktest plugin for testing @<:@no@:>@])], [plugin_libhooktest="$enableval"], - [plugin_libhooktest=""]) + [plugin_libhooktest="no"]) AM_CONDITIONAL([PLUGIN_LIBHOOKTEST], [test x$plugin_libhooktest = xyes]) if test x$plugin_libhooktest = xyes; then AC_DEFINE_UNQUOTED(ENABLE_PLUGIN_LIBHOOKTEST, 1, "") diff --git a/src/libhook/hooks/return.hpp b/src/libhook/hooks/return.hpp index b09966eb7..bca66aea3 100644 --- a/src/libhook/hooks/return.hpp +++ b/src/libhook/hooks/return.hpp @@ -167,7 +167,7 @@ auto ReturnHook::create(drakvuf_t drakvuf, drakvuf_trap_info* info, cb_wrapper_t // not using std::make_unique because ctor is private auto hook = std::unique_ptr(new ReturnHook(drakvuf, cb)); - hook->trap_ = new drakvuf_trap_t; + hook->trap_ = new drakvuf_trap_t(); auto ret_addr = drakvuf_get_function_return_address(drakvuf, info); if (!ret_addr) diff --git a/src/libhook/hooks/syscall.hpp b/src/libhook/hooks/syscall.hpp index ccd95da87..d08a6a8a5 100644 --- a/src/libhook/hooks/syscall.hpp +++ b/src/libhook/hooks/syscall.hpp @@ -167,7 +167,7 @@ auto SyscallHook::create(drakvuf_t drakvuf, const std::string& syscall_name, cb_ // not using std::make_unique because ctor is private auto hook = std::unique_ptr(new SyscallHook(drakvuf, syscall_name, cb)); - hook->trap_ = new drakvuf_trap_t; + hook->trap_ = new drakvuf_trap_t(); if (!drakvuf_get_kernel_symbol_rva(hook->drakvuf_, hook->syscall_name_.c_str(), &hook->trap_->breakpoint.rva)) { diff --git a/src/plugins/cpuidmon/cpuidmon.h b/src/plugins/cpuidmon/cpuidmon.h index d8a00baae..41ca67f6b 100644 --- a/src/plugins/cpuidmon/cpuidmon.h +++ b/src/plugins/cpuidmon/cpuidmon.h @@ -112,7 +112,7 @@ class cpuidmon: public plugin { public: output_format_t format; - drakvuf_trap_t cpuid; + drakvuf_trap_t cpuid{}; drakvuf_t drakvuf; bool stealth; diff --git a/src/plugins/debugmon/debugmon.h b/src/plugins/debugmon/debugmon.h index 0d614af81..c673f7603 100644 --- a/src/plugins/debugmon/debugmon.h +++ b/src/plugins/debugmon/debugmon.h @@ -112,7 +112,7 @@ class debugmon: public plugin { public: output_format_t format; - drakvuf_trap_t debug; + drakvuf_trap_t debug{}; drakvuf_t drakvuf; debugmon(drakvuf_t drakvuf, output_format_t output); diff --git a/src/plugins/exploitmon/exploitmon.cpp b/src/plugins/exploitmon/exploitmon.cpp index 3a7f1e52b..1267c394d 100644 --- a/src/plugins/exploitmon/exploitmon.cpp +++ b/src/plugins/exploitmon/exploitmon.cpp @@ -137,7 +137,7 @@ static bool hook_page( event_response_t (*callback)(drakvuf_t, drakvuf_trap_info_t*), addr_t data = 0) { - auto trap = new drakvuf_trap_t; + auto trap = new drakvuf_trap_t(); if (!trap) return false; diff --git a/src/plugins/plugins_ex.h b/src/plugins/plugins_ex.h index aa1426857..afbeeadb3 100644 --- a/src/plugins/plugins_ex.h +++ b/src/plugins/plugins_ex.h @@ -575,7 +575,7 @@ drakvuf_trap_t* pluginex::register_trap(drakvuf_trap_info_t* info, int64_t ttl, ah_cb_t ah_cb) { - auto trap = new drakvuf_trap_t; + auto trap = new drakvuf_trap_t(); if constexpr (std::is_same_v) { diff --git a/src/plugins/poolmon/poolmon.h b/src/plugins/poolmon/poolmon.h index 16236718f..4cd41ae45 100644 --- a/src/plugins/poolmon/poolmon.h +++ b/src/plugins/poolmon/poolmon.h @@ -113,7 +113,7 @@ class poolmon: public plugin public: output_format_t format; GTree* pooltag_tree; - drakvuf_trap_t trap; + drakvuf_trap_t trap{}; poolmon(drakvuf_t drakvuf, output_format_t output); ~poolmon(); diff --git a/src/plugins/ssdtmon/ssdtmon.h b/src/plugins/ssdtmon/ssdtmon.h index f71d41b19..a6c109762 100644 --- a/src/plugins/ssdtmon/ssdtmon.h +++ b/src/plugins/ssdtmon/ssdtmon.h @@ -112,8 +112,8 @@ class ssdtmon: public plugin { public: output_format_t format; - drakvuf_trap_t ssdtwrite; - drakvuf_trap_t ssdtwrite2; + drakvuf_trap_t ssdtwrite{}; + drakvuf_trap_t ssdtwrite2{}; addr_t kiservicetable; uint32_t kiservicelimit;