cleanup(plugins/container): drop static vars#728
Merged
poiana merged 3 commits intofalcosecurity:mainfrom Apr 28, 2025
Merged
Conversation
Make it a class member. Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
Static-storage variables are correctly checked. This can happend in 2 scenarios: * sinsp erratingly calls multiple times start async API (should be a bug but better safe than sorry) * Falco hot reload dry-run checks Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
FedeDP
commented
Apr 28, 2025
| project( | ||
| container | ||
| VERSION 0.2.0 | ||
| VERSION 0.2.1 |
FedeDP
commented
Apr 28, 2025
Comment on lines
+26
to
+31
| // We are already started. This can happen: | ||
| // * if `start_async_events` is called multiple times | ||
| // * during Falco hot reload dry-run checks; in that scenario, | ||
| // the same library object gets opened once again, thus a new `my_plugin` | ||
| // instance is created, | ||
| // and all static variables are shared. Just return true and do nothing. |
Contributor
Author
There was a problem hiding this comment.
This is relevant comment.
FedeDP
commented
Apr 28, 2025
| nlohmann::json j(m_cfg); | ||
| const char *enabled_engines = nullptr; | ||
| s_async_ctx = StartWorker(generate_async_event<ASYNC_HANDLER_GO_WORKER>, | ||
| m_async_ctx = StartWorker(generate_async_event<ASYNC_HANDLER_GO_WORKER>, |
Contributor
Author
There was a problem hiding this comment.
s_async_ctx (static) -> m_async_ctx (member of my_plugin class).
Rules files suggestions |
leogr
approved these changes
Apr 28, 2025
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area plugins
What this PR does / why we need it:
The PR drops a useless static var in container plugin ASYNC capability.
Also, it properly checks for the only remaining static variable before using it.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: