From a2a79a734846cac22bb2d2ed711004b9b8c02d18 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Thu, 30 Nov 2023 11:34:04 +0000 Subject: [PATCH] udpate(cmake): bump libs to 68a96aa5b7e34d7893563ded8c3d95bb3e77785f Signed-off-by: Roberto Scolaro --- cmake/modules/driver.cmake | 4 +- cmake/modules/falcosecurity-libs.cmake | 4 +- userspace/sinspui/cursescomponents.cpp | 2 +- userspace/sysdig/sysdig.cpp | 4 +- userspace/sysdig/utils/plugin_utils.cpp | 68 ++++++++++++------------- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/cmake/modules/driver.cmake b/cmake/modules/driver.cmake index 3cfa7d7335..113d8c738f 100644 --- a/cmake/modules/driver.cmake +++ b/cmake/modules/driver.cmake @@ -31,8 +31,8 @@ else() # In case you want to test against another driver version (or branch, or commit) just pass the variable - # ie., `cmake -DDRIVER_VERSION=dev ..` if(NOT DRIVER_VERSION) - set(DRIVER_VERSION "ace53901af1aae25365b1302c0fa7c7ed69821ea") - set(DRIVER_CHECKSUM "SHA256=80e04cc3400b3b8e22bddad6b663adff311ab51a19b04baee1e49b06d3860c00") + set(DRIVER_VERSION "68a96aa5b7e34d7893563ded8c3d95bb3e77785f") + set(DRIVER_CHECKSUM "SHA256=74261bce85954bc1d86fef00710c8bb7cb0d7b2b7a074815e38c7517c21a1207") endif() # cd /path/to/build && cmake /path/to/source diff --git a/cmake/modules/falcosecurity-libs.cmake b/cmake/modules/falcosecurity-libs.cmake index 837c7fc22f..13c41ea989 100644 --- a/cmake/modules/falcosecurity-libs.cmake +++ b/cmake/modules/falcosecurity-libs.cmake @@ -32,8 +32,8 @@ else() # In case you want to test against another falcosecurity/libs version (or branch, or commit) just pass the variable - # ie., `cmake -DFALCOSECURITY_LIBS_VERSION=dev ..` if(NOT FALCOSECURITY_LIBS_VERSION) - set(FALCOSECURITY_LIBS_VERSION "ace53901af1aae25365b1302c0fa7c7ed69821ea") - set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=80e04cc3400b3b8e22bddad6b663adff311ab51a19b04baee1e49b06d3860c00") + set(FALCOSECURITY_LIBS_VERSION "68a96aa5b7e34d7893563ded8c3d95bb3e77785f") + set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=74261bce85954bc1d86fef00710c8bb7cb0d7b2b7a074815e38c7517c21a1207") endif() # cd /path/to/build && cmake /path/to/source diff --git a/userspace/sinspui/cursescomponents.cpp b/userspace/sinspui/cursescomponents.cpp index 7af505e3cf..1c05e509d2 100644 --- a/userspace/sinspui/cursescomponents.cpp +++ b/userspace/sinspui/cursescomponents.cpp @@ -133,7 +133,7 @@ const char* spy_text_renderer::process_event_spy(sinsp_evt* evt, int64_t* len) // // Get and validate the length // - sinsp_evt_param* parinfo = evt->get_param(0); + const sinsp_evt_param* parinfo = evt->get_param(0); ASSERT(parinfo->m_len == sizeof(int64_t)); *len = *(int64_t*)parinfo->m_val; if(*len <= 0) diff --git a/userspace/sysdig/sysdig.cpp b/userspace/sysdig/sysdig.cpp index fd975321bc..0c7a93f08c 100644 --- a/userspace/sysdig/sysdig.cpp +++ b/userspace/sysdig/sysdig.cpp @@ -866,13 +866,13 @@ captureinfo do_inspect(sinsp* inspector, if(etype == PPME_GENERIC_E) { - sinsp_evt_param *parinfo = ev->get_param(0); + const sinsp_evt_param *parinfo = ev->get_param(0); uint16_t id = *(int16_t *)parinfo->m_val; summary_table[PPM_EVENT_MAX + id * 2].m_ncalls++; } else if(etype == PPME_GENERIC_X) { - sinsp_evt_param *parinfo = ev->get_param(0); + const sinsp_evt_param *parinfo = ev->get_param(0); uint16_t id = *(int16_t *)parinfo->m_val; summary_table[PPM_EVENT_MAX + id * 2 + 1].m_ncalls++; } diff --git a/userspace/sysdig/utils/plugin_utils.cpp b/userspace/sysdig/utils/plugin_utils.cpp index 0a33c2397f..351869eee3 100644 --- a/userspace/sysdig/utils/plugin_utils.cpp +++ b/userspace/sysdig/utils/plugin_utils.cpp @@ -23,7 +23,7 @@ limitations under the License. #include #include -#include +#include #include #include @@ -96,38 +96,31 @@ namespace YAML { static bool iterate_plugins_dirs( const std::vector& dirs, - const std::function& predicate) + const std::function& predicate) { bool breakout = false; for (const auto & plugin_dir : dirs) { - if (plugin_dir.empty()) + std::filesystem::path dir = plugin_dir; + + if (!std::filesystem::exists(dir) || !std::filesystem::is_directory(dir)) { continue; } - tinydir_dir dir = {}; - - for (tinydir_open(&dir, plugin_dir.c_str()); dir.has_next && !breakout; tinydir_next(&dir)) - { - tinydir_file file; - tinydir_readfile(&dir, &file); - - auto namelen = strlen(file.name); - auto extlen = strlen(SHAREDOBJ_EXT); - if (file.is_dir - || strcmp(file.name, ".") == 0 - || strcmp(file.name, "..") == 0 - || (namelen > extlen - && strcmp(file.name + namelen -extlen, SHAREDOBJ_EXT) != 0)) - { - continue; - } - - breakout = predicate(file); - } + for (const auto &file : std::filesystem::directory_iterator(dir)) + { + if (!std::filesystem::is_directory(file) + && file.path().extension() == SHAREDOBJ_EXT) + { + breakout = predicate(file); + } + else + { + continue; + } + } - tinydir_close(&dir); if (breakout) { break; @@ -308,16 +301,20 @@ void plugin_utils::load_plugin(sinsp *inspector, const std::string& name) soname = SHAREDOBJ_PREFIX + name + SHAREDOBJ_EXT; } auto& plugins = m_plugins; - bool found = iterate_plugins_dirs(m_dirs, [&inspector, &name, &soname, &plugins] (const tinydir_file file) -> bool { - if (file.name == name || file.name == soname) + bool found = iterate_plugins_dirs(m_dirs, [&inspector, &name, &soname, &plugins] (const std::filesystem::path file) -> bool { + + auto filename = file.filename(); + auto filepath = std::filesystem::absolute(file); + + if (filename == name || filename == soname) { plugin_entry p; p.used = true; p.inited = false; - p.libpath = file.path; + p.libpath = filepath; p.names.insert(soname); - p.names.insert(file.path); - p.names.insert(file.name); + p.names.insert(filepath); + p.names.insert(filename); p.names.insert(p.get_plugin(inspector)->name()); plugins.push_back(p); return true; // break-out @@ -334,17 +331,20 @@ void plugin_utils::read_plugins_from_dirs(sinsp *inspector) { auto& plugins = m_plugins; auto tmpinsp = std::unique_ptr(new sinsp()); - iterate_plugins_dirs(m_dirs, [&inspector, &plugins, &tmpinsp] (const tinydir_file file) -> bool { + iterate_plugins_dirs(m_dirs, [&inspector, &plugins, &tmpinsp] (const std::filesystem::path file) -> bool { + + auto filepath = std::filesystem::absolute(file); + // we temporarily load the plugin just to read its info, // but we don't actually load it in our inspector - auto plugin = tmpinsp->register_plugin(file.path); + auto plugin = tmpinsp->register_plugin(filepath); plugin_entry p; p.used = false; p.inited = false; - p.libpath = file.path; - p.names.insert(file.path); - p.names.insert(file.name); + p.libpath = filepath; + p.names.insert(filepath); + p.names.insert(file.filename()); p.names.insert(plugin->name()); plugins.push_back(p); return false;