From 725714726d0c90848d068e43a83603c16c7a5dd4 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Sat, 24 Sep 2022 14:16:11 +0000 Subject: [PATCH] update(configuration): define `m_syscall_buf_size_preset` as `uint16_t` improve also some logs for `m_syscall_buf_size_preset` configuration errors Signed-off-by: Andrea Terzolo Co-authored-by: Jason Dellaluce --- userspace/falco/app_actions/compute_syscall_buffer_size.cpp | 6 +++--- userspace/falco/configuration.cpp | 2 +- userspace/falco/configuration.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/userspace/falco/app_actions/compute_syscall_buffer_size.cpp b/userspace/falco/app_actions/compute_syscall_buffer_size.cpp index bd92444a..7f7af7b0 100644 --- a/userspace/falco/app_actions/compute_syscall_buffer_size.cpp +++ b/userspace/falco/app_actions/compute_syscall_buffer_size.cpp @@ -36,7 +36,7 @@ application::run_result application::configure_syscall_buffer_size() uint16_t index = m_state->config->m_syscall_buf_size_preset; if(index < MIN_INDEX || index > MAX_INDEX) { - return run_result::fatal("The index must be between '" + std::to_string(MIN_INDEX) + "' and '" + std::to_string(MAX_INDEX) + "'\n"); + return run_result::fatal("The 'syscall_buf_size_preset' value must be between '" + std::to_string(MIN_INDEX) + "' and '" + std::to_string(MAX_INDEX) + "'\n"); } /* Sizes from `1 MB` to `512 MB`. The index `0` is reserved, users cannot use it! */ @@ -55,13 +55,13 @@ application::run_result application::configure_syscall_buffer_size() /* Check if the chosen size is a multiple of the page size. */ if(chosen_size % page_size != 0) { - return run_result::fatal("The chosen size '" + std::to_string(chosen_size) + "' is not a multiple of your system page '" + std::to_string(page_size) + "'. Please choose a greater index.\n"); + return run_result::fatal("The chosen syscall buffer size '" + std::to_string(chosen_size) + "' is not a multiple of your system page size '" + std::to_string(page_size) + "'. Please configure a greater 'syscall_buf_size_preset' value in the Falco configuration file.\n"); } /* Check if the chosen size is greater than `2 * page_size`. */ if((chosen_size / page_size) <= 2) { - return run_result::fatal("The chosen size '" + std::to_string(chosen_size) + "' is not greater than '2 * " + std::to_string(page_size) + "'. Please choose a greater index.\n"); + return run_result::fatal("The chosen syscall buffer size '" + std::to_string(chosen_size) + "' is not greater than '2 * " + std::to_string(page_size) + "' where '" + std::to_string(page_size) + "' is your system page size. Please configure a greater 'syscall_buf_size_preset' value in the Falco configuration file.\n"); } m_state->syscall_buffer_bytes_size = chosen_size; diff --git a/userspace/falco/configuration.cpp b/userspace/falco/configuration.cpp index 506a8592..bd43fa32 100644 --- a/userspace/falco/configuration.cpp +++ b/userspace/falco/configuration.cpp @@ -288,7 +288,7 @@ void falco_configuration::init(string conf_filename, const vector &cmdli /* We put this value in the configuration file because in this way we can change the dimension at every reload. * The default value is `4` -> 8 MB. */ - m_syscall_buf_size_preset = m_config->get_scalar("syscall_buf_size_preset", 4); + m_syscall_buf_size_preset = m_config->get_scalar("syscall_buf_size_preset", 4); std::set load_plugins; diff --git a/userspace/falco/configuration.h b/userspace/falco/configuration.h index a10b67ca..7b60f7ca 100644 --- a/userspace/falco/configuration.h +++ b/userspace/falco/configuration.h @@ -270,7 +270,7 @@ public: uint32_t m_metadata_download_watch_freq_sec; // Index corresponding to the syscall buffer dimension. - uint64_t m_syscall_buf_size_preset; + uint16_t m_syscall_buf_size_preset; std::vector m_plugins;