Skip to content

Commit

Permalink
fix(build): do not show plugin options in musl optimized builds
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Jan 26, 2022
1 parent 7750b6f commit 69767bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 67,7 @@ endif()

if(MUSL_OPTIMIZED_BUILD)
set(MUSL_FLAGS "-static -Os -fPIE -pie")
add_definitions(-DMUSL_OPTIMIZED)
endif()

# explicitly set hardening flags
Expand Down
12 changes: 7 additions & 5 deletions userspace/falco/falco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 137,12 @@ static void usage()
" -l <rule> Show the name and description of the rule with name <rule> and exit.\n"
" --list [<source>] List all defined fields. If <source> is provided, only list those fields for\n"
" the source <source>. Current values for <source> are \"syscall\", \"k8s_audit\"\n"
#ifndef MUSL_OPTIMIZED_BUILD
" --list-fields-markdown [<source>]\n"
" List fields in md\n"
#ifndef MUSL_OPTIMIZED
" --list-plugins Print info on all loaded plugins and exit.\n"
#endif
#ifndef MINIMAL_BUILD
" -m <url[,marathon_url]>, --mesos-api <url[,marathon_url]>\n"
" Enable Mesos support by connecting to the API server\n"
" specified as argument. E.g. \"http://admin:[email protected]:5050\".\n"
Expand Down Expand Up @@ -574,9 578,7 @@ int falco_init(int argc, char **argv)
{"k8s-api", required_argument, 0, 'k'},
{"k8s-node", required_argument, 0},
{"list", optional_argument, 0},
#ifndef MUSL_OPTIMIZED_BUILD
{"list-plugins", no_argument, 0},
#endif
{"mesos-api", required_argument, 0, 'm'},
{"option", required_argument, 0, 'o'},
{"pidfile", required_argument, 0, 'P'},
Expand Down Expand Up @@ -769,7 771,7 @@ int falco_init(int argc, char **argv)
list_flds_source = optarg;
}
}
#ifndef MUSL_OPTIMIZED_BUILD
#ifndef MUSL_OPTIMIZED
else if (string(long_options[long_index].name) == "list-plugins")
{
list_plugins = true;
Expand Down Expand Up @@ -965,7 967,7 @@ int falco_init(int argc, char **argv)
for(auto &p : config.m_plugins)
{
std::shared_ptr<sinsp_plugin> plugin;
#ifdef MUSL_OPTIMIZED_BUILD
#ifdef MUSL_OPTIMIZED
throw std::invalid_argument(string("Can not load/use plugins with musl optimized build"));
#else
falco_logger::log(LOG_INFO, "Loading plugin (" p.m_name ") from file " p.m_library_path "\n");
Expand Down

0 comments on commit 69767bb

Please sign in to comment.